@@ -8,6 +8,8 @@ SecFit (Secure Fitness) is a hybrid mobile application for fitness logging.
Docker
Python 3.8.10
Git
Windows hosts must use Education or more advanced versions to run Docker \
...
...
@@ -137,18 +139,22 @@ Continuous integration will build the code pushed to master and push it to your
3. Select buildpacks for the two apps. The backend uses Python while the frontend uses nodejs.
* Heroku > Settings > Buildpacks > Add buildpack
* Both applications need the buildpack https://github.com/heroku/heroku-buildpack-multi-procfile.git too.
3. Set the project in the .gitlab-cs.yml file by replacing `<Your-herokuproject-name>` with the name of the Heroku app you created
4. Set the two projects in the .gitlab-cs.yml file by replacing `<Your-herokuproject-name>` with the name of the Heroku apps you created. Commit and push your change.
*`HEROKU_STAGING_API_KEY` = heroku > Account Settings > API Key
5. Set/Add varibles at GitLab
* GitLab > settings > ci > Variables > Expand
* Key = `HEROKU_STAGING_API_KEY`
* Value = Your API Key from Heroku (Heroku > Account Settings > API Key > Reveal)
* Type = Variable, Environment scope = All(default)
* Protect should not be enabled and Mask should be enabled
6. Add heroku database for the backend
* Resources > Add ons > search for postgres > add "Heroku Postgres"
7. Set variables for the backend on Heroku. Settings > Config vars > Reveal vars
*`DATABASE_URL` = Should be set by default. If not here is where you can find it: Resources > postgress > settings > view credentials > URI
* Heroku > Resources > Add ons > search for `postgres` > add "Heroku Postgres"
* Choose the free plan.
7. Set variables for the backend on Heroku. Heroku > Settings > Config vars > Reveal vars
*`DATABASE_URL` = Should be set by default. If not here is where you can find it: Heroku > Resources > postgress > settings > view credentials > URI
*`IS_HEROKU` = `IS_HEROKU`
*`PROCFILE` = `backend/secfit/Procfile`
8. Set variables for the frontend on heroku. Settings > Config vars > Reveal vars. Insert the URL for your backend app.
*`PROCFILE` = `Procfile`
8. Set variables for the frontend on heroku. Heroku > Settings > Config vars > Reveal vars. Insert the URL for your backend app and the path to your Procfile. (Example: `https://secfit-group01-v22-backend.herokuapp.com`)
* Make sure you use `master` and not `main` as your target branch
10. Setup a dyno for you backend
11. On GitLab go to CI / CD in the repository menu and select `Run Pipeline` if it has not already started. When both stages complete the app should be available on heroku. The log should state that the app was deployed.
12. Setup the applications database.
* Log in to the Heroku CLI by entering `heroku login` if you have not alreaddy done this. This opens a webbrowser and you accept the login request.
10. On GitLab go to CI / CD in the repository menu and select `Run Pipeline` if it has not already started. When both stages complete the app should be available on heroku. The log should state that the app was deployed.
11. Setup the applications database.
* Log in to the Heroku CLI by entering `heroku login` if you have not already done this. This opens a webbrowser and you accept the login request.
* Migrate database by entering
`heroku run python backend/secfit/manage.py migrate -a <heroku-app-name>`. `Heroku run` will run the folowing command on your heroku instance. Remember to replace `<heroku-app-name>` with your app name
* and create an admin account by running
`heroku run python backend/secfit/manage.py migrate -a <heroku-app-name>`. `Heroku run` will run the folowing command on your heroku instance. Remember to replace `<heroku-app-name>` with your backend app name
* and create an admin account for the backend by running
`heroku run python backend/secfit/manage.py createsuperuser -a <heroku-app-name>`.
* seed database `heroku run python backend/secfit/manage.py loaddata seed.json -a <heroku-app-name>`
12. On the frontend app, add a config variable for `BACKEND_HOST` = `BACKEND_HOST`
You will also need the heroku multi-procfile buildpack: https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-multi-procfile.
In general, for this application to work (beyond locally), you will need to set the BACKEND_HOST to the URL of the REST API backend.
* seed database `heroku run python backend/secfit/manage.py loaddata backend/secfit/seed.json -a <heroku-app-name>`