diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..98eff6c --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,11 @@ +name: deploy +on: + push: + branches: [master] +jobs: + main: + runs-on: ubuntu-latest + steps: + - run: install -m 700 -d ~/.ssh + - run: install -m 600 <(echo '${{ secrets.DEPLOY_KEY }}') ~/.ssh/deploy_key + - run: ssh -i ~/.ssh/deploy_key -o 'StrictHostKeyChecking no' kou029w@keiu.net 'sh -c "cd ~/keiu.net && git pull --rebase && docker-compose up -d"' diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..79bb43f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/.env +/etc/postgres/initdb.d/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..ff1ddd8 --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# ほんの少し降る雨 + +## 前提 + +- Docker Compose +- systemd-journald + +Git リポジトリを取得し、 /etc/docker/daemon.json を配置 + +```sh +ssh kou029w@keiu.net +git clone git@github.com:kou029w/keiu.net.git +cd keiu.net +sudo tee /etc/docker/daemon.json < etc/docker/daemon.json +``` + +## 構築 + +```sh +echo POSTGRES_PASSWORD=$(python3 -c 'import secrets; print(secrets.token_urlsafe())') >> .env +chmod 600 .env +docker-compose up -d +``` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..dd79984 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,42 @@ +version: "3" +services: + https: + image: caddy:2.4.3-alpine + restart: unless-stopped + ports: + - "80:80" + - "443:443" + volumes: + - ./etc/caddy:/etc/caddy + - caddy_data:/data + - caddy_config:/config + - minicharge_tmp:/tmp/minicharge + minicharge: + image: miniflux/miniflux:2.0.31 + restart: unless-stopped + environment: + LISTEN_ADDR: /tmp/miniflux.sock + DATABASE_URL: postgresql://postgres:${POSTGRES_PASSWORD}@/postgres?host=/tmp/postgresql + volumes: + - minicharge_tmp:/tmp + - postgres_tmp:/tmp/postgresql + depends_on: + db: + condition: service_healthy + db: + image: postgres:13.3-alpine + restart: unless-stopped + healthcheck: + test: pg_isready + environment: + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + volumes: + - ./etc/postgres/initdb.d:/docker-entrypoint-initdb.d + - postgres_tmp:/var/run/postgresql + - postgres_data:/var/lib/postgresql/data +volumes: + caddy_data: + caddy_config: + minicharge_tmp: + postgres_tmp: + postgres_data: diff --git a/etc/caddy/Caddyfile b/etc/caddy/Caddyfile new file mode 100644 index 0000000..64c138b --- /dev/null +++ b/etc/caddy/Caddyfile @@ -0,0 +1,9 @@ +keiu.net { + respond "WIP" +} +www.keiu.net { + redir https://keiu.net{uri} 308 +} +minicharge.keiu.net { + reverse_proxy unix//tmp/minicharge/miniflux.sock +} diff --git a/etc/docker/daemon.json b/etc/docker/daemon.json new file mode 100644 index 0000000..b73dceb --- /dev/null +++ b/etc/docker/daemon.json @@ -0,0 +1,4 @@ +{ + "live-restore": true, + "log-driver": "journald" +} diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..347ecf5 --- /dev/null +++ b/renovate.json @@ -0,0 +1,10 @@ +{ + "extends": [ + "config:base", + ":automergeAll", + ":automergeBranch", + ":skipStatusChecks", + "docker:enableMajor", + "docker:pinDigests" + ] +}