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: vuepress-docs/docs/README.md
+3-40Lines changed: 3 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,8 +12,6 @@ features:
12
12
details: This project covers the full technology stack of modern web applications, from frontend to backend to CI/CD and Infrastructure as Code
13
13
- title: Twelve-Factor App
14
14
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
17
15
- title: IaC Rosetta Stone
18
16
details: This project implements the same application architecture using CDK, Terraform and Pulumi
19
17
- title: GitHub Actions
@@ -24,54 +22,19 @@ features:
24
22
details: The backend Django app is implemented using Django templates using both functions-based views and class-based views
25
23
- title: DRF and GraphQL
26
24
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
29
27
- title: Python and TypeScript
30
28
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
33
29
- title: Developer Experience
34
30
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
37
31
- title: Testing and coverage
38
32
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
<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
-
75
38
## How to get help
76
39
77
40
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:
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.
These three GitHub Actions all work in the same way:
52
52
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.
56
59
57
60
::: 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.
59
62
:::
60
63
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
+
61
84
::: tip
62
85
For the most up-to-date information on these projects, please see their open-issues and recent CHANGELOG entries.
63
86
:::
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)
0 commit comments