@@ -88,15 +88,57 @@ Everytime a code change is pushed to the git repository on any branch, it trigge
88
88
- run a flake8 check
89
89
- run a set of unittests
90
90
91
- Changes to the master branch also trigger a containerization job that will:
92
- - Build a docker image of that application inside a container
93
- - Push that image to the dockerhub repository
91
+ Only changes to the master branch will additionally trigger:
92
+ - A containerization job that will:
93
+ - Only execute after the test job was successful!
94
+ - Build a docker image of that application inside a container
95
+ - Push that image to the dockerhub repository
96
+
97
+ - A Deployment job that will:
98
+ - Only execute after the containerization was a success!
99
+ - Push and deploy that docker image to heroku.
100
+
101
+ ### Required configuration
102
+
103
+ #### SECRET_KEY
104
+
105
+ The Django secret key is used to provide cryptographic signing.
106
+ This key is mostly used to sign session cookies. If one were to have this key,
107
+ they would be able to modify the cookies sent by the application.
108
+
109
+ Generate secret key for the application:
110
+ - You can visit https://djecrety.ir/ to generate a secret key.
111
+ - Or use the get_random_secret_key() function present in django.core.management.utils:
112
+ - to do that run: ` python manage.py shell ` or and enter the following lines:
113
+ ```
114
+ from django.core.management.utils import get_random_secret_key
115
+ print(get_random_secret_key())
116
+ ```
117
+
118
+ #### Accounts for the following platforms:
119
+
120
+ 1. A Github account with a repo in which this application was cloned to.
121
+
122
+ 2. A Docker account, to push the container image to.
123
+
124
+ 3. A Heroku account for deployment.
125
+
126
+ 4. A Sentry account to log uncaught errors and crashes of the application.
127
+
128
+ 5. A Circleci account to that connects to the git repo of this project:
129
+ - Inside your project go to: `Project Settings` > `Environment Variables`
130
+ - click on `Add Environment Variable`
131
+ - add the following Name | Value pairs to your environment:
132
+ - SECRET_KEY | -your generated secret key-
133
+ - DOCKER_LOGIN | -your docker profile name-
134
+ - DOCKER_PASSWORD | -your docker password-
135
+ - DOCKER_REPO | -your docker repository name-
136
+ - HEROKU_API_KEY | -your heroku api key-
137
+ - HEROKU_APP_NAME | -your heroku app name-
94
138
95
- As well as a Deployment job that will:
96
- -
97
139
98
140
<details>
99
- <summary ><b >Deploy directly to Heroku on one click</b ></summary ><br >
141
+ <summary><b>To test the application you can Deploy it to Heroku on one click</b></summary><br>
100
142
The fastest way to deploy and test the application on Heroku is by clicking the following link:<br>
101
143
102
144
[](https://heroku.com/deploy?template=https://github.com/Pascal273/Python-OC-Lettings)
0 commit comments