Skip to content

Commit 7f85cc5

Browse files
chore: improve dynamic file handling, cicd, etc
1 parent ab45b9d commit 7f85cc5

19 files changed

+561
-364
lines changed

.github/workflows/deploy-vm-qa.yml

-155
This file was deleted.

.github/workflows/deploy-vm-prod.yml renamed to .github/workflows/deploy-vm.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
# Publish `prd` as Docker `latest` image.
66
branches:
7-
- vm-deploy-prod
7+
- vm-deploy
88

99
# Publish `v1.2.3` tags as releases.
1010
tags:
@@ -117,9 +117,9 @@ jobs:
117117
needs: push-image-to-registry
118118
runs-on: ubuntu-latest
119119
steps:
120-
- uses: actions/checkout@vm-deploy-prod
120+
- uses: actions/checkout@vm-deploy
121121
- name: copy docker-compose.yml
122-
uses: appleboy/scp-action@vm-deploy-prod
122+
uses: appleboy/scp-action@vm-deploy
123123
with:
124124
host: ${{ secrets.HOST }}
125125
username: ${{ secrets.USERNAME }}
@@ -129,7 +129,7 @@ jobs:
129129
target: "image"
130130

131131
- name: execute docker-compose
132-
uses: appleboy/ssh-action@vm-deploy-prod
132+
uses: appleboy/ssh-action@vm-deploy
133133
env:
134134
SECRET_KEY: ${{ secrets.SECRET_KEY }}
135135
CDN_NAME: ${{ secrets.CDN_NAME }}

README.md

