feat: add Gitea deployment workflow for SG region and document Droplet deployment
Production Deployment / Build and Push Docker Image (push) Failing after 17s
Production Deployment / Deploy to DigitalOcean Droplet (push) Has been skipped
Production Deployment / Deploy to Google Cloud Run (push) Has been skipped

This commit is contained in:
2026-05-31 07:00:13 +05:00
parent 83fbb16b6b
commit 9d88936b4a
2 changed files with 163 additions and 0 deletions
+48
View File
@@ -200,3 +200,51 @@ pub async fn delete_task_handler(
Ok(Redirect::to("/tasks"))
}
```
---
## Production Deployment to a Cloud Host (DigitalOcean Droplet)
For production deployments (such as to a DigitalOcean Droplet), we avoid using `--network="host"`. Instead, we deploy both the database and the application container to a shared, user-defined Docker bridge network named **`dockernet`**. This provides secure internal DNS resolution and container isolation.
### 1. Create the Isolated Docker Network
On your Droplet, create the bridge network:
```bash
docker network create dockernet
```
### 2. Build and Run the Database Infrastructure
Build the custom MongoDB infrastructure image using the dedicated `Infra.DockerFile`:
```bash
# 1. Build the database image
docker build -t stick-db -f Infra.DockerFile .
# 2. Run the database container on 'dockernet' with host persistence
docker run --name stick-mongodb \
--network dockernet \
-v /var/lib/mongodb/data:/data/db \
-d \
stick-db
```
*Note: The database container is named `stick-mongodb`. Other containers on `dockernet` can now resolve this container using `mongodb://stick-mongodb:27017`.*
### 3. Build and Deploy the Application Container
Build the main application image and launch it on the same network:
```bash
# 1. Build the application image
docker build -t stick-app .
# 2. Run the application container, linking to the database using its container name
docker run --name stick-app-container \
--network dockernet \
-p 80:3007 \
-e DATABASE_URL="mongodb://stick-mongodb:27017" \
-e DATABASE_NAME="stick_db" \
-e JWT_SECRET="your_secure_production_jwt_signing_key_at_least_32_chars_long" \
-e HOST="0.0.0.0" \
-e PORT="3007" \
-d \
stick-app
```
*Note: `-p 80:3007` maps the Droplet's external HTTP port 80 to the application's internal container port 3007.*