This repository contains configuration files and instructions for the deployment of the carbon case application on a Docker/Portainer server.
NB: Where you read energietransitiewindesheim.nl
below, you should subsitute your own domain.
This repository assumes that the configuration will be deployed on the following infrastructure:
- Linux server (Ubuntu 20.04)
- Docker
- Portainer
- Running Traefik container on
web
network.
The configuration will use Traefik to route the domains below to their respective containers.
carboncase.energietransitiewindesheim.nl
: Landing page.app.carboncase.energietransitiewindesheim.nl
: App frontend.dash.carboncase.energietransitiewindesheim.nl
: Management dashboard frontend.api.app.carboncase.energietransitiewindesheim.nl
: App API backend.api.dash.carboncase.energietransitiewindesheim.nl
: Management dashboard API backend.
app.carboncase.tst.energietransitiewindesheim.nl
: App frontend.dash.carboncase.tst.energietransitiewindesheim.nl
: Management dashboard frontend.api.app.carboncase.tst.energietransitiewindesheim.nl
: App API backend.api.dash.carboncase.tst.energietransitiewindesheim.nl
: Management dashboard API backend.deploy.carboncase.tst.energietransitiewindesheim.nl
: Webhook to update test container images.
Use the following steps to deploy a Portainer stack.
At Windesheim we use Portainer stacks, but the docker-compose files can also be deployed without Portainer, using Docker Compose.
Add a new stack according to the following steps:
- Go to
stacks
in portainer. - Click on
Add stack
. - Give the stack a name.
- Select
git repository
as the build method. - Set the
repository URL
to:https://github.com/energietransitie/carboncase-deployment-configuration
- Leave the
repository reference
to use the default. - Set the
compose path
to point to the docker-compose.yml you want to deploy.- Use the following path for production:
production/docker-compose.yml
- Use the following path for test:
test/docker-compose.yml
- Use the following path for production:
- Add the corresponding environment variables for the environment (production or test). Click on
Add an environment variable
to add additional variables. - Click on
Deploy the stack
.
The production environment requires the following enironment variables to be set in the Portainer stack.
This environment variable is used to set the database user for the wordpress database.
Example values: wordpress
or user
This environment variable is used to set the database password for the wordpress database.
Example values: 78sb6g654b56sdv7s89dv
or as78sdv78sfdv67sdv5dc8sdv09sv
This environment variable is used to set the database system administrator password.
Example values: 78sb6g654b56sdv7s89dv
or as78sdv78sfdv67sdv5dc8sdv09sv
This environment variable is used to set which database should be created.
Example values: app
or test
This environment variable is used to set the database user for the app database.
Example values: app
or user
This environment variable is used to set the database password for the app database.
Example values: 78sb6g654b56sdv7s89dv
or as78sdv78sfdv67sdv5dc8sdv09sv
This environment variable is used to set the key used for signing the JWT token used for user authorization. NOTE: this must be a string that is at least 128 bit.
Example values: YzhSGXWIWqjDvSlUbDUWC6jlPGy9vdlPPHnDHI63v50wcN4l1k4BreFaw6pC5BgUlBzyxvhBhpokNrg9lfmjt2V7geo9CniLV2bu
or pl0vyh6y3tDvHHCBcfj6knlhN9lW9FjDGUGxgLNeqz2XbU7rpdVleDIWuSa2hmYvwBglir4Bvzk5VogbPwl46U5InSWPP1BCo9jC
This environment variable is used to set the email account username which is used for sending e-mails for account confirmation in the management dashboard.
Example values: test@test.nl
or hello@carboncasecalculator.example
This environment variable is used to set the email account password which is used for sending e-mails for account confirmation in the management dashboard.
Example values: 78sb6g654b56sdv7s89dv
or as78sdv78sfdv67sdv5dc8sdv09sv
This environment variable is used to set the email account display name which is used for sending e-mails for account confirmation in the management dashboard.
Example values: Energietransitie Windesheim
or Carbon Case Calculator
This environment variable is used to set the client id for GitHub authorization.
Example values: 78sb6g654b56sdv7s89dv
or as78sdv78sfdv67sdv5dc8sdv09sv
This environment variable is used to set the client secret for GitHub authorization.
Example values: 78sb6g654b56sdv7s89dv
or as78sdv78sfdv67sdv5dc8sdv09sv
This environment vraiable is used to set the client id for Microsoft authorization.
Example values: 78sb6g654b56sdv7s89dv
or as78sdv78sfdv67sdv5dc8sdv09sv
This environment variable is used to set the client secret for Microsoft authorization.
Example values: 78sb6g654b56sdv7s89dv
or as78sdv78sfdv67sdv5dc8sdv09sv
The test environment requires the following enironment variables to be set in the Portainer stack.
This environment variable is used to set the database system administrator password.
Example values: 78sb6g654b56sdv7s89dv
or as78sdv78sfdv67sdv5dc8sdv09sv
This environment variable is used to set which database should be created.
Example values: app
or test
This environment variable is used to set the database user for the app database.
Example values: app
or user
This environment variable is used to set the database password for the app database.
Example values: 78sb6g654b56sdv7s89dv
or as78sdv78sfdv67sdv5dc8sdv09sv
This environment variable is used to set the key used for signing the JWT token used for user authorization. NOTE: this must be a string that is at least 128 bit.
Example values: YzhSGXWIWqjDvSlUbDUWC6jlPGy9vdlPPHnDHI63v50wcN4l1k4BreFaw6pC5BgUlBzyxvhBhpokNrg9lfmjt2V7geo9CniLV2bu
or pl0vyh6y3tDvHHCBcfj6knlhN9lW9FjDGUGxgLNeqz2XbU7rpdVleDIWuSa2hmYvwBglir4Bvzk5VogbPwl46U5InSWPP1BCo9jC
This environment variable is used to set the email account username which is used for sending e-mails for account confirmation in the management dashboard.
Example values: test@test.nl
or hello@carboncasecalculator.example
This environment variable is used to set the email account password which is used for sending e-mails for account confirmation in the management dashboard.
Example values: 78sb6g654b56sdv7s89dv
or as78sdv78sfdv67sdv5dc8sdv09sv
This environment variable is used to set the email account display name which is used for sending e-mails for account confirmation in the management dashboard.
Example values: Energietransitie Windesheim
or Carbon Case Calculator
This environment variable is used to set the client id for GitHub authorization.
Example values: 78sb6g654b56sdv7s89dv
or as78sdv78sfdv67sdv5dc8sdv09sv
This environment variable is used to set the client secret for GitHub authorization.
Example values: 78sb6g654b56sdv7s89dv
or as78sdv78sfdv67sdv5dc8sdv09sv
This environment vraiable is used to set the client id for Microsoft authorization.
Example values: 78sb6g654b56sdv7s89dv
or as78sdv78sfdv67sdv5dc8sdv09sv
This environment variable is used to set the client secret for Microsoft authorization.
Example values: 78sb6g654b56sdv7s89dv
or as78sdv78sfdv67sdv5dc8sdv09sv
This environment variable is used to set the HTTP API token for watchtower webhook to update the test images.
Example values: nb4!6&JtB!j82j$tzYb%#kH1
or l2D@K7zOAjpCMn#I54b^%uv#
When a docker-compose.yml
for a stack is changed, the new configuration will be updated automatically. This can take up to 10 minutes.
If you wish to update a stack manually (when you want to change environment variables), you can do so by following the steps below:
- Go to
Stacks
in portainer. - Click on the stack you want to update.
- You can change environment here.
- Click on
Save settings
to save the environment variables. - Click on
Pull and redeploy
to update the container(s) with the new configuration. - A pop-up will open. Click on
Update
to confirm. - The stack will update. Wait for the notification to know that the stack was updated successfully.
List of features ready and TODOs for future development. Ready:
- Partial docker-compose configuration.
To-do:
- Finalize docker-compose configuration.
- Ratelimiting where necessary.
Project is: in progress
Current version is subject to change.
This software is available under the Apache 2.0 license, Copyright 2022 Research group Energy Transition, Windesheim University of Applied Sciences
This configuration repository was originally created by:
- Nick van Ravenzwaaij · @n-vr
Product owner:
- Henri ter Hofte · @henriterhofte · Twitter @HeNRGi
We use and gratefully acknowlegde the efforts of the makers of the following technologies:
- WordPress, licensed under GPLv2 (or later)
- MariaDB, licensed under GNU GPL-2.0
- carboncase-frontend, licensed under Apache-2.0
- carboncase-management, licensed under Apache-2.0
- carboncase-api, licensed under Apache-2.0