commit 1f193f18a88030a5a5f9523140775973b83f7c68 Author: 3wc <3wc@doesthisthing.work> Date: Thu May 30 21:54:02 2024 -0500 Initial import diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..338c49b --- /dev/null +++ b/compose.yml @@ -0,0 +1,24 @@ +--- +version: "3.8" + +services: + app: + image: nginx:1.19.2 + networks: + - proxy + deploy: + restart_policy: + condition: on-failure + labels: + - "traefik.enable=true" + - "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80" + - "traefik.http.routers.${STACK_NAME}.rule=host(`${DOMAIN}`) && PathPrefix(`/coop-cloud/`)" + - "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure" + - "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}" + - "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect-aliases@docker" + - "traefik.http.middlewares.${STACK_NAME}-redirect-aliases.redirectregex.regex=^https://${DOMAIN}/coop-cloud/(.*)" + - "traefik.http.middlewares.${STACK_NAME}-redirect-aliases.redirectregex.replacement=https://${TARGET_DOMAIN}/coop-cloud/$${1}" + +networks: + proxy: + external: true diff --git a/makefile b/makefile new file mode 100644 index 0000000..552d887 --- /dev/null +++ b/makefile @@ -0,0 +1,5 @@ +deploy: + @DOCKER_CONTEXT=swarm.autonomic.zone \ + docker stack rm ${STACK_NAME} && \ + DOCKER_CONTEXT=swarm.autonomic.zone \ + docker stack deploy -c compose.yml ${STACK_NAME} diff --git a/scripts/gitea-archive-org-repos.sh b/scripts/gitea-archive-org-repos.sh new file mode 100755 index 0000000..6187c21 --- /dev/null +++ b/scripts/gitea-archive-org-repos.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +echo "Archiving repos in: $1" + +GITEA_TOKEN=e21ba81d24ea0cea298eca47d0437411def37c66 +GITEA_URL="https://git.autonomic.zone/api/v1" + +REPOS=$(http \ + "$GITEA_URL/orgs/$1/repos/?page=3" \ + Authorization:"token $GITEA_TOKEN" \ + | jq -r '.[].name') +for repo in $REPOS; do + echo "$repo" + http PATCH \ + "$GITEA_URL/repos/$1/$repo" \ + Authorization:"token $GITEA_TOKEN" \ + archived:="true" +done diff --git a/scripts/gitea-delete-org-repos.sh b/scripts/gitea-delete-org-repos.sh new file mode 100755 index 0000000..48ff5fe --- /dev/null +++ b/scripts/gitea-delete-org-repos.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +echo "Deleting repos in: $1" + +GITEA_TOKEN=e21ba81d24ea0cea298eca47d0437411def37c66 +REPOS=$(http \ + "https://git.coopcloud.tech/api/v1/orgs/$1/repos?limit=100" \ + Authorization:"token $GITEA_TOKEN" \ + | jq -r '.[].name') +for repo in $REPOS; do + echo "$repo" + http DELETE \ + https://git.coopcloud.tech/api/v1/repos/$1/$repo \ + Authorization:"token $GITEA_TOKEN" +done diff --git a/scripts/gitea-delete-org.sh b/scripts/gitea-delete-org.sh new file mode 100755 index 0000000..9a625ad --- /dev/null +++ b/scripts/gitea-delete-org.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +echo "Deleting org: $1" + +GITEA_TOKEN=e21ba81d24ea0cea298eca47d0437411def37c66 +http \ + DELETE \ + "https://git.coopcloud.tech/api/v1/orgs/$1" \ + Authorization:"token $GITEA_TOKEN" diff --git a/scripts/gitea-delete-users.sh b/scripts/gitea-delete-users.sh new file mode 100755 index 0000000..043c1d2 --- /dev/null +++ b/scripts/gitea-delete-users.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +echo "Deleting user: $1" + +GITEA_TOKEN=e21ba81d24ea0cea298eca47d0437411def37c66 +http \ + DELETE \ + "https://git.coopcloud.tech/api/v1/admin/users/$1" \ + Authorization:"token $GITEA_TOKEN"