Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Rex Dri Rex Dri
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 33
    • Issues 33
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Rex Dri
  • Rex DriRex Dri
  • Issues
  • #66
Closed
Open
Issue created Feb 25, 2019 by Florent Chehab@chehabflOwner16 of 16 checklist items completed16/16 checklist items

Create docker-compose config for deploy

Description

  • Create a new docker-compose file (docker-compose.prod.yml) (at the root of the project), to be used in the production environment,
  • It should make use of the Dockerfile we already have for the backend,
  • For the frontend, it should be built (with production settings: npm run build) on startup, and then container will not be required. You can reuse what we currently have.
  • All client requests should go through an Nginx container
  • Nginx should be configured to serve the static files properly (with gzip configuration if possible)
  • The Django app should be through Uwsgi with 4 workers (for now)
  • The database stays the same,
  • You should have one persistent volume for the database (just like currently)
  • Only nginx (exposed on port 80) must be visible from outside; you can make use of private network where it makes sense.

Env variables: Env variables are used to contain all IDs / very short configuration.

  • Create a dev.env file with all the current env variables set in docker-compose.yml
  • Update docker-compose.yml to make use of this file.
  • Create a prod.env file (**and add it to .gitignore) that will hold the production IDs (we will set the values later; it should have all the same entries as dev.env, with different values).

Configuration files: You might need to create configuration files for nginx & uwsgi. Put them in a folder prod_conf at the root of the repo. You can then map them as dynamic volumes in docker-compose. You might want to create different env files for the different aspect of the app and not to share all IDs in all containers. If so, put them in other .env files in prod_conf.

NB: no django migrations should be applied automatically.

Other

  • Make sure django is configured properly (allowed_host, etc.)

Conclusion

The app should be up and running with production settings with a simple docker-compose up --build --file docker-compose.prod.yml

Documentation

  • Make sure to document (in the documentation) the exact steps required to put the app in production (all the commands and files to edit).

TODO

  • Handle logging properly
  • Find a workaround for node_modules assets not being present if no npm i or needed to map them from the image (beurk)
Edited May 11, 2019 by Florent Chehab
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking