6. Container Deployment#
This week you created a Dockerfile
to package your application and you used the GitHub paction in the project to build your container on GitHub. To complete this milestone you have to prove that your public container is ready to run. Code reviewers will pull your container image and test it.
A container image is a program that is designed to run in the cloud. The container should include the program instructions only. It should not have any saved data or configuration (except for the default configuration). Those things should be decided on by the users of your application. Reviewers should check to make sure that all of the required environment variables are present in the Dockerfile
and settings.py
.
Release#
Before you submit this milestone make a GitHub release named milestone-6.x
. The GitHub action triggers a build of your Dockerfile
automatically anytime a release is created. Verify that the container builds successfully and that a package with a milestone-6.x
tag appears.
Test Procedure#
The container in this milestone will be used for the next five weeks. It’s important that it be correct or you might experience hard to explain problems with upcoming milestones. Please do your review carefully so that your reviewee has a good basis for the next tasks.
Open the milestone in GitHub Codespaces. Make sure it’s the milestone release.
Open
Dockerfile
and verify that there are default settings for each of the environment variables:Name
Default
PORT
8000
STUDENT_NAME
The name of the reviewee
SITE_NAME
Anything is okay
SECRET_KEY
Any non-empty key is okay
DEBUG
1
DATA_DIR
/data
Error
If any are missing or set incorrectly send a report with the specific variable names and the correct value.
Build their application:
$ docker build -t testsite .
Run the container in the background and open it in the browser when prompted. You might see an error, that’s okay.
$ docker run -d --rm -p 8000:8000 --name testsite testsite
Initialize the database. Remember the user you create:
$ docker exec -it testsite python manage.py migrate $ docker exec -it testsite python manage.py createsuperuser
Error
If the database already has a superuser report this as an error.
Browse to the site in the preview tab and login with the user credentials you just created.
Error
Triple check your login. If you can’t login report it to the reviewee
Take a screenshot of the administrator interface with the user you created.
Clean up. Stop and remove the container:
$ docker rm -f testsite
Submit#
Tag this milestone
milestone-6.x
.A URL to the your milestone release on GitHub. It should look like this:
https://github.com/your-name/your-cis-92-repo/releases/tag/milestone-6.x