IaC for a Tangled Knot
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'config'

+98
+1
config/deploy.yaml
··· 5 5 6 6 roles: 7 7 - geerlingguy.docker 8 + - knot
+9
config/roles/knot/defaults/main.yaml
··· 1 + --- 2 + knot_deploy_dir: "/opt/knot" 3 + knot_uid: "1000" 4 + knot_gid: "1000" 5 + knot_image: "tngl/knot:v1.10.0-alpha" 6 + knot_server_hostname: "example.com" 7 + knot_server_owner: "did:plc:example" 8 + knot_server_port: "443" 9 + knot_enable_caddy: false # Set to true to enable Caddy reverse proxy
+52
config/roles/knot/tasks/main.yaml
··· 1 + --- 2 + - name: Install Python dependencies for Docker modules 3 + ansible.builtin.apt: 4 + name: 5 + - python3-requests 6 + - python3-docker 7 + state: present 8 + update_cache: false 9 + 10 + - name: Create Knot deployment directory 11 + ansible.builtin.file: 12 + path: "{{ knot_deploy_dir }}" 13 + state: directory 14 + mode: "0755" 15 + 16 + - name: Create Knot data directories 17 + ansible.builtin.file: 18 + path: "{{ knot_deploy_dir }}/{{ item }}" 19 + state: directory 20 + mode: "0755" 21 + owner: "{{ knot_uid }}" 22 + group: "{{ knot_gid }}" 23 + loop: 24 + - keys 25 + - repositories 26 + - server 27 + - caddy_data 28 + 29 + - name: Create docker-compose.yml for Knot 30 + ansible.builtin.template: 31 + src: docker-compose.yml.j2 32 + dest: "{{ knot_deploy_dir }}/docker-compose.yml" 33 + mode: "0644" 34 + 35 + - name: Create .env file for Knot 36 + ansible.builtin.template: 37 + src: env.j2 38 + dest: "{{ knot_deploy_dir }}/.env" 39 + mode: "0600" 40 + 41 + - name: Pull Knot Docker image 42 + community.docker.docker_image: 43 + name: "{{ knot_image }}" 44 + source: pull 45 + 46 + - name: Deploy Knot with docker-compose 47 + community.docker.docker_compose_v2: 48 + project_src: "{{ knot_deploy_dir }}" 49 + state: present 50 + pull: "always" 51 + remove_orphans: true 52 + profiles: "{{ knot_enable_caddy | ternary(['caddy'], []) }}"
+33
config/roles/knot/templates/docker-compose.yml.j2
··· 1 + services: 2 + knot: 3 + image: {{ knot_image }} 4 + environment: 5 + KNOT_SERVER_HOSTNAME: ${KNOT_SERVER_HOSTNAME} 6 + KNOT_SERVER_OWNER: ${KNOT_SERVER_OWNER} 7 + KNOT_SERVER_DB_PATH: /app/knotserver.db 8 + KNOT_REPO_SCAN_PATH: /home/git/repositories 9 + KNOT_SERVER_INTERNAL_LISTEN_ADDR: localhost:5444 10 + volumes: 11 + - ./keys:/etc/ssh/keys 12 + - ./repositories:/home/git/repositories 13 + - ./server:/app 14 + ports: 15 + - "5555:5555" 16 + - "2222:22" 17 + restart: always 18 + frontend: 19 + image: caddy:alpine 20 + command: > 21 + caddy 22 + reverse-proxy 23 + --from ${KNOT_SERVER_HOSTNAME} 24 + --to knot:5555 25 + depends_on: 26 + - knot 27 + ports: 28 + - ${KNOT_SERVER_PORT:-443}:443 29 + - ${KNOT_SERVER_PORT:-443}:443/udp 30 + volumes: 31 + - ./caddy_data:/data 32 + restart: always 33 + profiles: ["caddy"]
+3
config/roles/knot/templates/env.j2
··· 1 + KNOT_SERVER_HOSTNAME={{ knot_server_hostname }} 2 + KNOT_SERVER_OWNER={{ knot_server_owner }} 3 + KNOT_SERVER_PORT={{ knot_server_port }}