From d52dc299f2d769966816be7cb8ddcfbd7ab5ae5e Mon Sep 17 00:00:00 2001 From: tobias Date: Wed, 5 Jun 2024 22:13:00 +0200 Subject: [PATCH] Remove astro docker & drone stuff --- .drone.yml | 48 ++++++++++++++++++++++++++ docker-compose.prod.yml | 74 +++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 70 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 192 insertions(+) create mode 100644 .drone.yml create mode 100644 docker-compose.prod.yml create mode 100644 docker-compose.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..2a48b6a --- /dev/null +++ b/.drone.yml @@ -0,0 +1,48 @@ +--- +kind: pipeline +name: publish pipeline +steps: + - name: publish payload dev container + image: plugins/docker + settings: &payload-build-settings + <<: *docker-build-settings + # NOTE: edit this if you want your image called something else + repo: git.autonomic.zone/autonomic-cooperative/nextload-dev + context: payload + dockerfile: payload/Dockerfile + target: dev + when: + <<: *exclude-event-custom + + - name: publish payload prod container + image: plugins/docker + settings: + <<: *payload-build-settings + username: 3wordchant + repo: git.autonomic.zone/autonomic-cooperative/nextload-prod + target: prod + when: + <<: *exclude-event-custom + + - name: deploy stack + image: git.coopcloud.tech/coop-cloud/stack-ssh-deploy:latest + settings: + compose: docker-compose.prod.yml + stack: paystro_swarm-demo_autonomic_zone + host: swarm-demo.autonomic.zone + deploy_key: + from_secret: drone_ssh_swarm-demo.autonomic.zone + environment: + DOMAIN: paystro.swarm-demo.autonomic.zone + STACK_NAME: paystro_swarm-demo_autonomic_zone + SECRET_PAYLOAD_SECRET_VERSION: v1 + SECRET_TOKEN_VERSION: v1 + SECRET_MONGO_PASSWORD_VERSION: v1 + NGINX_CONF_VERSION: v1 + REPOSITORY: "autonomic-cooperative/astro-payload-test" + DRONE_URL: "https://drone.autonomic.zone" + PAYLOAD_URL: "https://admin.paystro.swarm-demo.autonomic.zone" + depends_on: + - publish payload prod container + when: + <<: *exclude-event-custom \ No newline at end of file diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml new file mode 100644 index 0000000..099c015 --- /dev/null +++ b/docker-compose.prod.yml @@ -0,0 +1,74 @@ +--- +version: "3.8" + +services: + payload: + image: git.autonomic.zone/autonomic-cooperative/astro-payload-test-payload:latest + environment: + - "NAME=${STACK_NAME}" + - "PAYLOAD_URL" + - "PAYLOAD_PORT=3001" + - "PAYLOAD_SECRET_FILE=/run/secrets/payload_secret" + - "MONGODB_USER=mongo" + - "MONGODB_HOST=${STACK_NAME}_mongo" + - "MONGODB_PORT=27017" + - "MONGODB_PASSWORD_FILE=/run/secrets/mongo_password" + - "TOKEN_FILE=/run/secrets/token" + - "REPOSITORY" + - "DRONE_URL" + secrets: + - mongo_password + - payload_secret + - token + volumes: + - payload_uploads:/prod/dist/media + networks: + - proxy + - internal + deploy: + update_config: + failure_action: rollback + order: start-first + labels: + - "traefik.enable=true" + - "traefik.http.services.${STACK_NAME}-payload.loadbalancer.server.port=3001" + # FIXME switch to /admin probably using PathPrefix + - "traefik.http.routers.${STACK_NAME}-payload.rule=Host(`admin.${DOMAIN}`)" + - "traefik.http.routers.${STACK_NAME}-payload.entrypoints=web-secure" + - "traefik.http.routers.${STACK_NAME}-payload.tls.certresolver=production" + + mongo: + image: mongo:6.0.5 + restart: unless-stopped + volumes: + - mongo:/data/db + command: + - --storageEngine=wiredTiger + environment: + - "MONGO_INITDB_ROOT_USERNAME=mongo" + - "MONGO_INITDB_ROOT_PASSWORD_FILE=/run/secrets/mongo_password" + secrets: + - mongo_password + networks: + - internal + +networks: + proxy: + external: true + internal: + +secrets: + payload_secret: + external: true + name: ${STACK_NAME}_payload_secret_${SECRET_PAYLOAD_SECRET_VERSION} + token: + external: true + name: ${STACK_NAME}_token_${SECRET_TOKEN_VERSION} + mongo_password: + external: true + name: ${STACK_NAME}_mongo_password_${SECRET_MONGO_PASSWORD_VERSION} + +volumes: + mongo: + html_content: + payload_uploads: diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..058f0c0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,70 @@ +services: + astro: + container_name: ${NAME}-astro + image: git.autonomic.zone/autonomic-cooperative/astro-payload-test-astro:latest + restart: unless-stopped + build: + context: astro + command: ["yarn", "dev"] + environment: + DEV: 1 + networks: + - front + volumes: + - ./astro:/base + - /base/node_modules/ + ports: + - 3000:3000 + depends_on: + - payload + + payload: + image: git.autonomic.zone/autonomic-cooperative/astro-payload-test-payload-dev:latest + container_name: ${NAME}-payload + restart: unless-stopped + build: + context: payload + target: dev + environment: + DEV: 1 + NAME: ${NAME} + NODE_ENV: development + PAYLOAD_URL: "http://localhost:${PAYLOAD_PORT}" + PAYLOAD_PORT: ${PAYLOAD_PORT} + PAYLOAD_SECRET: ${PAYLOAD_SECRET} + MONGODB_URI: "mongodb://$MONGODB_USER:$MONGODB_PASSWORD@mongo:27017" + volumes: + - ./payload/src:/base/src + # - ./astro/src/types.ts:/types.ts + - payload_media:/base/src/media + ports: + - ${PAYLOAD_PORT}:${PAYLOAD_PORT} + networks: + - front + - back + depends_on: + - mongo + + mongo: + container_name: ${NAME}-mongo + image: mongo:6.0.5 + restart: unless-stopped + volumes: + - mongo:/data/db + command: + - --storageEngine=wiredTiger + environment: + MONGO_INITDB_ROOT_USERNAME: ${MONGODB_USER} + MONGO_INITDB_ROOT_PASSWORD: ${MONGODB_PASSWORD} + networks: + - back + ports: + - 27017:27017 + +networks: + front: + back: + +volumes: + mongo: + payload_media: