-
Notifications
You must be signed in to change notification settings - Fork 45
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
Better automate deploy #762
base: dev
Are you sure you want to change the base?
Conversation
There should only be one command to run to get any project going. Here, it's ``` docker-compose up ``` This also moves parts of the subsidiary docker-compose files directly into Dockerfile or the main docker-compose.yml, since they make more sense there, and relabels what's left of docker-compose.override.yml after that as docker-compose.dev.yml, since that's what it really is. This also adds copious comments to the Dockerfile.
^ this was a change to the Docker stuff so per #758 the CI check is misleading here. The only way to verify this is to do a fresh build on your own machine. |
Ah, actually, this isn't quite working. It puts the static files in |
It was added as a workaround for a semi-broken JS dependency, and its evidently unnecessary now. Fixes #759.
…net. Instead, listen on localhost, forcing a proxy in (hopefully with TLS) in front if the sysadmin wants to expose Sous-Chef publically. Fixes #761.
I'm probably not going to get to fixing this up this week. It shouldn't be tricky, but it just needs some repetition until it reliably puts all the files in the right paths, and docker rebuilds are really really slow and discouraging. So, this will happen, but you'll have to be patient with me. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have opened a different PR #775 to test the project using Docker, we should probably unify this changes or merge the other PR first so we test this changes and verify that they are not breaking anything.
# the magic docker-compose override file is for overriding settings locally | ||
# it should not be a part of the repo. If you want per-environment settings, | ||
# use an explicit `docker-compose -f docker-compose.yml -f docker-compose.environment.yml` | ||
docker-compose.override.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kousu If we are using docker-compose we should follow their conventions, and by default docker-compose command will read the configurations files "docker-compose.yml" and "docker-compose.override.yml". The main idea is to have in the "docker-compose.yml" the configurations that remain the same in all environements, use "docker-compose.override.yml" to the development environment that is used more frequently by developers and have separated configurations files for other environments like staging or prod.
For more detailed information check https://docs.docker.com/compose/extends/#example-use-case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the link. Having the laser focus there really helps move the debate forward, and I agree that you're doing it just as they suggest.
I still think it's wrong. docker-compose.yml
can have dev settings in it by default which are then overridden by docker-compose.prod.yml
. "override" says to me "these are settings which are custom to this specific instance, which I need in order"; if they meant "override" to always mean "dev" then they should have called it "dev". Emphatically I think that name means they must not be stored as part of the codebase, and not be in the repo, be .gitignore
'd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kousu I agree with you personally. I don't like the use of the word "override" of docker-compose either and it brought me some troubles and confusion... but I think this is their convention according to their doc, so I would follow the usage of "override" so that we work on the same page with docker-experienced developers.
I think it is important to mention the doc link somewhere in the project, in order to help developers like me and @kousu who don't know this convention of docker-compose a priori.
# the default entrypoint for the container | ||
# when this ends, the container ends, then restarts | ||
# can be overridden in docker-compose.yml files | ||
CMD python3 src/manage.py runserver 0.0.0.0:8000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not use this server by default, this is a development server that should be used only for development if we are going to use this image in production, we should use by default gunicorn and override it with the development server in the docker-compose.override.yml configuration file, or not have any entry point at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought you must have an entry point. Without one, the container shuts down immediately.
I would love it if docker let you just bring up a container with no master process. It lets you docker exec
arbitary side commands in a single container, so why do any of them need to be key?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# the 'rebuild node-sass' is a patch over a glitch which showed up recently; | ||
# the tip that fixed it is from https://github.com/sass/node-sass/issues/1387#issuecomment-185451183 | ||
# perhaps it is not truly necessary. | ||
run mkdir /code/src/sous_chef/static/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is not truly necessary we should not include it, so we need to check it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is resolved in #775.
services: | ||
web: | ||
volumes: | ||
- .:/code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need this file and we should keep using docker-compose.override.yml because for developers is easier to do docker-compose up -d
than docker-compose -f docker-compose.yml -f docker-compose.dev.yml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved in #775.
@@ -1,8 +0,0 @@ | |||
version: '3' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved in #775.
@@ -14,6 +14,8 @@ services: | |||
- backend | |||
|
|||
web: | |||
ports: | |||
- "127.0.0.1:8000:8000" | |||
environment: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this binding why you have added it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved this binding from docker-compose.override.yml
, and added the fix for #761 at the same time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to me that it's needed? I didn't see in #775.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lingxiaoyang if we are only using this binding in development mode, in the docker-compose.override.yml
we don't relly need to take care of security and promiscuous ports because we are using the development server anyway.
@lingxiaoyang @kousu but we should change the binding in the nginx container to add the IP
127.0.0.1:80:80
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@erozqba Got your idea.
I think we need to reconcile this PR with #775, as both are working on the same files. |
|
||
[collectstatic](https://docs.djangoproject.com/en/1.11/ref/contrib/staticfiles/#collectstatic) is similar, but built into Django. | ||
We are not using it to manage our own static files, but some of our Django dependencies might need this to be run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kousu Good work! We keep this file.
@kousu could you rebase this branch? |
Update the documentation from changes proposed in savoirfairelinux/pull/762.
Changes proposed in this pull request:
docker-compose up
is enough to get the project running (admittedly with an empty database.)Status
This was branched off #757 so please merge that first.
How to verify this change
Do a fresh checkout and a fresh build. See that it works with just
docker-compose up
. Try then withdocker-compose -f docker-compose.yml -f docker-compose.yml up
Deployment notes and migration
Additional notes
Deployment has been a huge headache for me. INSTALL.md is pretty nicely fleshed out, but it's still really hard to knowing when and what order to run things, and I would rather move as many instructions into (commented) scripts instead of into instructions that humans need to follow manually.