Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
  • Sign in
Rex Dri
Rex Dri
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 32
    • Issues 32
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Rex Dri
  • Rex DriRex Dri
  • Issues
  • #66

Closed
Open
Opened Feb 25, 2019 by Florent Chehab@chehabfl16 of 16 tasks completed16/16 tasks
  • Report abuse
  • New issue
Report abuse New issue

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. More information
Assignee
Assign to
PR next
Milestone
PR next
Assign milestone
Time tracking
None
Due date
None
0
Labels
None
Assign labels
  • View project labels
Reference: rex-dri/rex-dri#66