~comcloudway/ansible-ccw.icu

fe135ffaadbf148de4971cb50a79615ad06000de — Jakob Meier 1 year, 1 month ago ac1e786
Renamed calckey to firefish
10 files changed, 84 insertions(+), 82 deletions(-)

D roles/containers/calckey/README.org
D roles/containers/calckey/defaults/main.yml
A roles/containers/firefish/README.org
A roles/containers/firefish/defaults/main.yml
R roles/containers/{calckey/tasks/caddy.yml => firefish/tasks/caddy.yml}
R roles/containers/{calckey/tasks/main.yml => firefish/tasks/main.yml}
R roles/containers/{calckey/tasks/setup.yml => firefish/tasks/setup.yml}
R roles/containers/{calckey/templates/calckey.conf => firefish/templates/firefish.conf}
R roles/containers/{calckey/templates/sonic.conf => firefish/templates/sonic.conf}
M run.yml
D roles/containers/calckey/README.org => roles/containers/calckey/README.org +0 -17
@@ 1,17 0,0 @@
* /roles/containers/calckey
[[https://calckey.org][Calckey]] / [[https://joinfirefish.org/][Firefish]] module.

**NOTE: This role will keep refering to everything as calckey for now, so avoid migrations**

Before using this,
you probably want to set/edit the following variables
in your ~secret.yml~ (or your unencrypted config):
#+begin_src yaml
calckey_project_dir: "world"
calckey_port: "4753"
calckey_open: "false"
calckey_domain: "{{ calckey_project_dir }}.ccw.icu"
calckey_postgres_user: ""
calckey_postgres_pass: ""
calckey_sonic_pass: ""
#+end_src

D roles/containers/calckey/defaults/main.yml => roles/containers/calckey/defaults/main.yml +0 -9
@@ 1,9 0,0 @@
---
calckey_project_dir: world
calckey_port: "4753"
calckey_open: "false"
calckey_domain: "{{ calckey_project_dir }}.ccw.icu"
calckey_postgres_pass: ""
calckey_postgres_user: ""
calckey_sonic_pass: ""
calckey_id: aid

A roles/containers/firefish/README.org => roles/containers/firefish/README.org +16 -0
@@ 0,0 1,16 @@
* /roles/containers/firefish

[[https://joinfirefish.org/][Firefish]] module.

Before using this,
you probably want to set/edit the following variables
in your ~secret.yml~ (or your unencrypted config):
#+begin_src yaml
firefish_project_dir: "world"
firefish_port: "4753"
firefish_open: "false"
firefish_domain: "{{ firefish_project_dir }}.ccw.icu"
firefish_postgres_user: ""
firefish_postgres_pass: ""
firefish_sonic_pass: ""
#+end_src

A roles/containers/firefish/defaults/main.yml => roles/containers/firefish/defaults/main.yml +9 -0
@@ 0,0 1,9 @@
---
firefish_project_dir: world
firefish_port: "4753"
firefish_open: "false"
firefish_domain: "{{ firefish_project_dir }}.ccw.icu"
firefish_postgres_pass: ""
firefish_postgres_user: ""
firefish_sonic_pass: ""
firefish_id: aid

R roles/containers/calckey/tasks/caddy.yml => roles/containers/firefish/tasks/caddy.yml +7 -7
@@ 1,22 1,22 @@
---
- name: Make sure calckey-caddy reverse proxy config exists
- name: Make sure firefish-caddy reverse proxy config exists
  become: true
  vars:
    project_domain: "{{ calckey_domain }}"
    project_port: "{{ calckey_port }}"
    project_domain: "{{ firefish_domain }}"
    project_port: "{{ firefish_port }}"
  ansible.builtin.template:
    src: ../../../network/caddy/templates/reverse-proxy.template
    mode: "0644"
    dest: /etc/caddy/calckey
    dest: /etc/caddy/firefish
    validate: caddy validate --adapter caddyfile --config %s

- name: Make sure caddy links to the calckey config
- name: Make sure caddy links to the firefish config
  become: true
  ansible.builtin.lineinfile:
    path: /etc/caddy/Caddyfile
    search_string: ^import /etc/caddy/calckey
    search_string: ^import /etc/caddy/firefish
    mode: "0644"
    line: import /etc/caddy/calckey
    line: import /etc/caddy/firefish
    validate: caddy validate --adapter caddyfile --config %s

- name: Restart caddy

R roles/containers/calckey/tasks/main.yml => roles/containers/firefish/tasks/main.yml +2 -2
@@ 1,5 1,5 @@
---
- name: Setup calckey docker images
- name: Setup firefish docker images
  ansible.builtin.include_tasks: setup.yml
- name: Setup calckey reverse proxy
- name: Setup firefish reverse proxy
  ansible.builtin.include_tasks: caddy.yml

R roles/containers/calckey/tasks/setup.yml => roles/containers/firefish/tasks/setup.yml +37 -34
@@ 1,78 1,81 @@
---
- name: Ensure calckey-project-dir exists
- name: Ensure firefish-project-dir exists
  become: true
  ansible.builtin.file:
    path: "{{ container_dir }}/{{ calckey_project_dir }}"
    path: "{{ container_dir }}/{{ firefish_project_dir }}"
    state: directory
    mode: "0777"
    recurse: true

# Copy config files
- name: Ensure calckey config directory exists
- name: Ensure firefish config directory exists
  ansible.builtin.file:
    path: "{{ container_dir }}/{{ calckey_project_dir }}/.config"
    mode: "0777"
    path: "{{ container_dir }}/{{ firefish_project_dir }}/.config"
    state: directory
    recurse: true

- name: Copy calckey config to the project dir
- name: Copy firefish config to the project dir
  ansible.builtin.template:
    src: calckey.conf
    mode: "0777"
    dest: "{{ container_dir }}/{{ calckey_project_dir }}/.config/default.yml"
    src: firefish.conf
    dest: "{{ container_dir }}/{{ firefish_project_dir }}/.config/default.yml"

- name: Copy sonic config to the project dir
  ansible.builtin.template:
    src: sonic.conf
    mode: "0777"
    dest: "{{ container_dir }}/{{ calckey_project_dir }}/sonic.cfg"
    dest: "{{ container_dir }}/{{ firefish_project_dir }}/sonic.cfg"

# Setup docker images
- name: Setup calckey redis
- name: Setup firefish redis
  community.docker.docker_container:
    name: calckey_redis
    name: firefish_redis
    image: docker.io/redis:7.0-alpine
    restart_policy: unless-stopped
    volumes:
      - "{{ container_dir }}/{{ calckey_project_dir }}/redis:/data"
      - "{{ container_dir }}/{{ firefish_project_dir }}/redis:/data"

- name: Setup calckey db
- name: Setup firefish db
  community.docker.docker_container:
    name: calckey_db
    name: firefish_db
    restart_policy: unless-stopped
    image: docker.io/postgres:12.2-alpine
    volumes:
      - "{{ container_dir }}/{{ calckey_project_dir }}/db:/var/lib/postgresql/data"
      - "{{ container_dir }}/{{ firefish_project_dir }}/db:\
      /var/lib/postgresql/data"
    links:
      - calckey_redis
      - firefish_redis
    env:
      POSTGRES_PASSWORD: "{{ calckey_postgres_pass }}"
      POSTGRES_USER: "{{ calckey_postgres_user }}"
      POSTGRES_DB: calckey
      POSTGRES_PASSWORD: "{{ firefish_postgres_pass }}"
      POSTGRES_USER: "{{ firefish_postgres_user }}"
      POSTGRES_DB: firefish

- name: Setup calckey sonic
- name: Setup firefish sonic
  community.docker.docker_container:
    name: calckey_sonic
    name: firefish_sonic
    restart_policy: unless-stopped
    image: docker.io/valeriansaliou/sonic:v1.4.0
    volumes:
      - "{{ container_dir }}/{{ calckey_project_dir }}/sonic:/var/lib/sonic/store"
      - "{{ container_dir }}/{{ calckey_project_dir }}/sonic.cfg:/etc/sonic.cfg"
      - "{{ container_dir }}/{{ firefish_project_dir }}/sonic:\
      /var/lib/sonic/store"
      - "{{ container_dir }}/{{ firefish_project_dir }}/sonic.cfg:\
      /etc/sonic.cfg"
    links:
      - calckey_db
      - firefish_db

- name: Setup calckey web
- name: Setup firefish web
  community.docker.docker_container:
    name: calckey_web
    name: firefish_web
    restart_policy: unless-stopped
    #image: registry.joinfirefish.org/firefish/firefish:v1.0.3
    image: codeberg.org/comcloudway/firefish-docker:latest
    ports:
      - "{{ calckey_port }}:3000"
      - "{{ firefish_port }}:3000"
    volumes:
      - "{{ container_dir }}/{{ calckey_project_dir }}/files:/firefish/files"
      - "{{ container_dir }}/{{ calckey_project_dir }}/.config:/firefish/.config:ro"
      - "{{ container_dir }}/{{ firefish_project_dir }}/files:/firefish/files"
      - "{{ container_dir }}/{{ firefish_project_dir }}/.config:\
      /firefish/.config:ro"
    links:
      - calckey_sonic
      - calckey_db
      - calckey_redis
      - firefish_sonic
      - firefish_db
      - firefish_redis
    env:
      NODE_ENV: production

R roles/containers/calckey/templates/calckey.conf => roles/containers/firefish/templates/firefish.conf +8 -8
@@ 8,7 8,7 @@
#───┘ URL └─────────────────────────────────────────────────────

# Final accessible URL seen by a user.
url: https://{{ calckey_domain }}/
url: https://{{ firefish_domain }}/

#   ┌───────────────────────┐
#───┘ Port and TLS settings └───────────────────────────────────


@@ 33,15 33,15 @@ port: 3000
#───┘ PostgreSQL configuration └────────────────────────────────

db:
  host: calckey_db
  host: firefish_db
  port: 5432
  #ssl: false
  # Database name
  db: calckey

  # Auth
  user: {{ calckey_postgres_user }}
  pass: {{ calckey_postgres_pass }}
  user: {{ firefish_postgres_user }}
  pass: {{ firefish_postgres_pass }}

  # Whether disable Caching queries
  #disableCache: true


@@ 56,7 56,7 @@ db:
#───┘ Redis configuration └─────────────────────────────────────

redis:
  host: calckey_redis
  host: firefish_redis
  port: 6379
  #tls:
  #  host: localhost


@@ 96,9 96,9 @@ redis:
#───┘ Sonic configuration └─────────────────────────────────────

sonic:
  host: calckey_sonic
  host: firefish_sonic
  port: 1491
  auth: {{ calckey_sonic_pass }}
  auth: {{ firefish_sonic_pass }}
  collection: notes
  bucket: default



@@ 106,7 106,7 @@ sonic:
#   ┌───────────────┐
#───┘ ID generation └───────────────────────────────────────────

id: {{ calckey_id }}
id: {{ firefish_id }}
# No need to uncomment in most cases, but you may want to change
# these settings if you plan to run a large and/or distributed server.


R roles/containers/calckey/templates/sonic.conf => roles/containers/firefish/templates/sonic.conf +1 -1
@@ 14,7 14,7 @@ log_level = "debug"
inet = "0.0.0.0:1491"
tcp_timeout = 300

auth_password = "{{ calckey_sonic_pass }}"
auth_password = "{{ firefish_sonic_pass }}"

[channel.search]


M run.yml => run.yml +4 -4
@@ 45,12 45,12 @@
  roles:
    - role: containers/forgejo-runner
      tags: forgejo-runner
# Setup Calckey
- name: Setup Calckey
# Setup Firefish
- name: Setup Firefish
  hosts: all
  roles:
    - role: containers/calckey
      tags: calckey
    - role: containers/firefish
      tags: firefish
# Setup Uptime Kuma
- name: Setup Uptime Kuma
  hosts: all