You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+43-7Lines changed: 43 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,15 @@
1
1
# DevOps Apprenticeship: Project Exercise
2
2
3
-
> If you are using GitPod for the project exercise (i.e. you cannot use your local machine) then you'll want to launch a VM using the [following link](https://gitpod.io/#https://github.com/CorndelWithSoftwire/DevOps-Course-Starter). Note this VM comes pre-setup with Python & Poetry pre-installed.
3
+
> If you are using GitPod for the project exercise (i.e. you cannot use your local machine) then you'll want to launch a
4
+
> VM using the [following link](https://gitpod.io/#https://github.com/CorndelWithSoftwire/DevOps-Course-Starter).
5
+
> Note this VM comes pre-setup with Python & Poetry pre-installed.
4
6
5
7
## System Requirements
6
8
7
-
The project uses poetry for Python to create an isolated environment and manage package dependencies. To prepare your system, ensure you have an official distribution of Python version 3.8+ and install Poetry using one of the following commands (as instructed by the [poetry documentation](https://python-poetry.org/docs/#system-requirements)):
9
+
The project uses poetry for Python to create an isolated environment and manage package dependencies.
10
+
To prepare your system, ensure you have an official distribution of Python version 3.8+
11
+
and install Poetry using one of the following commands
12
+
(as instructed by the [poetry documentation](https://python-poetry.org/docs/#system-requirements)):
You can check poetry is installed by running `poetry --version` from a terminal.
22
27
23
-
**Please note that after installing poetry you may need to restart VSCode and any terminals you are running before poetry will be recognised.**
28
+
**Please note that after installing poetry you may need to restart VSCode and any terminals you are running before
29
+
poetry will be recognised.**
24
30
25
31
## Dependencies
26
32
27
-
The project uses a virtual environment to isolate package dependencies. To create the virtual environment and install required packages, run the following from your preferred shell:
33
+
The project uses a virtual environment to isolate package dependencies.
34
+
To create the virtual environment and install required packages, run the following from your preferred shell:
28
35
29
36
```bash
30
37
$ poetry install
31
38
```
32
39
33
-
You'll also need to clone a new `.env` file from the `.env.template` to store local configuration options. This is a one-time operation on first setup:
40
+
You'll also need to clone a new `.env` file from the `.env.template` to store local configuration options.
41
+
This is a one-time operation on first setup:
34
42
35
43
```bash
36
44
$ cp .env.template .env # (first time only)
37
45
```
38
46
39
-
The `.env` file is used by flask to set environment variables when running `flask run`. This enables things like development mode (which also enables features like hot reloading when you make a file change).
47
+
The `.env` file is used by flask to set environment variables when running `flask run`.
48
+
This enables things like development mode (which also enables features like hot reloading when you make a file change).
40
49
41
50
### Trello
42
51
@@ -46,7 +55,8 @@ Replace the board and list ids with the respective ids from your Trello board.
46
55
47
56
## Running the App
48
57
49
-
Once the all dependencies have been installed, start the Flask app in development mode within the Poetry environment by running:
58
+
Once all the dependencies have been installed, start the Flask app in development mode within the Poetry environment by
59
+
running:
50
60
51
61
```bash
52
62
$ poetry run flask run
@@ -104,6 +114,7 @@ then enter the value you want to encrypt when prompted.
104
114
## Docker
105
115
106
116
Run the project with mounting:
117
+
107
118
```bash
108
119
docker build --target development --tag todo-app:dev .
109
120
docker run -dit \
@@ -115,6 +126,7 @@ docker run -dit \
115
126
```
116
127
117
128
Run tests:
129
+
118
130
```bash
119
131
docker build --target test --tag todo-app:test .
120
132
docker run -it \
@@ -123,6 +135,7 @@ docker run -it \
123
135
```
124
136
125
137
Run the project in production environment:
138
+
126
139
```bash
127
140
docker build --target production --tag todo-app:prod .
128
141
docker run -dit \
@@ -131,3 +144,26 @@ docker run -dit \
131
144
--env-file .env \
132
145
todo-app:prod
133
146
```
147
+
148
+
## Deployment
149
+
150
+
### Building the Docker image
151
+
152
+
1. Logging into DockerHub locally, with `docker login`
153
+
2. Building the image, with `docker build --target production --tag <user_name>/todo-app:prod .`
154
+
3. Pushing the image, with `docker push <user_name>/todo_app:prod`
0 commit comments