+33-60
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,13 @@ It is ideal if you want to bootstrap a blog or a portfolio website quickly, or e
1818
- [Running the project](#running-the-project)
1919
- [Application architecture](#application-architecture)
2020
- [Features](#features)
21-
- [Frontend](#frontend)
22-
- [Backend](#backend)
23-
- [Integrations](#integrations)
2421
- [Infrastructure \& deployment](#infrastructure--deployment)
2522
- [Virtualized Deploy Workflow](#virtualized-deploy-workflow)
2623
- [Bare-metal Deploy Workflow](#bare-metal-deploy-workflow)
2724
- [Configuration](#configuration)
2825
- [Global](#global)
2926
- [Exclusively used in production](#exclusively-used-in-production)
30-
- [Frontend](#frontend-1)
31-
- [Exclusively used in production](#exclusively-used-in-production-1)
27+
- [Frontend](#frontend)
3228

3329
## Getting started
3430

@@ -92,26 +88,14 @@ flowchart TD
9288

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

95-
### Frontend
96-
97-
Stack:
98-
- React 18
99-
- React Router 6
100-
- Typescript 5
101-
- Webpack 5
102-
- Tailwind CSS 3
103-
104-
### Backend
105-
106-
Stack:
107-
- Django 5
108-
- Django Rest Framework
109-
- Postgres
110-
111-
### Integrations
112-
113-
- [Sentry](https://sentry.io/welcome/)
114-
- [Cloudinary](https://cloudinary.com/)
91+
| Stack | Features |
92+
| ---------- | ----------------------------------------------------------------- |
93+
| Frontend | React 18, React Router 6, Typescript 5, Webpack 5, Tailwind CSS 3 |
94+
| Backend | Django 5, Django Rest Framework |
95+
| Database | Postgres |
96+
| CDN | Cloudinary |
97+
| CI/CD | GitHub Actions |
98+
| Monitoring | Sentry |
11599

116100
## Infrastructure & deployment
117101

@@ -121,7 +105,7 @@ This codebase has two deploy methods available via GitHub actions:
121105

122106
### Virtualized Deploy Workflow
123107

124-
The `vm-deploy-qa` and `vm-deploy-prod` branches will trigger this wokflow. You can use it to deploy the app to any Virtual Machine accessible via SSH (AWS EC2s, GCloud apps, Digital Ocean droplets, Hostgator VPSs, etc), and you would likely want to change the name of these branches to something more meaningful to your project.
108+
The `vm-deploy` branch will trigger this wokflow. You can use it to deploy the app to any Virtual Machine accessible via SSH (AWS EC2s, GCloud apps, Digital Ocean droplets, Hostgator VPSs, etc), and you would likely want to change the name of these branches to something more meaningful to your project.
125109

126110
### Bare-metal Deploy Workflow
127111

@@ -133,35 +117,32 @@ You should configure these variables on a `.env` file on the root folder for the
133117

134118
### Global
135119

136-
| Environment variable | Default | Description |
137-
| -------------------- | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
138-
| SECRET_KEY | w%h-ok)&7l2e@1&ht!#ol3!!qg9zwz9hs\$wf@fk4e0-7x1r\*#d | 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())'` |
139-
| CDN_NAME | - | Cloudinary's CDN name |
140-
| CDN_API_KEY | - | Cloudinary's CDN API key |
141-
| CDN_API_SECRET | - | Cloudinary's CDN API secret |
142-
| DB_HOST | - | Database host name |
143-
| DB_NAME | - | Database name |
144-
| DB_USER | - | Database user |
145-
| DB_PASSWORD | - | Database password |
146-
| DB_PORT | - | Databse port |
147-
| SMTP_HOST_USER | | Your SMTP email (should be a GMail one) |
148-
| SMTP_HOST_PASSWORD | - | Your SMTP email password |
149-
| TEST | 0 | Used to test the app on the pipeline |
120+
| Environment variable | Default | Description |
121+
| -------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
122+
| 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())'` |
123+
| CDN_NAME | - | Cloudinary's CDN name |
124+
| CDN_API_KEY | - | Cloudinary's CDN API key |
125+
| CDN_API_SECRET | - | Cloudinary's CDN API secret |
126+
| DB_HOST | - | Database host name |
127+
| DB_NAME | - | Database name |
128+
| DB_USER | - | Database user |
129+
| DB_PASSWORD | - | Database password |
130+
| DB_PORT | - | Databse port |
131+
| SMTP_HOST_USER | | Your SMTP email |
132+
| SMTP_HOST_PASSWORD | - | Your SMTP email password |
133+
| TEST | 0 | Used to test the app on CI/CD |
150134

151135
#### Exclusively used in production
152136

153-
| Environment variable | Must be |
154-
| -------------------- | ---------------------------------------------------------------------------------------------------- |
155-
| IMAGE_NAME | Docker image name (for HML, it will append `-hml` on its name) |
156-
| MODE | `production`. This is hardcoded on the [Dockerfile](./Dockerfile) |
157-
| ALLOWED_HOSTS | A set of hosts allowed to pass CORS policy. I.g: "www.example.com" "example.com" |
158-
| HML_ALLOWED_HOSTS | Same as ALLOWED_HOSTS but for a HML environment |
159-
| DEPLOY_TOKEN | A Github token with permission to pull this project's image from your Github registry |
160-
| HML_DEPLOY_TOKEN | Same as DEPLOY_TOKEN but for a HML environment |
161-
| HOST | The domain under which your site will be hosted (i.g.:example.com) |
162-
| HML_HOST | Same of HOST but for a HML environment (i.g.: hml.example.com) |
163-
| SSH_PRIVATE_KEY | The SSH key used to access the host machine (currently, one for both PROD and HML environments) |
164-
| USERNAME | The SSH username used to access the host machine (currently, one for both PROD and HML environments) |
137+
| Environment variable | Description |
138+
| -------------------- | ------------------------------------------------------------------------------------- |
139+
| IMAGE_NAME | Docker image name |
140+
| MODE | `production`. This is hardcoded on the [Dockerfile](./Dockerfile) |
141+
| ALLOWED_HOSTS | A set of hosts allowed to pass CORS policy. I.g: "www.example.com" "example.com" |
142+
| DEPLOY_TOKEN | A Github token with permission to pull this project's image from your Github registry |
143+
| HOST | The domain under which your site will be hosted (i.g.:example.com) |
144+
| SSH_PRIVATE_KEY | The SSH key used to access the host machine |
145+
| USERNAME | The SSH username used to access the host machine |
165146

166147
### Frontend
167148

@@ -170,11 +151,3 @@ You should configure these variables on a `.env` file on the root folder for the
170151
| 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) |
171152
| 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) |
172153
| |
173-
174-
#### Exclusively used in production
175-
176-
| Environment variable | Must be |
177-
| -------------------- | ------------------------------------------ |
178-
| HML_AUTH_KEY | Same as AUTH_KEY but for a HML environment |
179-
| HML_GTAG_ID | Same as GTAG_ID but for a HML environment |
180-

0 commit comments

Comments
 (0)