-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maybe generate cloud_copasi/settings.py during Docker build. #23
Comments
It contains a password and some secret keys which I believe cannot be made public. And yes, settings.py.EXAMPLE has to be updated with latest contents (from current settings.py file). |
Yes, I've thought of this, when I was looking at that Docker documentation docker-compose Django example. I think for the Docker container it might be safe to put those in there: Those might stay private to the containers and special network the docker daemon creates for them to communicate with one another. In other words, it might not matter if others know the passwords the Docker containers use, if they have no way of getting in to do anything with them. And it's already a problem, if we have been tracking (committing to this repo) a current (working) settings.py file. That should only be created upon installation, and not pushed to this repo. |
Current settings.py file is not a part of this repo at the moment. But we can update the settings.py.EXAMPLE file with all necessary configurations set other than private stuff. This is in my to-do list also. Please let me know if I you want to keep in a docker file and want me to do this first? |
Yeah . . . we can confirm, but that Docker Compose Django example seems to imply it would be safe to store passwords in there (maybe because of reasons I mentioned above). But we'd probably want to make it clear, in code comments, that they should use a different way to get secrets in (e.g. Python os.env), if they are not using the Docker container install. |
Okay. BTW, I am now updating settings.py.EXAMPLE file with correct file paths and other configurations. |
I have updated settings.py.EXAMPLE file. This can be used in place of settings.py file for cloud-copasi django project. Users need to change 1) the database password:
and 2) the Secret key:
Apart from this, they would need to set up the host and domain related information. That's it! We can keep this file in docker as |
Thanks for updating this! I like those changes. What I was thinking was to, if possible, make settings.py.EXAMPLE exactly match what would work for the docker-compose build. Then the Dockerfile would simply Regardless, I think the EXAMPLE defaults should be close to a production example. Relative to that, looking through the file a little, might we want to (e.g.) change . . . |
Ok . . . It does also look like the settings.py example here . . . |
Yes, this The example file is very close to a production example. As I said before, all what user needs to do is to make the changes mentioned in #23 (comment) along with their host/domain information. Setting |
Yes, but in our case, we don't need to create a django project. Whenever a django project is created, it auto generates |
Hmmm. I would think the auto generated settings.py might just be what happens in a single user example scenario, when they don't even have a project already. So, I would say, for our example settings.py, for our already-made project, we should have things like We're probably thinking along the same lines. I just want to set it up so that, if possible, everything can just work (and still be secure best practices), without anyone having to edit settings.py, etc. It seems like that docker-compose Django example must already account for/imply this. Maybe not. I mean, as it currently stands, our Deploy documentation basically just says 'Go edit settings.py as appropriate'. |
So, I think, all we really might need to change to have DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': os.environ.get('POSTGRES_NAME'),
'USER': os.environ.get('POSTGRES_USER'),
'PASSWORD': os.environ.get('POSTGRES_PASSWORD'),
'HOST': 'db', # '127.0.0.1' or '' (empty) for localhost
'PORT': '5432', # '5432' is the default PostgrSQL db port
}
} And that would also be an appropriate (more secure) example for any user wishing to try the full manual install. |
I agree! Lets proceed ahead with this! |
@hasanbaig asked, "We also have to modify settings.py file (may be we can include it in the instructions?)"
Perhaps we can change/update the
settings.py.EXAMPLE
to fully work with the Docker build, and thenCOPY
it over to the container image'ssettings.py
during the build. Or, if that is not also a decent "example" for a regular build, we could add asettings.py.DOCKER
. But I like the first option better, as it is simpler, and requires less files to keep updated. I think the Docker build should be a model example for our standard installation (and thus be associated with the best "EXAMPLE").The text was updated successfully, but these errors were encountered: