The application has a feature to fetch user details and an authorization token from Github. This requires settings up a Github application and configuring it correctly. The procedure is as follows:
- Navigate to your personal or organization settings and find the
developer settingsto register a new application.
- Fill in the details. The
callback urlis the most important part here and we set it tohttp://135.181.89.96:4000/auth/github/callbackbecause our application is running athttp://135.181.89.96:4000/
- Once you create the application, you are redirected to the configuration page. Here you need to create a client secret and also copy your client id.
- Now you're done. You can also access the settings after creation by navigating to
Installed Github apps
- The application has environment values
GH_CLIENT_ID,GH_CLIENT_SECRET&GH_CB_URL. These are the client id, client secret and callback url from your newly created app. The backend documentation has more information regarding the environment values required.
- Follow the instructions in frontend documentation and backend documentation to start the services individually
- Remember to also setup a
postgresqldatabase and configure the backend'sDATABASE_URLaccordingly
- Setup the correct backend environment values as described in backend documentation
- Run
yarnin both/frontend&/backendfolders - Run
sudo docker-compose build - Run
sudo docker-compose up- Sometimes the backend fails to start during the first run due to
postgresqlnot starting fully before migrations run. Restarting this a couple of times has always fixed the issue.
- Sometimes the backend fails to start during the first run due to
- The application should be viewable in
localhost:3000and the graphlql playground atlocalhost:3001/graphql- Hot-reload is configured and the application uses your local
node_modules
- Hot-reload is configured and the application uses your local
- Running
sudo docker-compose down --volumesshuts down the application and clears the database
The production version is ran with the Dockerfile found in the root of this repository. The easiest way to use it with our docker-compose.server.yml, also found in the root. The docker-compose.server.yml has placeholders for all the environment values required. It also has docker/watchtower configuration in place. This is not vital if you do not wish to use it for automatic updating of the image from dockerhub.
- Fill the environment values in
docker-compose.server.ymlas described in backend documentation - Fill in the desired ports
- Change the
image: ''placeholder toimage: ohtuprojekti/wevc:application-production. This pulls the production tag from our dockerhub. Github actions builds and pushes this image when themasterbranch is updated. - Run
sudo docker-compose -f docker-compose.server.yml upto start the application to the port you configured- Sometimes the application fails to start during the first run due to
postgresqlnot starting fully before migrations run. Restarting this a couple of times has always fixed the issue.
- Sometimes the application fails to start during the first run due to
- Running
sudo docker-compose -f docker-compose.server.yml down --volumesshuts down the application and clears the database
- Fill the environment values in
docker-compose.server.ymlas described in backend documentation - Fill in the desired ports
- Change the
image: ''tobuild: . - Run
sudo docker-compose -f docker-compose.server.yml buildto build theDockerfile - Run
sudo docker-compose -f docker-compose.server.yml upto start the application to the port you configured- Sometimes the application fails to start during the first run due to
postgresqlnot starting fully before migrations run. Restarting this a couple of times has always fixed the issue.
- Sometimes the application fails to start during the first run due to
- Running
sudo docker-compose -f docker-compose.server.yml down --volumesshuts down the application and clears the database
CI/CD is handled with GitHub Actions. Our GitHub Actions workflow configurations can be found here. Our deployment configuration is described better in summary document.
