diff --git a/.env.dist b/.env.dist new file mode 100644 index 0000000..cc842d8 --- /dev/null +++ b/.env.dist @@ -0,0 +1,8 @@ +GITEA_VERSION=latest +GITEA_HOSTNAME=localhost +GITEA_WEB_PORT=3000 +GITEA_SSH_PORT=2222 +MYSQL_ROOT_PASSWORD=root +MYSQL_DATABASE=gitea +MYSQL_USER=gitea +MYSQL_PASSWORD=gitea \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..815a055 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.idea +.env +volumes/gitea* +uptime-kuma-data/ +docker-gitea.service diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b1e06ad --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,64 @@ +version: '2' +volumes: + app: + db: +services: + uptime-kuma: + image: louislam/uptime-kuma:1 + container_name: uptime-kuma + restart: always + ports: + - "3001:3001" + volumes: + - ./uptime-kuma-data:/app/data # Mounts a local folder + app: + container_name: gitea-app + restart: always + image: gitea/gitea:${GITEA_VERSION} + links: + - db:mysql + volumes: + - ./volumes/gitea_app:/data + ports: + # - "${GITEA_SSH_PORT}:22" + - "${GITEA_WEB_PORT}:3000" + environment: + - VIRTUAL_PORT=3000 + - VIRTUAL_HOST=${GITEA_HOSTNAME} + networks: + - backend + - frontend + db: + container_name: gitea-db + restart: always + image: mysql:8.0 + #security_opt: + # - seccomp:unconfined + cap_add: [ SYS_NICE ] + volumes: + - ./volumes/gitea_db:/var/lib/mysql + environment: + - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} + - MYSQL_DATABASE=${MYSQL_DATABASE} + - MYSQL_USER=${MYSQL_USER} + - MYSQL_PASSWORD=${MYSQL_PASSWORD} + networks: + - backend + runner: + image: gitea/act_runner + restart: always + volumes: + - ./volumes/gitea_runer/data:/data + - /var/run/docker.sock:/var/run/docker.sock + environment: + - GITEA_INSTANCE_URL=https://tea.michaelfisher.tech + # When using Docker Secrets, it's also possible to use + # GITEA_RUNNER_REGISTRATION_TOKEN_FILE to pass the location. + # The env var takes precedence. + # Needed only for the first start. + - GITEA_RUNNER_REGISTRATION_TOKEN=Oz1D8F9nEv0eNh7BSfkxgIlQtnawZmSaqoLiJdb8 + + +networks: + frontend: + backend: diff --git a/docker-gitea.service.dist b/docker-gitea.service.dist new file mode 100644 index 0000000..cc300c7 --- /dev/null +++ b/docker-gitea.service.dist @@ -0,0 +1,22 @@ +[Unit] +Description=docker-gitea +Requires=docker.service +After=docker.service + +[Service] +Restart=always + +WorkingDirectory=/opt/docker-compose-gitea/ + +# Remove old containers, images and volumes +ExecStartPre=/usr/local/bin/docker-compose down -v +ExecStartPre=/usr/local/bin/docker-compose rm -v + +# Compose up +ExecStart=/usr/local/bin/docker-compose up + +# Compose down, remove containers and volumes +ExecStop=/usr/local/bin/docker-compose down -v + +[Install] +WantedBy=multi-user.target diff --git a/uptime-kuma-data/.gitkeep b/uptime-kuma-data/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/volumes/.gitkeep b/volumes/.gitkeep new file mode 100644 index 0000000..e69de29