Skip to content

Commit 5bb5e7b

Browse files
docs: update config files and architecture diagram
1 parent 1285997 commit 5bb5e7b

File tree

1 file changed

+57
-36
lines changed

1 file changed

+57
-36
lines changed

README.md

Lines changed: 57 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@ This template is ideal if you want to bootstrap a blog or a portfolio website qu
1616
- [Setting up a CDN](#setting-up-a-cdn)
1717
- [Running the project](#running-the-project)
1818
- [Application architecture](#application-architecture)
19-
- [Features](#features)
20-
- [Infrastructure \& deployment](#infrastructure--deployment)
19+
- [Features](#features)
20+
- [Going to production: infrastructure \& deployment](#going-to-production-infrastructure--deployment)
2121
- [Virtualized Deploy Workflow](#virtualized-deploy-workflow)
2222
- [Bare-metal Deploy Workflow](#bare-metal-deploy-workflow)
23-
- [Configuration](#configuration)
24-
- [Global](#global)
25-
- [Exclusively used in production](#exclusively-used-in-production)
26-
- [Frontend](#frontend)
23+
- [Configuration](#configuration)
24+
- [Architecture overview](#architecture-overview)
2725

2826
## Getting started
2927

@@ -85,7 +83,7 @@ flowchart TD
8583
n0 -- Consumes API Key\nto authenticate\nwith backend --> ng
8684
```
8785

88-
## Features
86+
### Features
8987

9088
Below you will find the stack used for each part of the application and the features that are already implemented.
9189

@@ -98,11 +96,11 @@ Below you will find the stack used for each part of the application and the feat
9896
| CI/CD | GitHub Actions | Multiple deploy workflow options |
9997
| Monitoring | Sentry | - |
10098

101-
## Infrastructure & deployment
99+
## Going to production: infrastructure & deployment
102100

103-
Although this project provides some guidelines on how to deploy the app, it is not mandatory to follow them. You can deploy the app on any platform you want, as long as it supports Docker and Docker Compose, or even deploy the app on a bare-metal machine.
101+
Although this project provides some guidelines on how to deploy the app, it is not mandatory to follow them. You can deploy the app on any platform you want, as long as it supports Docker and Docker Compose, or even deploy the app on a bare-metal machine. **By the end of the day, you should use the provided GitHub Actions workflows as a reference to build your own deployment pipeline and meet your requirements**.
104102

105-
This codebase has two deploy methods available via GitHub actions:
103+
Nonetheless, this codebase has two deploy methods available via GitHub actions:
106104

107105
### Virtualized Deploy Workflow
108106

@@ -112,28 +110,11 @@ The `vm-deploy` branch will trigger this wokflow. You can use it to deploy the a
112110

113111
The `bare-metal-deploy` branches will trigger this workflow. You can use it to deploy the app straight on the host machine, without any virtualization. This is not recommended, but ou never know when you will need to deploy an app on a bare-metal machine 🤷‍♀️
114112

115-
## Configuration
116-
117113
You should configure these variables on a `.env` file on the root folder for the global configuration and a `.env` file for the frontend configuration under `frontend/.env` when developing. As for deploying the app, **you will need to set the same set of dev variables + some variables exclusively used in production environments as [_secrets_](https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets)**.
118114

119-
### Global
120-
121-
| Environment variable | Default | Description |
122-
| -------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
123-
| SECRET_KEY | - | Django's SECRET_KEY used to encrypt passwords. It can be generated by running: `python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'` |
124-
| CDN_NAME | - | Cloudinary's CDN name |
125-
| CDN_API_KEY | - | Cloudinary's CDN API key |
126-
| CDN_API_SECRET | - | Cloudinary's CDN API secret |
127-
| DB_HOST | - | Database host name |
128-
| DB_NAME | - | Database name |
129-
| DB_USER | - | Database user |
130-
| DB_PASSWORD | - | Database password |
131-
| DB_PORT | - | Databse port |
132-
| SMTP_HOST_USER | | Your SMTP email |
133-
| SMTP_HOST_PASSWORD | - | Your SMTP email password |
134-
| TEST | 0 | Used to test the app on CI/CD |
135-
136-
#### Exclusively used in production
115+
### Configuration
116+
117+
You must be familiar with the expected environment variables to run the project. Here is a list of the environment variables you must set alongside the ones you already know ([`.env.example`](./.env.example) from root, [`.env.example`](./frontend/.env.example) from frontend) production environments and must be set as secrets on your GitHub repository and made available to GitHub Actions.
137118

138119
| Environment variable | Description |
139120
| -------------------- | ------------------------------------------------------------------------------------- |
@@ -143,11 +124,51 @@ You should configure these variables on a `.env` file on the root folder for the
143124
| DEPLOY_TOKEN | A Github token with permission to pull this project's image from your Github registry |
144125
| HOST | The domain under which your site will be hosted (i.g.:example.com) |
145126
| SSH_PRIVATE_KEY | The SSH key used to access the host machine |
146-
| USERNAME | The SSH username used to access the host machine |
127+
| USERNAME | The SSH username used to access the host machine | |
128+
129+
### Architecture overview
147130

148-
### Frontend
131+
Building up on the [application architecture diagram](#application-architecture), here is a more detailed overview of how the application is structured on a production environment:
149132

150-
| Environment variable | Default | Description |
151-
| -------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
152-
| NODE_ENV | `development` | Let's Webpack know when to build files to correct public path, optimize code and when to prepend localhost for API endpoints or not. Values must be either `development` or `production`. This is hardcoded on the [Dockerfile](./Dockerfile) |
153-
| AUTH_TOKEN | - | An auth key generated on Django's admin that must be associated to a user with specific permissions (i.g.: read specific infos from Django's ORM) |
133+
```mermaid
134+
flowchart TD
135+
subgraph subgraph_byfiey99u["Gunicorn"]
136+
ny("React")
137+
n9("Env. variables")
138+
ns("Frontend")
139+
nt("Django")
140+
ni("Django Rest Framework")
141+
nl("Backend")
142+
n5("Views")
143+
nb("Templates")
144+
na("Models")
145+
n0("API Client")
146+
n4("Root Container")
147+
nn("API Key")
148+
nd("Publications")
149+
ng("REST API")
150+
react_assets("Static assets\n(React included)")
151+
end
152+
subgraph subgraph_3hmsyzvqm["Docker Image/Host"]
153+
subgraph_byfiey99u
154+
nginx("NGINX")
155+
pg("Postgres")
156+
end
157+
ns --> ny & n9
158+
nl --> nt & ni
159+
nt --> n5 & nb & na & subgraph_3hmsyzvqm
160+
nt -- Stores media\nfiles on --> nk("CDN\n(Cloudinary)")
161+
n5 --> nb
162+
ny --> n0 & n4
163+
na --> nn & nd
164+
n4 -- Mounts on same file from\nDjango templates --> nb
165+
n9 -.-> nn & n0
166+
ni -- Provides a REST\nendpoint to manipulate\ndata from models --> ng
167+
ng --> nd
168+
n0 -- Consumes API Key\nto authenticate\nwith backend --> ng
169+
nt -- Serves --> react_assets
170+
nginx -- Serves --> subgraph_byfiey99u
171+
nt -- Stores\ndata\non --> pg
172+
style subgraph_byfiey99u stroke:#000000
173+
style subgraph_3hmsyzvqm stroke:#000000
174+
```

0 commit comments

Comments
 (0)