Feature: Set up stage environment in docker #613
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #610
Goal: Set up the django backend for deployment to AWS.
As a developer, the
develop
branch should be ready to deploy to AWS at any moment.Changes
frontend/dist
folder from the repo and add to.gitignore
/stage/Dockerfile
anddocker-compose.stage.yml
. They are now fully functional and ready to deploy to a staging environment./backend/entrypoint.sh
from main-v1pyyaml
,inflection
, anduritemplate
) required for Django REST Framework to generate an OpenAPI schema./frontend/dist
. The static frontend files should be copied over to the django app during the build phase in/stage/Dockerfile
stage.env.example
Misc:
.gitignore
files.dockerignore
fileTesting
I fully tested on my local windows machine:
There is only one new bug in the stage environment - the frontend crashes when you try to visit the qualifiers page. This does not occur in dev mode. It has something to do with the static build and how react-router is set up. I will fix this later.
Starting a web server with daphne
- Before, v1 was using WSGI and gunicorn to serve static files. Imo this approach is a bit outdated.
- ASGI will allow for dynamic API calls and will overall be better for the long term maintainability of the project.
runserver
functionalities, so ASGI can be tested in dev mode:collectstatic
commanddaphne start server command:
OR
Stage environment
Steps to start the staging environment on your local machine:
First, create a
stage.env
file in the/stage
folder in your local repository.You can use
stage.env.example
as a template. It can have all the same values asdev.env
. The only significant difference as of now isENVIRON=stage
andDEBUG=false
.Next, open a terminal and simply run:
Finally, open a browser and visit
localhost:8000
. You should see the CTJ website, and you should be able to access the API:Resources