Skip to content

Commit 0c6e111

Browse files
committed
docs(refresh): refresh docs
1 parent 09da585 commit 0c6e111

File tree

13 files changed

+148
-792
lines changed

13 files changed

+148
-792
lines changed

vuepress-docs/docs/.vuepress/configs/navbar/en.ts

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,18 @@ export const en: NavbarConfig = [
99
text: 'Topics',
1010
link: '/topics',
1111
children: [
12-
{
13-
text: 'Twelve-Factor App',
14-
link: '/topics/twelve-factor-app',
15-
},
1612
{
1713
text: 'Django Application',
1814
link: '/topics/django/',
1915
},
2016
{
21-
text: 'Quasar Application',
22-
link: '/topics/quasar/',
17+
text: 'Nuxt Application',
18+
link: '/topics/nuxt/',
2319
},
2420
{
2521
text: 'Docker Compose',
2622
link: '/topics/docker-compose/',
2723
},
28-
{
29-
text: 'Authentication',
30-
link: '/topics/jwt-authentication/',
31-
},
3224
{
3325
text: 'VuePress Documentation',
3426
link: '/topics/vuepress/',
@@ -56,27 +48,36 @@ export const en: NavbarConfig = [
5648
},
5749
{
5850
text: 'Deploy',
59-
link: '/deploy/',
51+
// link: '/deploy/',
6052
children: [
6153
{
62-
text: 'Overview',
63-
link: '/deploy/aws/',
54+
link: '/deploy/aws',
55+
text: 'AWS ECS',
6456
children: [
65-
{
66-
link: '/deploy/aws/cdk',
67-
text: 'CDK',
68-
ariaLabel: 'CDK',
69-
},
7057
{
7158
link: '/deploy/aws/terraform',
7259
text: 'Terraform'
7360
},
7461
{
7562
link: '/deploy/aws/pulumi',
7663
text: 'Pulumi'
64+
},
65+
{
66+
link: '/deploy/aws/cdk',
67+
text: 'CDK'
7768
}
78-
],
69+
]
7970
},
80-
],
81-
},
71+
{
72+
text: 'Application Updates',
73+
// link: '/deploy/app'
74+
children: [
75+
{
76+
link: '/deploy/app',
77+
text: 'GitHub Action'
78+
}
79+
]
80+
}
81+
]
82+
}
8283
]

vuepress-docs/docs/README.md

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ features:
1212
details: This project covers the full technology stack of modern web applications, from frontend to backend to CI/CD and Infrastructure as Code
1313
- title: Twelve-Factor App
1414
details: This project adheres to the 12Factor App philosophy
15-
- title: Best Practices
16-
details: This project focuses on implementing a simple application with all of the best practices you would see in a healthy, production-ready application
1715
- title: IaC Rosetta Stone
1816
details: This project implements the same application architecture using CDK, Terraform and Pulumi
1917
- title: GitHub Actions
@@ -24,54 +22,19 @@ features:
2422
details: The backend Django app is implemented using Django templates using both functions-based views and class-based views
2523
- title: DRF and GraphQL
2624
details: The Django app also implements an API using both REST with DRF and GraphQL with Graphene
27-
- title: Quasar Framework
28-
details: A frontend client built with TypeScript, Vue.js, and Quasar Framework consumes the DRF REST API
25+
- title: Nuxt.js
26+
details: A SSR frontend client built with TypeScript, Vue.js, and Nuxt.js consumes the DRF REST API
2927
- title: Python and TypeScript
3028
details: Python is used on the backend and TypeScript is used for both the frontend client and infrastructure code
31-
- title: Load testing
32-
details: The project uses k6 for simulating traffic which can run locally or using GitHub Actions
3329
- title: Developer Experience
3430
details: This project aims to have a simple and understandable developer experience
35-
- title: compose and venv
36-
details: Local backend development can be done with both virtual environments and docker compose
3731
- title: Testing and coverage
3832
details: pytest is used for backend tests, and test coverage is measured with pytest-cov
39-
- title: Makefile
40-
details: All commands for local development are documented in the Makefile
4133

4234

43-
footer: MIT Licensed | Copyright © 2023 Brian Caffey
35+
footer: MIT Licensed | Copyright © 2025 Brian Caffey
4436
---
4537

