From 2136dbf7d47503a2f3e60702cad72f542c7f003e Mon Sep 17 00:00:00 2001 From: Phil Date: Tue, 22 Oct 2024 11:24:41 -0600 Subject: [PATCH] added postiz to stack and associated caddy and glance config --- roles/docker/files/Caddyfile | 4 + roles/docker/tasks/main.yml | 6 +- roles/docker/tasks/postiz.yml | 19 +++++ roles/docker/templates/glance.yml.j2 | 1 + roles/docker/templates/postiz-compose.yml.j2 | 82 ++++++++++++++++++++ 5 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 roles/docker/tasks/postiz.yml create mode 100644 roles/docker/templates/postiz-compose.yml.j2 diff --git a/roles/docker/files/Caddyfile b/roles/docker/files/Caddyfile index 17af41e..5cccaa9 100644 --- a/roles/docker/files/Caddyfile +++ b/roles/docker/files/Caddyfile @@ -2,6 +2,10 @@ auth.thesatelliteoflove.com { reverse_proxy authentik-server-1:9000 } +post.thesatelliteoflove.com { + reverse_proxy postiz:5000 +} + tasks.thesatelliteoflove.com { @allowed { remote_ip 100.64.0.0/10 diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 5de8f30..5942261 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -100,4 +100,8 @@ - name: Install pingvin import_tasks: pingvin.yml - tags: pingvin \ No newline at end of file + tags: pingvin + +- name: Install postiz + import_tasks: postiz.yml + tags: postiz \ No newline at end of file diff --git a/roles/docker/tasks/postiz.yml b/roles/docker/tasks/postiz.yml new file mode 100644 index 0000000..d426455 --- /dev/null +++ b/roles/docker/tasks/postiz.yml @@ -0,0 +1,19 @@ +- name: make postiz directories + ansible.builtin.file: + path: "{{ item}}" + state: directory + loop: + - /opt/stacks/postiz + +- name: Template out the compose file + ansible.builtin.template: + src: postiz-compose.yml.j2 + dest: /opt/stacks/postiz/compose.yml + owner: root + mode: 644 + +- name: deploy postiz stack + community.docker.docker_compose_v2: + project_src: /opt/stacks/postiz + files: + - compose.yml \ No newline at end of file diff --git a/roles/docker/templates/glance.yml.j2 b/roles/docker/templates/glance.yml.j2 index 07a5da9..426cdd9 100644 --- a/roles/docker/templates/glance.yml.j2 +++ b/roles/docker/templates/glance.yml.j2 @@ -77,6 +77,7 @@ pages: - superseriousbusiness/gotosocial - stonith404/pingvin-share - caddyserver/caddy + - gitroomhq/postiz-app - size: full widgets: - type: rss diff --git a/roles/docker/templates/postiz-compose.yml.j2 b/roles/docker/templates/postiz-compose.yml.j2 new file mode 100644 index 0000000..0799501 --- /dev/null +++ b/roles/docker/templates/postiz-compose.yml.j2 @@ -0,0 +1,82 @@ +services: + postiz: + image: ghcr.io/gitroomhq/postiz-app:latest + container_name: postiz + restart: always + environment: + # You must change these. Replace `postiz.your-server.com` with your DNS name - what your web browser sees. + MAIN_URL: "https://post.thesatelliteoflove.com" + FRONTEND_URL: "https://post.thesatelliteoflove.com" + NEXT_PUBLIC_BACKEND_URL: "https://post.thesatelliteoflove.com/api" + JWT_SECRET: "TShr6Fdcwf67wIhuUvg0gOsJbdcQmgMiJl5kUh6JCfY=" + + # These defaults are probably fine, but if you change your user/password, update it in the + # postiz-postgres or postiz-redis services below. + DATABASE_URL: "postgresql://postiz-user:postiz-password@postiz-postgres:5432/postiz-db-local" + REDIS_URL: "redis://postiz-redis:6379" + BACKEND_INTERNAL_URL: "http://localhost:3000" + IS_GENERAL: "true" # Required for self-hosting. + # The container images are pre-configured to use /uploads for file storage. + # You probably should not change this unless you have a really good reason! + STORAGE_PROVIDER: "local" + UPLOAD_DIRECTORY: "/uploads" + NEXT_PUBLIC_UPLOAD_DIRECTORY: "/uploads" + + # Social keys + LINKEDIN_CLIENT_ID: "86q7ksc8q5pai3" + LINKEDIN_CLIENT_SECRET: {{ linkedin_secret }} + volumes: + - postiz-config:/config/ + - postiz-uploads:/uploads/ + depends_on: + postiz-postgres: + condition: service_healthy + postiz-redis: + condition: service_healthy + + postiz-postgres: + image: postgres:14.5 + container_name: postiz-postgres + restart: always + environment: + POSTGRES_PASSWORD: postiz-password + POSTGRES_USER: postiz-user + POSTGRES_DB: postiz-db-local + volumes: + - postgres-volume:/var/lib/postgresql/data + healthcheck: + test: pg_isready -U postiz-user -d postiz-db-local + interval: 10s + timeout: 3s + retries: 3 + postiz-redis: + image: redis:7.2 + container_name: postiz-redis + restart: always + healthcheck: + test: redis-cli ping + interval: 10s + timeout: 3s + retries: 3 + volumes: + - postiz-redis-data:/data + + + +volumes: + postgres-volume: + external: false + + postiz-redis-data: + external: false + + postiz-config: + external: false + + postiz-uploads: + external: false + +networks: + default: + external: true + name: lava \ No newline at end of file