From fe8cd972b5b72b8983c3f7fd6e7153c78ed278ea Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Mon, 12 Dec 2022 00:03:53 -0800 Subject: infra: add ttrss ssm resources --- rss.jinwei.me/config/roles/rss/defaults/main.yaml | 1 + rss.jinwei.me/config/roles/rss/tasks/main.yaml | 17 ++++++++++++ .../roles/rss/templates/Dockerfile.rssbot.j2 | 12 ++++++++ .../roles/rss/templates/docker-compose.yaml.j2 | 32 ++++++++++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 rss.jinwei.me/config/roles/rss/defaults/main.yaml create mode 100644 rss.jinwei.me/config/roles/rss/tasks/main.yaml create mode 100644 rss.jinwei.me/config/roles/rss/templates/Dockerfile.rssbot.j2 create mode 100644 rss.jinwei.me/config/roles/rss/templates/docker-compose.yaml.j2 (limited to 'rss.jinwei.me/config/roles') diff --git a/rss.jinwei.me/config/roles/rss/defaults/main.yaml b/rss.jinwei.me/config/roles/rss/defaults/main.yaml new file mode 100644 index 0000000..28f1f39 --- /dev/null +++ b/rss.jinwei.me/config/roles/rss/defaults/main.yaml @@ -0,0 +1 @@ +rss_home: /opt/rss diff --git a/rss.jinwei.me/config/roles/rss/tasks/main.yaml b/rss.jinwei.me/config/roles/rss/tasks/main.yaml new file mode 100644 index 0000000..16091cb --- /dev/null +++ b/rss.jinwei.me/config/roles/rss/tasks/main.yaml @@ -0,0 +1,17 @@ +- name: render Dockerfile.rssbot + template: + src: Dockerfile.rssbot.j2 + dest: "{{ rss_home }}/Dockerfile.rssbot" + mode: 0644 + +- name: render docker-compose + template: + src: docker-compose.yaml.j2 + dest: "{{ rss_home }}/docker-compose.yaml" + mode: 0644 + +- name: Start rss toolchain using docker-compose + community.docker.docker_compose: + project_name: rss + project_src: "{{ rss_home }}" + register: output diff --git a/rss.jinwei.me/config/roles/rss/templates/Dockerfile.rssbot.j2 b/rss.jinwei.me/config/roles/rss/templates/Dockerfile.rssbot.j2 new file mode 100644 index 0000000..f7eab63 --- /dev/null +++ b/rss.jinwei.me/config/roles/rss/templates/Dockerfile.rssbot.j2 @@ -0,0 +1,12 @@ +FROM alpine:3.17 + +ENV VERSION={{ lookup('aws_ssm', '/jinwei-me/tgbot/version') }} +ENV TOKEN "" + +WORKDIR /app + +ADD https://github.com/iovxw/rssbot/releases/download/${VERSION}/rssbot-en-x86_64-unknown-linux-musl /app/rssbot + +RUN chmod +x /app/rssbot + +CMD ["sh", "-c", "./rssbot ${TOKEN}"] diff --git a/rss.jinwei.me/config/roles/rss/templates/docker-compose.yaml.j2 b/rss.jinwei.me/config/roles/rss/templates/docker-compose.yaml.j2 new file mode 100644 index 0000000..fd556dc --- /dev/null +++ b/rss.jinwei.me/config/roles/rss/templates/docker-compose.yaml.j2 @@ -0,0 +1,32 @@ +version: "3" +services: + ttrss: + image: wangqiru/ttrss:nightly-2022-08-09 + container_name: ttrss + environment: + - SELF_URL_PATH={{ lookup('aws_ssm', '/jinwei-me/ttrss/url') }} + - DB_HOST={{ lookup('aws_ssm', '/jinwei-me/mysql/host') }} + - DB_PORT={{ lookup('aws_ssm', '/jinwei-me/mysql/port') }} + - DB_NAME={{ lookup('aws_ssm', '/jinwei-me/mysql/ttrss_db_name') }} + - DB_USER={{ lookup('aws_ssm', '/jinwei-me/mysql/ttrss_db_user') }} + - DB_PASS={{ lookup('aws_ssm', '/jinwei-me/mysql/ttrss_db_password') }} + - PUID=1000 + - PGID=1000 + volumes: + - {{ rss_home }}/feed-icons:/var/www/feed-icons/ + stdin_open: true + tty: true + restart: always + + mercury: + image: wangqiru/mercury-parser-api:latest + container_name: ttrss_mercury + restart: always + + rssbot: + build: + dockerfile: ./Dockerfile.rssbot + container_name: ttrss_rssbot + restart: always + environment: + - TOKEN={{ lookup('aws_ssm', '/jinwei-me/tgbot/token') }} -- cgit v1.2.3