46-
<!-- <div style="text-align: center">
47-
<Bit/>
48-
</div>
49-
50-
<div class="features">
51-
<div class="feature">
52-
<h2>Simplicity First</h2>
53-
<p>Minimal setup with markdown-centered project structure helps you focus on writing.</p>
54-
</div>
55-
<div class="feature">
56-
<h2>Vue-Powered</h2>
57-
<p>Enjoy the dev experience of Vue + webpack, use Vue components in markdown, and develop custom themes with Vue.</p>
58-
</div>
59-
<div class="feature">
60-
<h2>Performant</h2>
61-
<p>VuePress generates pre-rendered static HTML for each page, and runs as an SPA once a page is loaded.</p>
62-
</div>
63-
</div> -->
64-
65-
This documentation covers lots of different topics that are related to various aspects of the project. The project aims to provide two things:
66-
67-
- a working example of a sample web application called μblog.
68-
- in-depth technical guides on how to build each part of the application
69-
70-
At a high level, the documentation can be broken down into the following categories:
71-
72-
- Django application set up
73-
- Local development environment
74-
7538
## How to get help
7639

7740
This project is driven by a community of contributors. If you are having trouble with any part of this application, you can get help in a number of ways:
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
prev: /deploy/aws
3+
4+
head:
5+
- - meta
6+
- name: description
7+
content: How to update the version of the application with GitHub Actions
8+
- - link
9+
- rel: canonical
10+
href: https://briancaffey.github.io/django-step-by-step/deploy/app
11+
---
12+
13+
# Updating the application version
14+
15+
This page describes the process of updating the backend or frontend applications to a new version. The processes for updating the backend Django application and the frontend Nuxt.js application are different, but the logic for updating both of these applications is contained in the same GitHub Action workflow.
16+
17+
## Backend
18+
19+
Updating the backend application is a two-step process.
20+
21+
- Step 1: create a new task definition for the `pre-backend-update` task using the new backend application version (e.g. `v1.2.3`), publish this new task definition and then run the `pre-backend-update` task. This task applies migrations and runs the `collectstatic` command as well as any other Django management commands that are called in the `pre-backend-update` command
22+
23+
::: warning
24+
Database migrations included in the NEW version of code should be backward-compatible with the application code in the OLD version of code.
25+
:::
26+
27+
- Step 2: Create new task definitions for the backend ECS services (`gunicorn` webserver, celery worker and celery beat scheduler)
28+
29+
## Frontend
30+
31+
Updating the frontend requires updating the frontend task definition with the new frontend application version (e.g. `v1.2.3`) and then updating the service with the new task definition.
32+
33+
You can provide an version tag for the backend app, the frontend app or both. The GitHub Actions pipeline will first update the backend and then update the frontend.

vuepress-docs/docs/deploy/aws/README.md

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ prev: /guide/ci-cd/github-actions
55
head:
66
- - meta
77
- name: description
8-
content: Using Terraform for Infrastructure as Code for Django projects
8+
content: Using different Infrastructure as Code tools for deploying Django projects
99
# - - link
1010
# - rel: canonical
1111
# href: https://briancaffey.github.io/
1212
---
1313

1414
# Overview of options for deploying μblog
1515

16-
This project focuses on deploying to AWS using ECS Fargate. GitHub Actions are used for deployment pipelines.
16+
This project primarily focuses on deploying to AWS using ECS Fargate. GitHub Actions are used for deployment pipelines.
1717

1818
## Infrastructure as Code Libraries
1919

2020
There are three options for Infrastructure as Code:
2121

