-
Notifications
You must be signed in to change notification settings - Fork 11
Docker Configuration Changes #142
Comments
Hey @BretFisher, what did you mean by proxy in the second Tooling subtask? Also, re: secrets, since the PostgreSQL image uses environment variables, we'd likely still have a I would assume we'd want to switch out the secrets between enviroments (development and production), so we wouldn't want to keep those in version control, right? We'd have them in a |
For proxy task, since nginx is just performing page caching and ssl reverse proxy, it doesn't add value to local development and may prove tricky with "cache busting" type issues. So we can have the default docker-compose.yml just be two services and an additional "override" compose file that adds proxy for prod :) |
I've started a branch and PR at #147 for this and started checking off some of the tasks, but how to we seed the db? I assume it's why my node container just exits on start. |
I think Trails handles the seeding, but need @wbprice to confirm. @BretFisher: thank you so much for this. |
@ryayak1460 fixture data is being created by Trails where it doesn't already exist during a bootstrap step. |
So when I run the |
Yea, even if just on host w/o docker if I just run ➜ 🐳 okcandidate-platform git:(142-docker-improve) node index.js
Warning: Accessing PropTypes via the main React package is deprecated, and will be removed in React v16.0. Use the latest available v15.* prop-types package from npm instead. For info on usage, compatibility, migration and more, see https://fb.me/prop-types-docs
(node:17347) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
➜ 🐳 okcandidate-platform git:(142-docker-improve) |
This is not done. We still have lots of sections to work through. |
Docker Image for branch Once we've launched |
From #118:
Goal:
git clone
thendocker-compose up
.Compose configuration:
[ ] Implement secrets in compose (compose file 3.1 format).Looks like we're going Heroku which won't use compose files in prod..env
to reduce developer complexity and prevent env var bleeding into unnecessary containers (e.g, node keys in db container). Move those vars to compose file.docker-compose.yml
is designed for local dev ease-of-use. Any other overrides can be added in other files for CI or Prod.Dockerfile/Docker Hub:
code4hr
org and keep it up to date with latest node stable (it rebuilds when upstream node repo changes)Tooling:
(Pulled the following from the Node.js Good Defaults README):
Local Development Features:
node_modules
outside app root in container so local development won't run into a problem of bind-mounting over it with local source code. This means it will runnpm install
once on container build and you don't need to run npm on host or on each docker run. It will re-run on build if you changepackage.json
.docker-compose up
for single-line build and run of local development server.--inspect
by default in docker-compose, but you can change to--debug
for < 6.3 debugging..vscode
has a config for both--debug
and--inspect
node options.COPY
inpackage.json
and runnpm install && npm cache clean
beforeCOPY
in your source code. This saves big on build time and keep container lean.Production-minded Features:
HEALTHCHECK
with/healthz
route to help Docker know if your container is running properly (example always returns 200, but you get the idea).NODE_ENV=production
in Dockerfile and overrides todevelopment
in docker-compose for local dev.NODE_ENV
use means dev dependencies won't be installed in container by default. Using docker-compose will build with them by default.node index.js
rather then npm for allowing graceful shutdown of node. npm doesn't pass SIGTERM/SIGINT properly (you can't ctrl-c when runningdocker run
in foreground). To getnode index.js
to graceful exit, extra signal-catching code is needed. TheDockerfile
andindex.js
document the options and links to known issues.The text was updated successfully, but these errors were encountered: