diff --git a/.woodpecker/cli-docker.yaml b/.woodpecker/cli-docker.yaml new file mode 100644 index 0000000..5f591fa --- /dev/null +++ b/.woodpecker/cli-docker.yaml @@ -0,0 +1,22 @@ + +steps: + - name: cli-docker + image: registry.gitlab.com/mostlybroken/robertusfaber/dockerx-linux:latest + privileged: true + environment: + DOCKER_HOST: docker + commands: + - echo hallo from inner hehe + - echo $DOCKER_HOST + - pwd + - ls -la + - sleep 30 + - docker compose -f dogfood-debug.yaml run --rm wooposex --log-level TRACE exec --repo-path . ./.woodpecker/cli.yaml + +services: + - name: docker + image: docker.io/library/docker:dind + privileged: true + detach: true + environment: + DOCKER_TLS_CERTDIR: "" diff --git a/.woodpecker/cli.yaml b/.woodpecker/cli.yaml new file mode 100644 index 0000000..e4ccd8c --- /dev/null +++ b/.woodpecker/cli.yaml @@ -0,0 +1,15 @@ + +steps: + - name: cli + image: docker.io/woodpeckerci/woodpecker-cli:latest-alpine + privileged: true + volumes: + - /var/run/dind:/var/run/dind + environment: + DOCKER_HOST: 'unix:///var/run/dind/docker.sock' + commands: + - echo hallo from inner hehe + - pwd + - ls -la + - ls /woodpecker + - /bin/woodpecker-cli --log-level TRACE exec --repo-path . ./.woodpecker/cli.yaml diff --git a/.woodpecker/wooposex.yaml b/.woodpecker/wooposex.yaml new file mode 100644 index 0000000..3e3511d --- /dev/null +++ b/.woodpecker/wooposex.yaml @@ -0,0 +1,12 @@ + +steps: + - name: build + image: registry.gitlab.com/mostlybroken/robertusfaber/dockerx-linux:latest + commands: + - echo "This is the build step" + - echo "binary-data-123" > executable + - pwd + - whoami + - ls -la + - docker compose up + # TODO: mount volume diff --git a/README.txt b/README.txt index e7bb29f..36e75d5 100644 --- a/README.txt +++ b/README.txt @@ -1,5 +1,27 @@ - wooposex - Woodpecker compose example - ===================================== + wooposex - WOOdpecker comPOSe EXamples + ====================================== - I'm not good at finding project names. +I'm not good at finding project names. + +Examples what you can do with woodpecker/docker/compose. +Exists for exploring w/d/c edge cases, compose (syntax) compliance and such things, also for fun or desperation reasons. +Everything is run in docker in docker in docker… + + +applies to all demos: + Show the resolved compose configuration: + docker compose [-f ] config + + When done, remove the docker daemon and leftover containers: + docker compose [-f ] down --remove-orphans + + +scriptname command line + what it does (or is supposed to do) + + docker compose up -d + run the whoole server/agent stack on localhost + +cli.yaml docker compose -f cli.yaml run --rm cli + Watch the woodpecker cli running itself in docker diff --git a/agent.yaml b/agent.yaml new file mode 100644 index 0000000..6bb8ea3 --- /dev/null +++ b/agent.yaml @@ -0,0 +1,32 @@ +services: + woodpecker-agent-docker: + image: woodpeckerci/woodpecker-agent:latest + command: agent + restart: unless-stopped + depends_on: + woodpecker-server: + condition: service_healthy + network_mode: none + volumes: + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + - docker-run:/var/run/dind + environment: + DOCKER_HOST: 'unix:///var/run/dind/docker.sock' + WOODPECKER_SERVER: 'woodpecker-server:9000' + WOODPECKER_AGENT_SECRET: ${WOODPECKER_AGENT_SECRET} + + woodpecker-agent-shell: + image: woodpeckerci/woodpecker-agent:latest + command: agent + restart: unless-stopped + depends_on: + woodpecker-server: + condition: service_healthy + volumes: + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + network_mode: none + environment: + WOODPECKER_SERVER: 'woodpecker-server:9000' + WOODPECKER_AGENT_SECRET: ${WOODPECKER_AGENT_SECRET} diff --git a/caddy.yaml b/caddy.yaml new file mode 100644 index 0000000..0e58bb5 --- /dev/null +++ b/caddy.yaml @@ -0,0 +1,21 @@ +services: + caddy: + image: docker.io/library/caddy:2-alpine + restart: unless-stopped + ports: + - "80:80" + - "443:443" + - "443:443/udp" + volumes: + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + - ./Caddyfile:/etc/caddy/Caddyfile + - ./pretalx/public:/srv/pretalx + - caddy_data:/data + - caddy_config:/config + - type: 'volume' + source: caddy_talx_run + target: /var/run/talx/ + - type: 'volume' + source: caddy_tix_run + target: /var/run/tix/ diff --git a/cli.yaml b/cli.yaml new file mode 100644 index 0000000..276feb4 --- /dev/null +++ b/cli.yaml @@ -0,0 +1,20 @@ +include: + - dind.yaml + +services: + cli: + image: docker.io/woodpeckerci/woodpecker-cli:latest + command: exec + restart: never + working_dir: /wooposex + depends_on: + dind: + condition: service_started + network_mode: none + volumes: + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + - docker-run:/var/run/dind + - .:/wooposex:ro + environment: + DOCKER_HOST: 'unix:///var/run/dind/docker.sock' diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..47d35a4 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,6 @@ +include: + - caddy.yaml + - server.yaml + - agent.yaml + - postgres.yaml + - dind.yaml diff --git a/dind.yaml b/dind.yaml new file mode 100644 index 0000000..358c753 --- /dev/null +++ b/dind.yaml @@ -0,0 +1,12 @@ +services: + dind: + image: docker.io/library/docker:dind + privileged: true + volumes: + - docker-run:/var/run/dind + - .:/wooposex + environment: + DOCKER_HOST: 'unix:///var/run/dind/docker.sock' + +volumes: + docker-run: diff --git a/dogfood.yaml b/dogfood.yaml new file mode 100644 index 0000000..037607a --- /dev/null +++ b/dogfood.yaml @@ -0,0 +1,20 @@ +include: + - dind.yaml + +services: + wooposex: + image: woodpeckerci/woodpecker-cli:latest + command: exec + restart: never + working_dir: /wooposex + depends_on: + dind: + condition: service_started + network_mode: none + volumes: + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + - docker-run:/var/run/dind + - .:/wooposex:ro + environment: + DOCKER_HOST: 'unix:///var/run/dind/docker.sock' diff --git a/env-example b/env-example new file mode 100644 index 0000000..009e4bc --- /dev/null +++ b/env-example @@ -0,0 +1 @@ +POSTGRES_WOODPECKER_PATH=/home/user/projekt/cberg/wooposex/testdata \ No newline at end of file diff --git a/postgres.yaml b/postgres.yaml new file mode 100644 index 0000000..207aea1 --- /dev/null +++ b/postgres.yaml @@ -0,0 +1,25 @@ +services: + woodpecker-db: + image: docker.io/library/postgres:16-alpine3.20 + restart: unless-stopped + environment: + POSTGRES_PASSWORD: ${POSTGRES_WOODPECKER_PW} + POSTGRES_USER: woodpecker + POSTGRES_DB: woodpecker + POSTGRES_INITDB_ARGS: --encoding=UTF-8 --lc-collate=C --lc-ctype=C + network_mode: none + volumes: + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + - type: 'volume' + source: postgres_run + target: /var/run/postgresql/ + - postgres_data:/var/lib/postgresql/data + healthcheck: + test: ["CMD", "pg_isready", "-U", "woodpecker", "-d", "woodpecker"] + interval: 10s + timeout: 5s + retries: 5 + +volumes: + postgres_run: diff --git a/server.yaml b/server.yaml new file mode 100644 index 0000000..21060ef --- /dev/null +++ b/server.yaml @@ -0,0 +1,19 @@ +services: + woodpecker-server: + image: woodpeckerci/woodpecker-server:latest + network_mode: none + depends_on: + woodpecker-db: + condition: service_healthy + volumes: + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + - /opt/specht/server/data:/var/lib/woodpecker/ + environment: + - WOODPECKER_OPEN=false + - WOODPECKER_HOST=${WOODPECKER_HOST} + - WOODPECKER_FORGEJO=true + - WOODPECKER_FORGEJO_URL=YOUR_FORGEJO_URL + - WOODPECKER_FORGEJO_CLIENT=YOUR_FORGEJO_CLIENT + - WOODPECKER_FORGEJO_SECRET=YOUR_FORGEJO_CLIENT_SECRET + - WOODPECKER_AGENT_SECRET=${WOODPECKER_AGENT_SECRET}