2222
- [`terraform-aws-django`](https://github.com/briancaffey/terraform-aws-django)
23-
- [`cdk-django`](https://github.com/briancaffey/cdk-django)
2423
- [`pulumi-aws-django`](https://github.com/briancaffey/pulumi-aws-django)
24+
- [`cdk-django`](https://github.com/briancaffey/cdk-django)
2525

2626
## Consuming IaC libraries
2727

@@ -40,28 +40,47 @@ Each of these directories includes code that uses the IaC libraries referenced a
4040

4141
Each of these options has corresponding GitHub Actions workflow files.
4242

43-
These workflow files can be found in the `.github/workflows` folder of `django-step-by-step` using the following naming convention:
43+
These workflow files can be found in the `.github/workflows` folder of `django-step-by-step` under the following names:
4444

45-
```
46-
{ad_hoc,prod}_{base,app}_{create_update,destroy}_{cdk,terraform_pulumi}.yml
45+
```yaml
46+
iac_cdk_actions.yml
47+
iac_pulumi_actions.yml
48+
iac_terraform_actions.yml
4749
```
4850

49-
::: warning
50-
Some workflow files may be missing
51-
:::
51+
These three GitHub Actions all work in the same way:
5252

53-
::: warning
54-
At some point these GitHub Actions and associated files in the `iac` directory may be moved to another GitHub repository
55-
:::
53+
- they can be used for deploying either the `base` or `app` infrastructure stack
54+
- they can accept a name for the `base` and `app` stack that must correspond to the "live" configuration files mentioned above
55+
- they can be used to destroy resources for a stack by selecting a `destroy` option
56+
- the plan/preview/diff is added to the summary of each workflow
57+
58+
These workflows can be easily copied or adapted for different needs. For example, if you would like to manually approve the deployment of infrastructure resources after viewing the plan/preview/diff, then you can using GitHub environments for the deploy steps.
5659

5760
::: warning
58-
Some workflow files may be using different patterns. All workflows should be using the `actions/upload-artifact` and `actions/download-artifact` GitHub Actions
61+
Understanding the difference between infrastructure and application CI/CD pipelines is very important! The following sections go into detail about the `app` infrastructure pipeline and the `App Update` pipeline and things to consider when using these pipelines.
5962
:::
6063

64+
## `app` stack
65+
66+
When the `app` stack is deployed, it sets up the ECS cluster, ECS task definitions and ECS services for an `app` environment. Each task definition uses the `latest` tag for the container image (for the backend and frontend services) and uses a `desiredCount` of `0` for each service.
67+
68+
For each of the IaC libraries, the ECS service uses `ignore_changes` for the `task_definition` and `desired_count`, this means that deploying a change to the `app` stack (such as adding a new environment variable to the backend task definitions) will not change anything in the running application. Instead, it publishes a new task definition. This new task definition will be used as the basis for the new task definition created by the `[CD] App Update` workflow.
69+
70+
After you deploy the `app` stack, you need to run the `[CD] App Update` GitHub Action. This will use the most recent version of each task definition and updated the `image` tag to the version specified in the Action's inputs (e.g. `v1.2.3`). Also the desired count for each service will be set to `1` which will start each service. You may want to use different values for the `desiredCount` when deploying your own application.
71+
72+
## `[CD] App Update`
73+
74+
To make regular application updates, you can use the `[CD] App Update` GitHub Action. This Action will first run the `pre-backend-update` job. This job is set up to run migrations, collectstatic and anything else that must be done prior to updating the server code (`gunicorn`, `celery`, `celery-beat` services).
75+
76+
The `pre-backend-update` step will also attempt to create a database using the name of the `app` environment. For example, if you select the `app` name `alpha`, this step will attempt to create an `alpha-db` database if it does not already exist. This allows for using a shared RDS instance with multiple postgres databases for each `app` environment.
77+
78+
After creating the database, the `pre-backend-update` job runs database migrations using Django's `migrate` command.
79+
80+
The `[CD] App Update` Action then does a rolling update for each of the backend application services (`gunicorn`, `default` celery worker and celery `beat`).
81+
82+
These actions use the official AWS GitHub Action called `aws-actions/amazon-ecs-deploy-task-definition` for updating task definitions, updating services and running one-off tasks (like the `pre-backend-update`).
83+
6184
::: tip
6285
For the most up-to-date information on these projects, please see their open-issues and recent CHANGELOG entries.
6386
:::
64-
65-
## Article
66-
67-
[See this article for an in-depth overview of these different deployment options](https://briancaffey.github.io/2023/01/07/i-deployed-the-same-containerized-serverless-django-app-with-aws-cdk-terraform-and-pulumi)

vuepress-docs/docs/deploy/aws/cdk/README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ head:
1111
# href: https://briancaffey.github.io/django-step-by-step/
1212
---
1313

14-
# IaC with CDK
14+
# AWS CDK (Cloud Development Kit)
1515

1616
## Repo
1717

@@ -28,9 +28,5 @@ For the most up-to-date information on `cdk-django`, please see the repository's
2828
:::
2929

3030
- `cdk-django` is a CDK Component Library that is built using the `projen` framework
31-
- This project supports ad-hoc environments and production environments
32-
- Ad-hoc and production environments both use a base stack and an app stack
33-
- The base and app stack in both ad-hoc and production environments have 2 stacks in the same CDK **app**
31+
- The base and app stack have 2 stacks in the same CDK **app**
3432
- The related Pulumi and Terraform libraries pass references via unique identifiers, CDK uses stack references
35-
- This project is not yet fully implemented in GitHub Actions.
36-
- The production application has not yet implemented autoscaling

0 commit comments

Comments
 (0)