inital setup

This commit is contained in:
2023-06-11 10:15:24 +02:00
parent 718e340450
commit 2c57a59e15
6 changed files with 133 additions and 1 deletions

10
.drone.env.sample Normal file
View File

@@ -0,0 +1,10 @@
# Drone settings
DRONETAG=
## https://docs.drone.io/server/provider/gitea/
DRONE_GITEA_SERVER=https://git.example.com
DRONE_GITEA_CLIENT_ID=
DRONE_GITEA_CLIENT_SECRET=
DRONE_RPC_SECRET=
DRONE_SERVER_HOST=ci.example.com
DRONE_SERVER_PROTO=https

1
.env.sample Normal file
View File

@@ -0,0 +1 @@
BASEDIR=

8
.git.env.sample Normal file
View File

@@ -0,0 +1,8 @@
# gitea settings
GITTAG=
USER_UID=1000
USER_GID=1000
## preconfig for app.ini
## https://github.com/go-gitea/gitea/tree/main/contrib/environment-to-ini

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
files/
*.env

View File

@@ -1,2 +1,60 @@
# compose-gitea
# Basic git & drone docker-compose config
* can be run on single node setup or in swarm
## howto
### single node
#### start container
```bash
docker compose up -d
```
#### stop container (and remove)
```bash
docker compose down
```
#### view logs
```bash
docker compose logs -f
```
#### reload config
```bash
docker compose restart
```
### swarm
#### start aka deploy
hint: drone fails to start until git auth source is created and set in vars
```bash
docker stack deploy -c docker-compose.yml git
```
#### stop container aka service
```bash
docker service rm git_git
docker service rm git_drone
```
#### view logs
```bash
docker service logs git_git -f
docker service logs git_drone -f
```
#### reload config (no downtime if replica 2 or more)
```bash
docker service update git_git --force
docker service update git_drone --force
```
## example caddy config
```
git.example.com {
reverse_proxy git:80
}
ci.example.com {
reverse_proxy drone:80
}
```

53
docker-compose.yml Normal file
View File

@@ -0,0 +1,53 @@
# https://docs.docker.com/compose/compose-file/compose-file-v3/
---
version: "3.9"
services:
git:
image: gitea/gitea:${GITTAG:-latest}
container_name: git
env_file:
- .git.env
- .env
restart: unless-stopped
ports:
- 3000:3000
deploy:
replicas: 1
placement:
max_replicas_per_node: 1
update_config:
parallelism: 1
delay: 10s
volumes:
- ${BASEDIR:-.}/files/git/:/data/
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
networks:
- backend
drone:
image: drone/drone:${DRONETAG:-latest}
container_name: drone
env_file:
- .drone.env
- .env
restart: unless-stopped
ports:
- 8080:80
- 8443:443
deploy:
replicas: 1
placement:
max_replicas_per_node: 1
update_config:
parallelism: 1
delay: 10s
volumes:
- ${BASEDIR:-.}/files/drone/:/data/
networks:
- backend
networks:
backend:
name: ${INTRANET:-backend}
external: true