diff --git a/README.md b/README.md index 45f183b..e56a87b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ Before using this playbook, the target hosts must have: -- Public key of control node in ~/.ssh/id_rsa.pub -- Passwordless sudo enabled (see: ) \ No newline at end of file +- Public key of control node in ~/.ssh/authorized_keys +- Passwordless sudo enabled (see: ) +- Docker installed +- Add user to docker group + +On this local machine: +- Create docker context for the remote host \ No newline at end of file diff --git a/Caddyfile b/caddy/Caddyfile similarity index 72% rename from Caddyfile rename to caddy/Caddyfile index e9f7377..00767d8 100644 --- a/Caddyfile +++ b/caddy/Caddyfile @@ -6,4 +6,8 @@ test1.tingker.ddns.net { test2.tingker.ddns.net { file_server root * /var/www/html/test2 +} + +git.tingker.ddns.net { + reverse_proxy gitea:3000 } \ No newline at end of file diff --git a/test1.html b/caddy/test1.html similarity index 100% rename from test1.html rename to caddy/test1.html diff --git a/test2.html b/caddy/test2.html similarity index 100% rename from test2.html rename to caddy/test2.html diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ab67553 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,41 @@ +volumes: + postgres: + driver: local + gitea: + driver: local +services: + caddy: + image: caddy:2-alpine + ports: + - 80:80 + - 443:443 + volumes: + - ./caddy/Caddyfile:/etc/caddy/Caddyfile + - ./caddy/test1.html:/var/www/html/test1/index.html + - ./caddy/test2.html:/var/www/html/test2/index.html + + postgres: + image: postgres:18-alpine + environment: + POSTGRES_PASSWORD: postgres + volumes: + - postgres:/var/lib/postgresql/18/docker + - ./postgres/init.sql:/docker-entrypoint-initdb.d/init.sql + + gitea: + image: docker.gitea.com/gitea:1.26.1 + environment: + - GITEA__database__DB_TYPE=postgres + - GITEA__database__HOST=postgres + - GITEA__database__NAME=giteadb + - GITEA__database__USER=gitea + - GITEA__database__PASSWD=gitea + depends_on: + - postgres + volumes: + - gitea:/data + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + ports: + - "2222:22" + diff --git a/inventory.yaml b/inventory.yaml deleted file mode 100644 index 29d0772..0000000 --- a/inventory.yaml +++ /dev/null @@ -1,3 +0,0 @@ -homelab: - hosts: - rosebook.local: \ No newline at end of file diff --git a/mise.toml b/mise.toml deleted file mode 100644 index 32229ea..0000000 --- a/mise.toml +++ /dev/null @@ -1,2 +0,0 @@ -[tools] -python = "3" diff --git a/playbook.yaml b/playbook.yaml deleted file mode 100644 index 5535c74..0000000 --- a/playbook.yaml +++ /dev/null @@ -1,35 +0,0 @@ -- name: Caddy - hosts: rosebook.local - become: true - tasks: - - name: Install Caddy - ansible.builtin.apt: - name: caddy - state: present - - name: Create Caddyfile - ansible.builtin.copy: - dest: /etc/caddy/Caddyfile - src: Caddyfile - - name: Web directory - ansible.builtin.file: - path: /var/www/html/test1 - state: directory - mode: '0755' - - name: Web directory - ansible.builtin.file: - path: /var/www/html/test2 - state: directory - mode: '0755' - - name: Static website - ansible.builtin.copy: - dest: /var/www/html/test1/index.html - src: test1.html - - name: Static website - ansible.builtin.copy: - dest: /var/www/html/test2/index.html - src: test2.html - - name: Enable and start service - ansible.builtin.service: - name: caddy - enabled: true - state: restarted \ No newline at end of file diff --git a/postgres/init.sql b/postgres/init.sql new file mode 100644 index 0000000..3c6c2f2 --- /dev/null +++ b/postgres/init.sql @@ -0,0 +1,3 @@ +CREATE ROLE gitea WITH LOGIN PASSWORD 'gitea'; +CREATE DATABASE giteadb WITH OWNER gitea TEMPLATE template0 ENCODING UTF8 LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8'; +GRANT ALL PRIVILEGES ON DATABASE giteadb TO gitea; \ No newline at end of file