akllt / infrastructure

tech infrastructure docs for Atviras Kodas Lietuvai (akl.lt)
4 stars 0 forks source link

ubuntu.lt is moving to vaiduoklis.pov.lt #9

Closed mgedmin closed 3 years ago

mgedmin commented 3 years ago

Also

mgedmin commented 3 years ago

Current status:

FATAL:  password authentication failed for user \"postgres\"

while running manage.py migrate (why manage.py and not django-admin migrate? anyway).

I suspect there's a settings.py somewhere that incorrectly tells django to use user postgres instead of ubuntult. And indeed, /opt/ubuntu.lt/spirit/project/settings.dev.py has

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'HOST': '127.0.0.1',
        'NAME': 'ubuntult',
        'USER': 'postgres', 
        'PASSWORD': 'secret',
    }
}

Is dev.py the right settings file to use for production? If not, then why does /opt/ubuntu.lt/spirit/manage.py do

    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings.dev")

?

Hm, I found a /opt/ubuntu.lt/.env with a bunch of interesting environment variables (with names containing SECRET in a world-readable file, anyway, moving along). which gives me an idea.

mgedmin commented 3 years ago

The idea that I had: https://github.com/akllt/infrastructure/pull/10

sirex commented 3 years ago

Hm, I found a /opt/ubuntu.lt/.env with a bunch of interesting environment variables (with names containing SECRET in a world-readable file, anyway, moving along).

Fixed .env file permissions.