Remove staging: drop staging compose/stack, CI steps, and docs
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
- Delete stack.staging.yml and docker-compose.staging.yml - Remove build-push-staging, deploy-staging, wait-for-deploy-staging, cleanup-staging from .woodpecker.yml - Dockerfile.production: base on alpine:3.18 instead of staging image - Update README, .cursor rules and rules.json to remove staging references Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
454a54109e
commit
6be2ec1949
|
|
@ -1,81 +1,85 @@
|
||||||
{
|
{
|
||||||
"version": 1,
|
"version": 1,
|
||||||
"rules": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"pattern": "**/*",
|
"pattern": "**/*",
|
||||||
"rule": "project-structure.mdc"
|
"rule": "project-structure.mdc"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pattern": "**/docker/template/Dockerfile",
|
"pattern": "**/docker/template/Dockerfile",
|
||||||
"rule": "dockerfiles.mdc"
|
"rule": "dockerfiles.mdc"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pattern": "**/docker/template/Dockerfile.production",
|
"pattern": "**/docker/template/Dockerfile.production",
|
||||||
"rule": "dockerfiles.mdc"
|
"rule": "dockerfiles.mdc"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pattern": "**/docker-compose.dev.yml",
|
"pattern": "**/docker-compose.dev.yml",
|
||||||
"rule": "docker-compose-files.mdc"
|
"rule": "docker-compose-files.mdc"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pattern": "**/docker-compose.staging.yml",
|
"pattern": "**/docker-compose.production.yml",
|
||||||
"rule": "docker-compose-files.mdc"
|
"rule": "docker-compose-files.mdc"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pattern": "**/docker-compose.production.yml",
|
"pattern": "**/docker-compose.test.yml",
|
||||||
"rule": "docker-compose-files.mdc"
|
"rule": "docker-compose-files.mdc"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pattern": "**/docker-compose.test.yml",
|
"pattern": "**/stack.production.yml",
|
||||||
"rule": "docker-compose-files.mdc"
|
"rule": "stack-files.mdc"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pattern": "**/stack.staging.yml",
|
"pattern": "**/*.sh",
|
||||||
"rule": "stack-files.mdc"
|
"rule": "scripts.mdc"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pattern": "**/stack.production.yml",
|
"pattern": "**/build-test-run.sh",
|
||||||
"rule": "stack-files.mdc"
|
"rule": "git-workflow.mdc"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pattern": "**/*.sh",
|
"pattern": "**/temp/**/*",
|
||||||
"rule": "scripts.mdc"
|
"rule": [
|
||||||
},
|
"temp-directory.mdc",
|
||||||
{
|
"gitkeep-handling.mdc"
|
||||||
"pattern": "**/build-test-run.sh",
|
]
|
||||||
"rule": "git-workflow.mdc"
|
},
|
||||||
},
|
{
|
||||||
{
|
"pattern": "**/.gitignore",
|
||||||
"pattern": "**/temp/**/*",
|
"rule": "gitignore.mdc"
|
||||||
"rule": ["temp-directory.mdc", "gitkeep-handling.mdc"]
|
},
|
||||||
},
|
{
|
||||||
{
|
"pattern": "**/.git/**/*",
|
||||||
"pattern": "**/.gitignore",
|
"rule": "git-workflow.mdc"
|
||||||
"rule": "gitignore.mdc"
|
},
|
||||||
},
|
{
|
||||||
{
|
"pattern": "**/docker/template/src/**/*",
|
||||||
"pattern": "**/.git/**/*",
|
"rule": [
|
||||||
"rule": "git-workflow.mdc"
|
"source-code.mdc",
|
||||||
},
|
"gitkeep-handling.mdc"
|
||||||
{
|
]
|
||||||
"pattern": "**/docker/template/src/**/*",
|
},
|
||||||
"rule": ["source-code.mdc", "gitkeep-handling.mdc"]
|
{
|
||||||
},
|
"pattern": "**/.gitkeep",
|
||||||
{
|
"rule": "gitkeep-handling.mdc"
|
||||||
"pattern": "**/.gitkeep",
|
},
|
||||||
"rule": "gitkeep-handling.mdc"
|
{
|
||||||
},
|
"pattern": "**/temp/",
|
||||||
{
|
"rule": [
|
||||||
"pattern": "**/temp/",
|
"temp-directory.mdc",
|
||||||
"rule": ["temp-directory.mdc", "gitkeep-handling.mdc"]
|
"gitkeep-handling.mdc"
|
||||||
},
|
]
|
||||||
{
|
},
|
||||||
"pattern": "**/docker/template/src/",
|
{
|
||||||
"rule": ["source-code.mdc", "gitkeep-handling.mdc"]
|
"pattern": "**/docker/template/src/",
|
||||||
},
|
"rule": [
|
||||||
{
|
"source-code.mdc",
|
||||||
"pattern": "**/.woodpecker.yml",
|
"gitkeep-handling.mdc"
|
||||||
"rule": "project-structure.mdc"
|
]
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
}
|
"pattern": "**/.woodpecker.yml",
|
||||||
|
"rule": "project-structure.mdc"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -20,19 +20,11 @@ alwaysApply: false
|
||||||
- Configures development environment variables
|
- Configures development environment variables
|
||||||
- Mounts the [temp](mdc:temp) directory for local testing
|
- Mounts the [temp](mdc:temp) directory for local testing
|
||||||
|
|
||||||
- [docker-compose.staging.yml](mdc:docker-compose.staging.yml): Staging build configuration
|
|
||||||
- Builds and tags the staging image
|
|
||||||
- Used by CI/CD for staging deployments
|
|
||||||
|
|
||||||
- [docker-compose.production.yml](mdc:docker-compose.production.yml): Production build configuration
|
- [docker-compose.production.yml](mdc:docker-compose.production.yml): Production build configuration
|
||||||
- Builds and tags the production image
|
- Builds and tags the production image
|
||||||
- Used by CI/CD for production deployments
|
- Used by CI/CD for production deployments
|
||||||
|
|
||||||
## Stack Files
|
## Stack Files
|
||||||
- [stack.staging.yml](mdc:stack.staging.yml): Staging stack deployment
|
|
||||||
- Configures service deployment for staging environment
|
|
||||||
- Sets up Traefik routing rules
|
|
||||||
|
|
||||||
- [stack.production.yml](mdc:stack.production.yml): Production stack deployment
|
- [stack.production.yml](mdc:stack.production.yml): Production stack deployment
|
||||||
- Configures service deployment for production environment
|
- Configures service deployment for production environment
|
||||||
- Sets up Traefik routing rules with appropriate security headers
|
- Sets up Traefik routing rules with appropriate security headers
|
||||||
|
|
|
||||||
|
|
@ -10,70 +10,6 @@ clone:
|
||||||
when:
|
when:
|
||||||
branch: [main]
|
branch: [main]
|
||||||
steps:
|
steps:
|
||||||
# Build and Push for Staging
|
|
||||||
build-push-staging:
|
|
||||||
name: build-push-staging
|
|
||||||
image: woodpeckerci/plugin-docker-buildx
|
|
||||||
environment:
|
|
||||||
REGISTRY_USER:
|
|
||||||
from_secret: REGISTRY_USER
|
|
||||||
REGISTRY_PASSWORD:
|
|
||||||
from_secret: REGISTRY_PASSWORD
|
|
||||||
DOCKER_REGISTRY_USER:
|
|
||||||
from_secret: DOCKER_REGISTRY_USER
|
|
||||||
DOCKER_REGISTRY_PASSWORD:
|
|
||||||
from_secret: DOCKER_REGISTRY_PASSWORD
|
|
||||||
volumes:
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
commands:
|
|
||||||
- echo "nameserver 1.1.1.1" > /etc/resolv.conf
|
|
||||||
- echo "nameserver 1.0.0.1" >> /etc/resolv.conf
|
|
||||||
- HOSTNAME=$(docker info --format "{{.Name}}")
|
|
||||||
- echo "Building on $HOSTNAME"
|
|
||||||
- echo "$${DOCKER_REGISTRY_PASSWORD}" | docker login -u "$${DOCKER_REGISTRY_USER}" --password-stdin
|
|
||||||
- echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us
|
|
||||||
- docker compose -f docker-compose.staging.yml build --no-cache
|
|
||||||
- docker compose -f docker-compose.staging.yml push
|
|
||||||
when:
|
|
||||||
branch: main
|
|
||||||
event: push
|
|
||||||
|
|
||||||
# Deploy Staging
|
|
||||||
deploy-staging:
|
|
||||||
name: deploy-staging
|
|
||||||
image: woodpeckerci/plugin-docker-buildx
|
|
||||||
environment:
|
|
||||||
REGISTRY_USER:
|
|
||||||
from_secret: REGISTRY_USER
|
|
||||||
REGISTRY_PASSWORD:
|
|
||||||
from_secret: REGISTRY_PASSWORD
|
|
||||||
volumes:
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
commands:
|
|
||||||
- echo "nameserver 1.1.1.1" > /etc/resolv.conf
|
|
||||||
- echo "nameserver 1.0.0.1" >> /etc/resolv.conf
|
|
||||||
- HOSTNAME=$(docker info --format "{{.Name}}")
|
|
||||||
- echo "Deploying on $HOSTNAME"
|
|
||||||
- echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us
|
|
||||||
- docker stack deploy --with-registry-auth -c ./stack.staging.yml $${CI_REPO_NAME}-staging
|
|
||||||
when:
|
|
||||||
branch: main
|
|
||||||
event: push
|
|
||||||
|
|
||||||
# Wait for Deploy to Complete
|
|
||||||
wait-for-deploy-staging:
|
|
||||||
name: wait-for-deploy-staging
|
|
||||||
image: woodpeckerci/plugin-docker-buildx
|
|
||||||
volumes:
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
commands:
|
|
||||||
- echo "nameserver 1.1.1.1" > /etc/resolv.conf
|
|
||||||
- echo "nameserver 1.0.0.1" >> /etc/resolv.conf
|
|
||||||
- sleep 20
|
|
||||||
when:
|
|
||||||
branch: main
|
|
||||||
event: push
|
|
||||||
|
|
||||||
# Build and Push for Production
|
# Build and Push for Production
|
||||||
build-push-production:
|
build-push-production:
|
||||||
name: build-push-production
|
name: build-push-production
|
||||||
|
|
@ -122,28 +58,4 @@ steps:
|
||||||
- docker stack deploy --with-registry-auth -c ./stack.production.yml $${CI_REPO_NAME}
|
- docker stack deploy --with-registry-auth -c ./stack.production.yml $${CI_REPO_NAME}
|
||||||
when:
|
when:
|
||||||
branch: main
|
branch: main
|
||||||
event: [push, cron]
|
event: [push, cron]
|
||||||
|
|
||||||
# Cleanup Staging Environment
|
|
||||||
cleanup-staging:
|
|
||||||
name: cleanup-staging
|
|
||||||
image: woodpeckerci/plugin-docker-buildx
|
|
||||||
environment:
|
|
||||||
REGISTRY_USER:
|
|
||||||
from_secret: REGISTRY_USER
|
|
||||||
REGISTRY_PASSWORD:
|
|
||||||
from_secret: REGISTRY_PASSWORD
|
|
||||||
volumes:
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
commands:
|
|
||||||
- echo "nameserver 1.1.1.1" > /etc/resolv.conf
|
|
||||||
- echo "nameserver 1.0.0.1" >> /etc/resolv.conf
|
|
||||||
- HOSTNAME=$(docker info --format "{{.Name}}")
|
|
||||||
- echo "Cleaning up staging environment on $HOSTNAME"
|
|
||||||
- for i in {1..5}; do docker stack rm $${CI_REPO_NAME}-staging && break || sleep 10; done
|
|
||||||
- docker compose -f docker-compose.staging.yml down
|
|
||||||
- docker compose -f docker-compose.staging.yml rm -f
|
|
||||||
when:
|
|
||||||
branch: main
|
|
||||||
event: [push, cron]
|
|
||||||
status: success
|
|
||||||
|
|
@ -17,9 +17,7 @@ This is a template project that follows a standardized structure for Docker-base
|
||||||
├── temp/ # Local testing scratch space
|
├── temp/ # Local testing scratch space
|
||||||
├── docker-compose.dev.yml # Docker Compose for local development
|
├── docker-compose.dev.yml # Docker Compose for local development
|
||||||
├── docker-compose.production.yml
|
├── docker-compose.production.yml
|
||||||
├── docker-compose.staging.yml
|
|
||||||
├── docker-compose.test.yml
|
├── docker-compose.test.yml
|
||||||
├── stack.staging.yml
|
|
||||||
└── stack.production.yml
|
└── stack.production.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
# The only stuff that happens here is template gets replaced and so does possibly nixius
|
|
||||||
services:
|
|
||||||
template:
|
|
||||||
build:
|
|
||||||
context: ./docker/template
|
|
||||||
dockerfile: Dockerfile.staging
|
|
||||||
image: git.nixc.us/colin/template:staging
|
|
||||||
|
|
@ -1 +1,3 @@
|
||||||
FROM git.nixc.us/nixius/template:staging
|
FROM alpine:3.18
|
||||||
|
WORKDIR /app
|
||||||
|
CMD ["tail", "-f", "/dev/null"]
|
||||||
|
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
networks:
|
|
||||||
traefik:
|
|
||||||
external: true
|
|
||||||
default:
|
|
||||||
|
|
||||||
services:
|
|
||||||
template:
|
|
||||||
image: git.nixc.us/nixius/template:staging
|
|
||||||
deploy:
|
|
||||||
labels:
|
|
||||||
- traefik.enable=true
|
|
||||||
- traefik.http.routers.staging_template.rule=Host(`staging.template.nixc.us`)
|
|
||||||
- traefik.http.routers.staging_template.entrypoints=websecure
|
|
||||||
- traefik.http.routers.staging_template.tls=true
|
|
||||||
- traefik.http.routers.staging_template.tls.certresolver=letsencryptresolver
|
|
||||||
- traefik.http.services.staging_template.loadbalancer.server.port=3000
|
|
||||||
# - traefik.http.services.staging_template.loadbalancer.healthcheck.path=/health
|
|
||||||
# - traefik.http.services.staging_template.loadbalancer.healthcheck.interval=30s
|
|
||||||
# - traefik.http.services.staging_template.loadbalancer.healthcheck.timeout=5s
|
|
||||||
replicas: 1
|
|
||||||
restart_policy:
|
|
||||||
condition: on-failure
|
|
||||||
max_attempts: 3
|
|
||||||
update_config:
|
|
||||||
parallelism: 1
|
|
||||||
delay: 10s
|
|
||||||
order: start-first
|
|
||||||
rollback_config:
|
|
||||||
parallelism: 1
|
|
||||||
delay: 10s
|
|
||||||
order: stop-first
|
|
||||||
networks:
|
|
||||||
- traefik
|
|
||||||
Loading…
Reference in New Issue