From bee2cf2f24956abf874c1edfe80bc60fe99d8ca0 Mon Sep 17 00:00:00 2001
From: Haakon Gunleiksrud <haakogun@stud.ntnu.no>
Date: Fri, 5 Nov 2021 15:49:26 +0000
Subject: [PATCH] Devops/setup live demo

---
 .gitlab-ci.yml   |   2 +-
 README.md        |  43 ++++++++++++++++++++++---------------------
 requirements.txt | Bin 563 -> 1192 bytes
 3 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cf98e36..fa56d82 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -22,4 +22,4 @@ staging:
     - dpl --provider=heroku --app=secfit-frontend-v22 --api-key=$HEROKU_STAGING_API_KEY
     - dpl --provider=heroku --app=secfit-backend-v22 --api-key=$HEROKU_STAGING_API_KEY
   only:
-    - master
+    - master
\ No newline at end of file
diff --git a/README.md b/README.md
index 0a0204a..911512b 100644
--- a/README.md
+++ b/README.md
@@ -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.
 `- dpl --provider=heroku --app=<Your-herokuproject-name> --api-key=$HEROKU_STAGING_API_KEY`
-5. Set varibles at GitLab
-   * settings > ci > Environment Variables
-   * `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`)
    * `BACKEND_HOST` = `https://<SECFIT_BACKEND>.herokuapp.com`
    * `PROCFILE` = `frontend/Procfile`
 9. Push the repository to both of the heroku applications 
@@ -156,19 +162,14 @@ Continuous integration will build the code pushed to master and push it to your
       * Make sure you install the heroku CLI https://devcenter.heroku.com/articles/heroku-cli
       * Make sure you log in to the heroku CLI ($ heroku login)
       * Make sure you create a remote for the frontend and backend apps (Example: heroku git:remote -a secfit-group01-v22-frontend)
-      * Push your code to both apps ($ git push https://git.heroku.com/<YOUR-HEROKU-APP>.git)
+      * Push your code to both apps (Your URLs can also be found on the settings page on your Heroku apps)	
          * Example: $ git push https://git.heroku.com/secfit-group01-v22-frontend.git master
          * 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>`
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index 2ccb8e1c4fd58cb5f59f015b7d7d2ab863036b27..9feb375bde1e8fb7befe6c102dd29beeee7c6940 100644
GIT binary patch
literal 1192
zcmZ{kF;l`&5QMLG#-9?0AZlf2Wo6-vb%+ST05OC?{PF6y@3<rujuVyK-rnxMd;EMC
zwzs8K*4o0}?4F-%yRs=yZWFt-3lpNFz614|5US1+O7)V?7DPpVb*@ifn1HxVDCa3{
z1y>8l0(49gYL@1dOsIKUP#Yd0yn2NuO?tJpW&AGaFKo`UhbyxKJ#~-2fzc;EfG=!|
zzg<5s@0p^K;h=^`pAXg~q;mw1=8n<QxM%Jvb;*xDha)B9^T&P4S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