diff options
Diffstat (limited to 'rss.jinwei.me/config/roles/rss')
4 files changed, 62 insertions, 0 deletions
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 @@ | |||
1 | - name: render Dockerfile.rssbot | ||
2 | template: | ||
3 | src: Dockerfile.rssbot.j2 | ||
4 | dest: "{{ rss_home }}/Dockerfile.rssbot" | ||
5 | mode: 0644 | ||
6 | |||
7 | - name: render docker-compose | ||
8 | template: | ||
9 | src: docker-compose.yaml.j2 | ||
10 | dest: "{{ rss_home }}/docker-compose.yaml" | ||
11 | mode: 0644 | ||
12 | |||
13 | - name: Start rss toolchain using docker-compose | ||
14 | community.docker.docker_compose: | ||
15 | project_name: rss | ||
16 | project_src: "{{ rss_home }}" | ||
17 | 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 @@ | |||
1 | FROM alpine:3.17 | ||
2 | |||
3 | ENV VERSION={{ lookup('aws_ssm', '/jinwei-me/tgbot/version') }} | ||
4 | ENV TOKEN "" | ||
5 | |||
6 | WORKDIR /app | ||
7 | |||
8 | ADD https://github.com/iovxw/rssbot/releases/download/${VERSION}/rssbot-en-x86_64-unknown-linux-musl /app/rssbot | ||
9 | |||
10 | RUN chmod +x /app/rssbot | ||
11 | |||
12 | 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 @@ | |||
1 | version: "3" | ||
2 | services: | ||
3 | ttrss: | ||
4 | image: wangqiru/ttrss:nightly-2022-08-09 | ||
5 | container_name: ttrss | ||
6 | environment: | ||
7 | - SELF_URL_PATH={{ lookup('aws_ssm', '/jinwei-me/ttrss/url') }} | ||
8 | - DB_HOST={{ lookup('aws_ssm', '/jinwei-me/mysql/host') }} | ||
9 | - DB_PORT={{ lookup('aws_ssm', '/jinwei-me/mysql/port') }} | ||
10 | - DB_NAME={{ lookup('aws_ssm', '/jinwei-me/mysql/ttrss_db_name') }} | ||
11 | - DB_USER={{ lookup('aws_ssm', '/jinwei-me/mysql/ttrss_db_user') }} | ||
12 | - DB_PASS={{ lookup('aws_ssm', '/jinwei-me/mysql/ttrss_db_password') }} | ||
13 | - PUID=1000 | ||
14 | - PGID=1000 | ||
15 | volumes: | ||
16 | - {{ rss_home }}/feed-icons:/var/www/feed-icons/ | ||
17 | stdin_open: true | ||
18 | tty: true | ||
19 | restart: always | ||
20 | |||
21 | mercury: | ||
22 | image: wangqiru/mercury-parser-api:latest | ||
23 | container_name: ttrss_mercury | ||
24 | restart: always | ||
25 | |||
26 | rssbot: | ||
27 | build: | ||
28 | dockerfile: ./Dockerfile.rssbot | ||
29 | container_name: ttrss_rssbot | ||
30 | restart: always | ||
31 | environment: | ||
32 | - TOKEN={{ lookup('aws_ssm', '/jinwei-me/tgbot/token') }} | ||