Compare commits

..

No commits in common. "267b3b1078b1a3fb82ff14f0cfb469d31d218e20" and "f6f6b2c2f1de61c72b5014a4d917964a1ba3ae54" have entirely different histories.

7 changed files with 30 additions and 49 deletions

29
.drone.yml Normal file
View file

@ -0,0 +1,29 @@
# yaml-language-server: $schema=https://json.schemastore.org/drone.json
name: deploy
kind: pipeline
type: docker
node:
instance: system
trigger:
event:
- push
branch:
- main
steps:
- name: deploy
image: docker:23.0.6-cli-alpine3.17@sha256:53221a6781b9360dc2965112998cfd209034f2b8cdf98bdc314dfd740bb3c845
commands:
- mkdir -p /root/.ssh
- install -v -m 600 /home/ubuntu/.ssh/id_ed25519 /root/.ssh/id_ed25519
- ssh-keyscan beta.fogtype.com >> /root/.ssh/known_hosts
- docker context create --docker=host=ssh://ubuntu@beta.fogtype.com beta
- docker context use beta
- docker compose --project-name=beta up --build --detach
- docker compose --project-directory=example up --detach
volumes:
- name: ssh_key
path: /home/ubuntu/.ssh/id_ed25519
volumes:
- name: ssh_key
host:
path: /home/ubuntu/.ssh/id_ed25519

View file

@ -1,20 +0,0 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: deploy
on:
push:
branches:
- main
jobs:
main:
runs-on: self-hosted
steps:
- run: install -m 700 -d ~/.ssh
- run: install -m 600 <(echo '${{ secrets.KNOWN_HOSTS }}') ~/.ssh/known_hosts
- # "error in libcrypto" になるので CR を除去して回避
run: install -m 600 <(echo '${{ secrets.DEPLOY_KEY }}' | tr -d '\r') ~/.ssh/id_ed25519
- run: apk add nodejs
- uses: actions/checkout@v3
- run: apk add make docker-cli-compose
- run: make setup
continue-on-error: true
- run: make deploy

2
.gitignore vendored
View file

@ -1,2 +0,0 @@
.deploy_key
.deploy_key.pub

View file

@ -1,4 +1,4 @@
FROM caddy:2.7.6-builder-alpine@sha256:2cc3adbbf1d2a62a983a23823d00a3d5ad83560344fe3a78f0cbdc38e1b606ca AS builder
FROM caddy:2.7.6-builder-alpine@sha256:6d2e8b2e24b8bf3d82e4b08535d3f7afc0c076d46cdb47b9662aaf7f043421e8 AS builder
RUN xcaddy build --with github.com/lucaslorentz/caddy-docker-proxy/v2
FROM caddy:2.7.6-alpine@sha256:eabac2898cf9fc7dc94d3fb03ac84c9c923aa6cc6f04874937d2f525e0d2f006
COPY --from=builder /usr/bin/caddy /usr/bin/caddy

View file

@ -1,13 +0,0 @@
.PHONY: setup
setup:
docker context create --docker=host=ssh://ubuntu@beta.fogtype.com beta
.PHONY: deploy
deploy: export DOCKER_CONTEXT := beta
deploy:
docker compose up --detach --remove-orphans --build
.deploy_key:
ssh-keygen -t ed25519 -C git@git.fogtype.com:nebel/beta.fogtype.com.git -f .deploy_key
ssh-copy-id -i .deploy_key.pub ubuntu@beta.fogtype.com
ssh-keyscan -t ed25519 -H beta.fogtype.com

View file

@ -30,15 +30,3 @@ ansible-playbook setup.yml
```
詳しい構成は [setup.yml](setup.yml) を参照
## Registration
```
$ make .deploy_key
```
secrets.KNOWN_HOSTS
: SSH known_hosts file
secrets.DEPLOY_KEY
: SSH identity file

View file

@ -1,4 +1,3 @@
name: beta
services:
caddy:
image: git.fogtype.com/nebel/caddy-docker-proxy