feat: configure gitea Actions deployment workflow and update droplet deployment documentation
Production Deployment / Build and Push Docker Image (push) Failing after 16s
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:15:57 +05:00
parent 9d88936b4a
commit d7de80e7e0
2 changed files with 21 additions and 40 deletions
+6 -9
View File
@@ -51,28 +51,25 @@ jobs:
# Authenticate with Gitea registry on Droplet # Authenticate with Gitea registry on Droplet
docker login -u "${{ github.actor }}" -p "${{ secrets.GITHUB_TOKEN }}" git.nciphered.com docker login -u "${{ github.actor }}" -p "${{ secrets.GITHUB_TOKEN }}" git.nciphered.com
# Ensure isolated network exists
docker network create dockernet 2>/dev/null || true
# Pull latest image # Pull latest image
docker pull git.nciphered.com/${{ github.repository }}:latest docker pull git.nciphered.com/${{ github.repository }}:latest
# Stop existing container # Stop existing container
docker rm -f stick-app-container || true docker rm -f ${{ secrets.APP_CONTAINER_NAME }} || true
# Run container on the 'dockernet' network # Run container with user-defined docker flags (e.g., --network, -p)
docker run -d \ docker run -d \
--name stick-app-container \ --name ${{ secrets.APP_CONTAINER_NAME }} \
--network dockernet \ ${{ secrets.DOCKER_RUN_FLAGS }} \
-p 80:3007 \
-e DATABASE_URL="${{ secrets.DATABASE_URL_DROPLET }}" \ -e DATABASE_URL="${{ secrets.DATABASE_URL_DROPLET }}" \
-e DATABASE_NAME="${{ secrets.DATABASE_NAME }}" \ -e DATABASE_NAME="${{ secrets.DATABASE_NAME }}" \
-e JWT_SECRET="${{ secrets.JWT_SECRET }}" \ -e JWT_SECRET="${{ secrets.JWT_SECRET }}" \
-e HOST="0.0.0.0" \ -e HOST="0.0.0.0" \
-e PORT="3007" \ -e PORT="${{ secrets.APP_PORT }}" \
--restart unless-stopped \ --restart unless-stopped \
git.nciphered.com/${{ github.repository }}:latest git.nciphered.com/${{ github.repository }}:latest
deploy-cloudrun: deploy-cloudrun:
name: Deploy to Google Cloud Run name: Deploy to Google Cloud Run
needs: build needs: build
+15 -31
View File
@@ -205,46 +205,30 @@ pub async fn delete_task_handler(
## Production Deployment to a Cloud Host (DigitalOcean Droplet) ## 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. For production deployments (such as to a DigitalOcean Droplet), the application is fully containerized and configured via standard environment variables.
### 1. Create the Isolated Docker Network The application is completely decoupled from the underlying hosting, networking, and database infrastructure. You are responsible for provisioning the database and supplying the connection configuration.
On your Droplet, create the bridge network:
### 1. Build the Application Container
Build the application Docker image:
```bash ```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 . docker build -t stick-app .
```
# 2. Run the application container, linking to the database using its container name ### 2. Deploy the Application Container
docker run --name stick-app-container \ Run the container on your target Docker network, providing the connection details to your pre-existing MongoDB database container through environment variables:
--network dockernet \ ```bash
docker run -d \
--name stick-app-container \
--network your-docker-network \
-p 80:3007 \ -p 80:3007 \
-e DATABASE_URL="mongodb://stick-mongodb:27017" \ -e DATABASE_URL="mongodb://your-mongodb-host:27017" \
-e DATABASE_NAME="stick_db" \ -e DATABASE_NAME="stick_db" \
-e JWT_SECRET="your_secure_production_jwt_signing_key_at_least_32_chars_long" \ -e JWT_SECRET="your_secure_production_jwt_signing_key_at_least_32_chars_long" \
-e HOST="0.0.0.0" \ -e HOST="0.0.0.0" \
-e PORT="3007" \ -e PORT="3007" \
-d \ --restart unless-stopped \
stick-app stick-app
``` ```
*Note: `-p 80:3007` maps the Droplet's external HTTP port 80 to the application's internal container port 3007.* *Note: Adjust the port mapping (`-p`), container name, network name, and `DATABASE_URL` environment variable as necessary to integrate with your custom proxy or container infrastructure.*