|
1 | | -# Django continuous delivery |
| 1 | +# Talos - Django Continuous Delivery |
2 | 2 |
|
3 | 3 | [](https://github.com/python/black) |
4 | 4 |
|
5 | 5 | > A [Django](https://docs.djangoproject.com) project template ready for continuous delivery. |
6 | 6 |
|
7 | | -## 📝 Conventions |
| 7 | +## 🧩 Requirements |
8 | 8 |
|
9 | | -In the following instructions: |
| 9 | +The Talos script can be run either using Docker or as a local shell command. |
10 | 10 |
|
11 | | -- replace `projects` with your actual projects directory |
12 | | -- replace `My project name` with your chosen project name |
| 11 | +### 🐋 Docker |
13 | 12 |
|
14 | | -## Git |
| 13 | +In order to run Talos via Docker, a working [Docker installation](https://docs.docker.com/get-docker/) is the only requirement. |
15 | 14 |
|
16 | | -To get the existing project, change directory and clone the project repository. |
| 15 | +### 👨💻 Shell command |
17 | 16 |
|
| 17 | +In order to run Talos as a shell command, first clone the repository in a local projects directory |
18 | 18 | ```console |
19 | | -$ cd ~/projects/ |
20 | | -$ git clone https://github.com/20tab/django-continuous-delivery.git |
| 19 | +cd ~/projects |
| 20 | +git clone https://github.com/20tab/django-continuous-delivery.git talos-django |
21 | 21 | ``` |
| 22 | +Then, install the following requirements |
| 23 | +| Requirements | Instructions | |
| 24 | +|--|--| |
| 25 | +|🌎 Terraform | [Install Guide](https://learn.hashicorp.com/tutorials/terraform/install-cli) | |
| 26 | +|🐍 Python Dependencies | `pip install -r talos-django/requirements/common.txt` | |
22 | 27 |
|
23 | | -## 🧩 Requirements |
| 28 | +## 🔑 Credentials |
| 29 | + |
| 30 | +### 🦊 GitLab |
| 31 | +If the GitLab integration is enabled, a Personal Access Token with _api_ permission is required.<br/> |
| 32 | +It can be generated in the GitLab User Settings panel. |
24 | 33 |
|
25 | | -A set of requirements must be installed before initializing the project. |
| 34 | +**Note:** the token can be generated in the Access Tokens section of the GitLab User Settings panel.<br/> |
| 35 | +⚠️ Beware that the token is shown only once after creation. |
26 | 36 |
|
| 37 | +## 🚀️ Quickstart |
| 38 | + |
| 39 | +Change to the projects directory, for example |
27 | 40 | ```console |
28 | | -$ python3 -m pip install -r django-continuous-delivery/requirements/common.txt |
| 41 | +cd ~/projects |
29 | 42 | ``` |
30 | 43 |
|
31 | | -## 🚀️ Quickstart |
| 44 | +### 🐋 Docker |
32 | 45 |
|
33 | | -Change directory and create a new project as in this example: |
| 46 | +```console |
| 47 | +docker run --interactive --tty --rm --volume $PWD:/data 20tab/talos-django:latest |
| 48 | +``` |
| 49 | + |
| 50 | +### 👨💻 Shell command |
| 51 | + |
| 52 | +```console |
| 53 | +./talos-django/setup.py |
| 54 | +``` |
34 | 55 |
|
| 56 | +### Example |
35 | 57 | ```console |
36 | | -$ python3 django-continuous-delivery/setup.py |
37 | | -Project name: My project name |
| 58 | +Project name: My Project Name |
38 | 59 | Project slug [my-project-name]: |
39 | 60 | Service slug [backend]: |
40 | 61 | Project dirname (backend, myprojectname) [backend]: myprojectname |
41 | 62 | Development environment complete URL [https://dev.my-project-name.com/]: |
42 | 63 | Staging environment complete URL [https://stage.my-project-name.com/]: |
43 | 64 | Production environment complete URL [https://www.my-project-name.com/]: |
44 | 65 | Media storage (local, s3-digitalocean, none) [s3-digitalocean]: |
| 66 | +Do you want to configure Redis? [y/N]: y |
| 67 | +Do you want to configure Gitlab? [Y/n]: y |
| 68 | +Gitlab group slug [my-project-name]: |
| 69 | +Make sure the Gitlab "my-project-name" group exists before proceeding. Continue? [y/N]: y |
| 70 | +Gitlab private token (with API scope enabled): |
| 71 | +Sentry DSN (leave blank if unused) []: |
45 | 72 | Initializing the backend service: |
46 | 73 | ...cookiecutting the service |
47 | 74 | ...generating the .env file |
48 | 75 | ...formatting the cookiecut python code |
49 | 76 | ...compiling the requirements files |
| 77 | + - common.txt |
| 78 | + - test.txt |
| 79 | + - local.txt |
| 80 | + - remote.txt |
| 81 | + - base.txt |
50 | 82 | ...creating the '/static' directory |
51 | | -Do you want to configure Gitlab? [Y/n]: Y |
52 | | -Gitlab group slug [my-project-name]: |
53 | | -Make sure the Gitlab "my-project-name" group exists before proceeding. Continue? [y/N]: y |
54 | | -Gitlab private token (with API scope enabled): |
55 | | -Sentry DSN (leave blank if unused) []: https://sentry.io/mydsn |
56 | | -...creating the Gitlab repository and associated resources |
57 | | -Project successfully initialized. |
58 | | -$ cd myprojectname |
| 83 | +...creating the GitLab repository and associated resources |
59 | 84 | ``` |
| 85 | +## 🗒️ Arguments |
| 86 | + |
| 87 | +The following arguments can be appended to the Docker and shell commands |
| 88 | + |
| 89 | +#### User id |
| 90 | +`--uid=$UID` |
| 91 | + |
| 92 | +#### Group id |
| 93 | +`--gid=1000` |
| 94 | + |
| 95 | +#### Output directory |
| 96 | +`--output-dir="~/projects"` |
| 97 | + |
| 98 | +#### Project name |
| 99 | +`--project-name="My project name"` |
| 100 | + |
| 101 | +#### Project slug |
| 102 | +`--project-slug="my-project-name"` |
| 103 | + |
| 104 | +#### Project dirname |
| 105 | +`--project-dirname="myprojectname"` |
| 106 | + |
| 107 | +### 🎖️ Service |
| 108 | + |
| 109 | +#### Service slug |
| 110 | +`--service-slug=backend` |
| 111 | + |
| 112 | +#### Service port |
| 113 | +`--internal-service-port=8000` |
| 114 | + |
| 115 | +#### Project Domain |
| 116 | +If you don't want DigitalOcean DNS configuration the following args are required |
| 117 | + |
| 118 | +`--project-url-dev=https://dev.project-domain.com`<br/> |
| 119 | +`--project-url-stage=https://stage.project-domain.com`<br/> |
| 120 | +`--project-url-prod=https://www.project-domain.com` |
| 121 | + |
| 122 | +#### Media storage |
| 123 | + |
| 124 | +Value | Description | Argument |
| 125 | +------------- | ------------- | ------------- |
| 126 | +local | Docker Volume are used for store media | `--media-storage=local` |
| 127 | +s3-digitalocean | `--media-storage=s3-digitalocean` |
| 128 | +none | Project have no media | `--media-storage=none` |
| 129 | + |
| 130 | +#### Redis |
| 131 | +For enable redis integration the following arguments are needed: |
| 132 | + |
| 133 | +`--use-redis` |
| 134 | + |
| 135 | +Disabled args |
| 136 | +`--no-redis` |
| 137 | + |
| 138 | +### 🦊 GitLab |
| 139 | +> **⚠️ Important: Make sure the GitLab group exists before create.** |
| 140 | +> https://gitlab.com/gitlab-org/gitlab/-/issues/244345 |
| 141 | +
|
| 142 | +For enable gitlab integration the following arguments are needed: |
| 143 | + |
| 144 | +`--use-gitlab`<br/> |
| 145 | +`--gitlab-private-token={{gitlab-private-token}}`<br/> |
| 146 | +`--gitlab-group-slug={{gitlab-group-slug}}` |
| 147 | + |
| 148 | +Disabled args |
| 149 | +`--no-gitlab` |
| 150 | + |
| 151 | +Add user to repository using comma separeted arguments |
| 152 | + |
| 153 | +`--gitlab-group-owners=user1, [email protected]`< br/> |
| 154 | +`--gitlab-group-maintainers=user1, [email protected]`< br/> |
| 155 | +`--gitlab-group-developers=user1, [email protected]` |
| 156 | + |
| 157 | +#### 🪖 Sentry |
| 158 | +For enable sentry integration the following arguments are needed: |
| 159 | + |
| 160 | +`--sentry-dsn={{frontend-sentry-dsn}}` |
| 161 | + |
| 162 | +#### 🔇 Silent |
| 163 | +Is command for use default if no args are provided |
| 164 | + |
| 165 | +`--silent` |
0 commit comments