From 82bd3303e366b916556d43428b3e2745123593c0 Mon Sep 17 00:00:00 2001 From: NeonXP Date: Sun, 7 May 2023 16:26:36 +0300 Subject: initial --- .env | 6 +++ docker-compose.yml | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++ etc/Caddyfile | 90 ++++++++++++++++++++++++++++++++++++++++++++ etc/pkg.json | 60 ++++++++++++++++++++++++++++++ 4 files changed, 263 insertions(+) create mode 100644 .env create mode 100644 docker-compose.yml create mode 100644 etc/Caddyfile create mode 100644 etc/pkg.json diff --git a/.env b/.env new file mode 100644 index 0000000..59270a6 --- /dev/null +++ b/.env @@ -0,0 +1,6 @@ +PG_NAME=gitea +PG_USER=gitea +PG_PASS=gitea +GITEA_CLIENT= +GITEA_SECRET= +WOODPECKER_AGENT_SECRET=Eeshi9aechooh4Ae \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c839302 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,107 @@ +version: "3" + +services: + caddy: + image: caddy:2.6.2-alpine + container_name: gateway + restart: unless-stopped + ports: + - "80:80" + - "443:443" + - "443:443/udp" + volumes: + - /var/volumes/configs/Caddyfile:/etc/caddy/Caddyfile + - caddy_data:/data + - /var/volumes/configs:/config + networks: + - gateway + + git: + image: codeberg.org/forgejo/forgejo:1.19.3-0 + container_name: git + environment: + - USER_UID=1000 + - USER_GID=1000 + - TZ=Europe/Moscow + - USER=git + - GITEA__database__DB_TYPE=postgres + - GITEA__database__HOST=db:5432 + - GITEA__database__NAME=${PG_NAME} + - GITEA__database__USER=${PG_USER} + - GITEA__database__PASSWD=${PG_PASS} + restart: always + networks: + - gitea + - gateway + volumes: + - /home/git/.ssh/:/data/git/.ssh + - /var/volumes/forge:/data + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + ports: + - "127.0.0.1:2222:22" + depends_on: + db: + condition: service_healthy + + db: + image: postgres:13 + restart: always + environment: + - POSTGRES_USER=${PG_USER} + - POSTGRES_PASSWORD=${PG_PASS} + - POSTGRES_DB=${PG_NAME} + healthcheck: + test: /usr/bin/pg_isready + interval: 5s + timeout: 10s + retries: 120 + networks: + - gitea + volumes: + - /var/volumes/postgres:/var/lib/postgresql/data + + woodpecker-server: + image: woodpeckerci/woodpecker-server:latest + volumes: + - woodpecker-server-data:/var/lib/woodpecker/ + environment: + - WOODPECKER_OPEN=true + - WOODPECKER_GITEA=true + - WOODPECKER_GITEA_URL=https://gitrepo.ru + - WOODPECKER_GITEA_CLIENT=${GITEA_CLIENT} + - WOODPECKER_GITEA_SECRET=${GITEA_SECRET} + - WOODPECKER_HOST=https://ci.gitrepo.ru + - WOODPECKER_ADMIN=neonxp + - WOODPECKER_AGENT_SECRET=${WOODPECKER_AGENT_SECRET} + networks: + - gitea + - gateway + depends_on: + - git + + woodpecker-agent: + image: woodpeckerci/woodpecker-agent:latest + command: agent + restart: always + depends_on: + - woodpecker-server + volumes: + - /var/run/docker.sock:/var/run/docker.sock + environment: + - WOODPECKER_SERVER=woodpecker-server:9000 + - WOODPECKER_AGENT_SECRET=${WOODPECKER_AGENT_SECRET} + networks: + - gitea + +volumes: + woodpecker-server-data: + caddy_data: + caddy_config: + forgejo: + postgres: + +networks: + gateway: + gitea: + external: false diff --git a/etc/Caddyfile b/etc/Caddyfile new file mode 100644 index 0000000..f85445b --- /dev/null +++ b/etc/Caddyfile @@ -0,0 +1,90 @@ +:80 { + root * /usr/share/caddy + file_server +} +gitrepo.ru { + reverse_proxy git:3000 +} +ci.gitrepo.ru { + reverse_proxy woodpecker-server:8000 +} +# goproxy.ru { +# reverse_proxy localhost:8081 +# } + +go.neonxp.dev { + reverse_proxy goproxy:8080 +} + +neonxp.dev { + tls i@neonxp.dev + encode gzip + root * /var/www/neonxp.dev/public + file_server + header / { + Content-Security-Policy = "upgrade-insecure-requests; default-src 'self'; style-src 'self'; script-src 'self'; img-src 'self'; object-src 'self'; worker-src 'self'; manifest-src 'self';" + Strict-Transport-Security = "max-age=63072000; includeSubDomains; preload" + X-Xss-Protection = "1; mode=block" + X-Frame-Options = "DENY" + X-Content-Type-Options = "nosniff" + Referrer-Policy = "strict-origin-when-cross-origin" + Permissions-Policy = "fullscreen=(self)" + cache-control = "max-age=0,no-cache,no-store,must-revalidate" + } + log { + output file /var/log/caddy/neonxp.dev/neonxp.dev.log + } +} + +timer.neonxp.dev { + tls i@neonxp.dev + encode gzip + root * /var/www/timer.neonxp.dev + file_server + header / { + Content-Security-Policy = "upgrade-insecure-requests; default-src 'self'; style-src 'self'; script-src 'self'; img-src 'self'; object-src 'self'; worker-src 'self'; manifest-src 'self';" + Strict-Transport-Security = "max-age=63072000; includeSubDomains; preload" + X-Xss-Protection = "1; mode=block" + X-Frame-Options = "DENY" + X-Content-Type-Options = "nosniff" + Referrer-Policy = "strict-origin-when-cross-origin" + Permissions-Policy = "fullscreen=(self)" + cache-control = "max-age=0,no-cache,no-store,must-revalidate" + } + log { + output file /var/log/caddy/neonxp.dev/timer.neonxp.dev.log + } +} + +files.neonxp.dev { + tls i@neonxp.dev + encode gzip + root * /files + file_server { + browse + } + header / { + Content-Security-Policy = "upgrade-insecure-requests; default-src 'self'; style-src 'self'; script-src 'self'; img-src 'self'; object-src 'self'; worker-src 'self'; manifest-src 'self';" + Strict-Transport-Security = "max-age=63072000; includeSubDomains; preload" + X-Xss-Protection = "1; mode=block" + X-Frame-Options = "DENY" + X-Content-Type-Options = "nosniff" + Referrer-Policy = "strict-origin-when-cross-origin" + Permissions-Policy = "fullscreen=(self)" + cache-control = "max-age=0,no-cache,no-store,must-revalidate" + } + log { + output file /var/log/caddy/neonxp.dev/files.neonxp.dev.log + } +} + +1flash.ru { + tls i@neonxp.dev + reverse_proxy localhost:8082 +} + +oper2.ru { + tls i@neonxp.dev + redir * https://remember-botsyk.livejournal.com/ 302 +} +# https://caddyserver.com/docs/caddyfile diff --git a/etc/pkg.json b/etc/pkg.json new file mode 100644 index 0000000..62227d3 --- /dev/null +++ b/etc/pkg.json @@ -0,0 +1,60 @@ +{ + "title": "Пакеты NeonXP", + "host": "go.neonxp.dev", + "packages": { + "pkg": { + "pkg": "pkg", + "vcs": "git", + "repo": "https://github.com/neonxp/pkg", + "desc": "Сервер проксирующий собственные гошные пакеты, чтобы не зависеть от конкретного репозитория. Этот сайт." + }, + "objectid": { + "pkg": "objectid", + "vcs": "git", + "repo": "https://github.com/neonxp/objectid", + "desc": "Генерация ObjectID на основе даты. Глобально уникальные." + }, + "jsonrpc2": { + "pkg": "jsonrpc2", + "vcs": "git", + "repo": "https://github.com/neonxp/jsonrpc2", + "desc": "Имплементация сервера JSON-RPC 2.0 с генериками." + }, + "collection": { + "pkg": "collection", + "vcs": "git", + "repo": "https://github.com/neonxp/collection", + "desc": "Коллекция методов для работы с коллекциями" + }, + "cluster": { + "pkg": "cluster", + "vcs": "git", + "repo": "https://github.com/neonxp/go-cluster", + "desc": "p2p cluster" + }, + "extra": { + "pkg": "extra", + "vcs": "git", + "repo": "https://github.com/neonxp/extra", + "desc": "Пакет с разными полезными функциями без дополнительных зависимостей." + }, + "di": { + "pkg": "di", + "vcs": "git", + "repo": "https://github.com/neonxp/di", + "desc": "Простой DI контейнер с генериками" + }, + "expression": { + "pkg": "expression", + "vcs": "git", + "repo": "https://github.com/neonxp/expression", + "desc": "Парсер и исполнитель произвольных выражений" + }, + "json": { + "pkg": "json", + "vcs": "git", + "repo": "https://github.com/neonxp/json", + "desc": "Библиотека маршалинга анмаршалинга json в дерево с возможностью делать запросы над деревом" + } + } +} \ No newline at end of file -- cgit v1.2.3