1
0

Добавил Gitea для хранения кода

This commit is contained in:
Anton Vakhrushev 2023-06-19 11:54:05 +03:00
parent 20739ccc24
commit c9c58a6c43
Signed by: av
GPG Key ID: 581F7473F7A21FA2
6 changed files with 76 additions and 0 deletions

View File

@ -9,6 +9,7 @@
wiki_port: "{{ base_port + 5 }}"
nomie_port: "{{ base_port + 6 }}"
nomie_db_port: "{{ base_port + 7 }}"
gitea_port: "{{ base_port + 8 }}"
vars_files:
- vars/vars.yml
@ -148,3 +149,22 @@
COUCH_DB_PASSWORD: '{{ nomie.couch_db_password }}'
tags:
- apps
- import_role:
name: docker-app
vars:
username: gitea
extra_groups:
- docker
ssh_keys:
- '{{ lookup("file", "files/av_id_rsa.pub") }}'
env:
PROJECT_NAME: gitea
DOCKER_PREFIX: gitea
IMAGE_PREFIX: gitea
CONTAINER_PREFIX: gitea
WEB_SERVER_PORT: '127.0.0.1:{{ gitea_port }}'
USER_UID: '{{ uc_result.uid }}'
USER_GID: '{{ uc_result.group }}'
tags:
- apps

View File

@ -1,3 +1,11 @@
# -------------------------------------------------------------------
# Global options
# -------------------------------------------------------------------
{
grace_period 15s
}
# -------------------------------------------------------------------
# Proxy services
# -------------------------------------------------------------------
@ -46,3 +54,11 @@ nomie-db.vakhrushev.me {
to 127.0.0.1:{{ nomie_db_port }}
}
}
git.vakhrushev.me {
tls anwinged@ya.ru
reverse_proxy {
to 127.0.0.1:{{ gitea_port }}
}
}

3
app/gitea/.env Normal file
View File

@ -0,0 +1,3 @@
WEB_SERVER_PORT=9494
USER_UID=1000
USER_GID=1000

1
app/gitea/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
data/

View File

@ -0,0 +1,16 @@
version: "3"
services:
server:
image: gitea/gitea:1.19.3
environment:
- "USER_UID=${USER_UID}"
- "USER_GID=${USER_GID}"
restart: unless-stopped
volumes:
- ./data:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "${WEB_SERVER_PORT}:3000"

20
app/gitea/tasks.py Normal file
View File

@ -0,0 +1,20 @@
from fabric import Connection
from invoke import task
import shlex
APP_NAME = "gitea"
SSH_HOST = f"{APP_NAME}@51.250.85.23"
DOCKER_REGISTRY = "cr.yandex/crplfk0168i4o8kd7ade"
@task
def deploy(c):
print("Ready to setup remote host")
with Connection(SSH_HOST) as c:
c.put(
local="docker-compose.yml",
remote=f"/home/{APP_NAME}/docker-compose.yml",
)
c.run("cp .env .env.prod")
c.run("mkdir -p data")
c.run(f"docker-compose --project-name {shlex.quote(APP_NAME)} --env-file=.env.prod up --detach --remove-orphans")