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
This guide describes how to deploy the application to a production environment on a Linux server using Docker and Docker Compose.
4
+
5
+
## Prerequisites
6
+
7
+
- A Linux server with Docker and Docker Compose installed.
8
+
- A Traefik reverse proxy instance running and configured on the same server.
9
+
- The `traefik-public` Docker network must exist.
10
+
- A domain or subdomain pointed to the server's IP address.
11
+
12
+
## Setup
13
+
14
+
### 1. Clone the Repository
15
+
16
+
Connect to your server and clone the repository:
17
+
18
+
```bash
19
+
git clone <repository-url>
20
+
cd stage-flow-tools
21
+
```
22
+
23
+
### 2. Configure Environment
24
+
25
+
Copy the example environment file and customize it:
26
+
27
+
```bash
28
+
cp .env.example .env
29
+
```
30
+
31
+
Edit the `.env` file and set a strong, unique `NUXT_JWT_SECRET`. You can generate one with:
32
+
33
+
```bash
34
+
openssl rand -base64 48
35
+
```
36
+
37
+
### 3. Configure Docker Compose
38
+
39
+
Open the `docker-compose.yml` file and update the Traefik `Host` rule to match your domain:
40
+
41
+
```yaml
42
+
services:
43
+
app:
44
+
# ...
45
+
labels:
46
+
- "traefik.http.routers.quiz-app.rule=Host(`quiz.your-domain.com`)"# Change this
47
+
# ...
48
+
```
49
+
50
+
### 4. Build and Start the Container
51
+
52
+
Build the Docker image and start the container in detached mode:
53
+
54
+
```bash
55
+
docker compose up --build -d
56
+
```
57
+
58
+
The application will be accessible at your configured domain. Traefik will automatically handle SSL certificate provisioning via Let's Encrypt.
59
+
60
+
## Data Persistence
61
+
62
+
The `docker-compose.yml` file is configured to mount the local `./data` directory into the container at `/app/data`. This ensures that all application data (questions, answers, etc.) is persisted on the host machine, even if the container is removed or recreated.
This guide provides minimal instructions for building and testing the Docker container locally. This process simulates the image creation step of the CI/CD workflow.
4
+
5
+
## 1. Build the Docker Image
6
+
7
+
Ensure the Docker daemon is running on your machine. Then, from the project root, execute the build script:
8
+
9
+
```bash
10
+
./docker-build.sh
11
+
```
12
+
13
+
This command builds the image and tags it as `stage-flow-tools`.
14
+
15
+
## 2. Run the Container
16
+
17
+
### Prerequisites
18
+
19
+
Before running the container, make sure you have a `.env` file in your project root. If you don't have one, create it by copying the example file:
20
+
21
+
```bash
22
+
cp .env.example .env
23
+
```
24
+
25
+
Ensure the `NUXT_JWT_SECRET` and other variables are set correctly in this file.
26
+
27
+
### Command
28
+
29
+
To test the built image, run the following command. It mounts the local `.env` file and the `data` directory into the container.
30
+
31
+
```bash
32
+
docker run --rm -it \
33
+
-p 3000:3000 \
34
+
--env-file ./.env \
35
+
-v "$(pwd)/data:/app/data" \
36
+
--name test-stage-flow \
37
+
stage-flow-tools
38
+
```
39
+
40
+
The application will be available at `http://localhost:3000`. The container will be automatically removed when you stop it (`Ctrl+C`).
41
+
42
+
### A Note on Versioning
43
+
44
+
The local build script tags the image with `:latest`. The automated GitHub Actions workflow handles versioning for releases by automatically tagging the image with the correct semantic version (e.g., `1.2.3`, `1.2`, `1`) based on the release created by the `release-please` bot.
This document outlines the automated release process for the application, which is managed by GitHub Actions and the `release-please` bot.
4
+
5
+
## Overview
6
+
7
+
The release process is triggered automatically when commits are pushed to the `main` branch. It handles versioning, changelog generation, GitHub releases, and Docker image publishing.
8
+
9
+
## Workflow
10
+
11
+
### 1. Development
12
+
13
+
Developers work on feature or fix branches and create pull requests to merge their changes into the `main` branch. Commit messages must follow the [Conventional Commits](https://www.conventionalcommits.org/) specification.
14
+
15
+
### 2. Release Proposal
16
+
17
+
After one or more pull requests are merged into `main`, the `release-please` GitHub Action runs automatically. It analyzes the commit history since the last release and determines the next semantic version number.
18
+
19
+
If a new release is warranted, the bot creates a new pull request titled `chore(main): release [version]`. This PR includes:
20
+
21
+
- An updated `CHANGELOG.md` file.
22
+
- The new version number bumped in `package.json`.
23
+
24
+
### 3. Human Approval
25
+
26
+
A project maintainer reviews the release pull request. If everything is correct, the PR is merged into the `main` branch. This merge action is the trigger for the next step.
27
+
28
+
### 4. Release and Publication
29
+
30
+
Upon merging the release PR, the GitHub Actions workflow performs the following tasks:
31
+
32
+
1.**Creates a GitHub Release**: A new release is created on GitHub with the tag `v[version]`. The release notes are populated from the `CHANGELOG.md`.
33
+
2.**Builds Docker Image**: A new Docker image is built based on the state of the `main` branch at the release tag.
34
+
3.**Pushes to Registry**: The Docker image is pushed to the GitHub Container Registry (`ghcr.io`) with tags corresponding to the release version (e.g., `1.2.3`, `1.2`, `1`, `latest`).
35
+
36
+
The `main` branch is now updated with the latest version, and a new, versioned Docker image is available for deployment.
0 commit comments