From ae273d3a79fa4a902ecbaca6fdbf49631e8d7234 Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Mon, 12 Dec 2022 12:21:57 -0800 Subject: infra: use host network and port mapping config: change ttrss to freshrss --- .../wordpress/templates/docker-compose.yaml.j2 | 3 ++ jinwei.me/infra/cloudflare.tf | 4 +-- rss.jinwei.me/config/roles/rss/tasks/main.yaml | 2 +- .../roles/rss/templates/docker-compose.yaml.j2 | 40 +++++++++------------- 4 files changed, 23 insertions(+), 26 deletions(-) diff --git a/jinwei.me/config/roles/wordpress/templates/docker-compose.yaml.j2 b/jinwei.me/config/roles/wordpress/templates/docker-compose.yaml.j2 index be85fb4..447b80b 100644 --- a/jinwei.me/config/roles/wordpress/templates/docker-compose.yaml.j2 +++ b/jinwei.me/config/roles/wordpress/templates/docker-compose.yaml.j2 @@ -3,6 +3,7 @@ services: cloudflared: image: cloudflare/cloudflared container_name: cloudflare-tunnel + network_mode: host restart: always command: tunnel run environment: @@ -12,6 +13,8 @@ services: volumes: - "{{ wordpress_home }}/wp-content:/var/www/html/wp-content" restart: always + ports: + - 30081:80 environment: - WORDPRESS_DB_HOST={{ lookup('aws_ssm', '/jinwei-me/mysql/host') }}:{{ lookup('aws_ssm', '/jinwei-me/mysql/port') }} - WORDPRESS_DB_USER={{ lookup('aws_ssm', '/jinwei-me/mysql/username') }} diff --git a/jinwei.me/infra/cloudflare.tf b/jinwei.me/infra/cloudflare.tf index c8018d6..1b157d8 100644 --- a/jinwei.me/infra/cloudflare.tf +++ b/jinwei.me/infra/cloudflare.tf @@ -55,12 +55,12 @@ resource "cloudflare_tunnel_config" "tunnel_route" { ingress_rule { hostname = "jinwei.me" path = "/" - service = "http://wordpress:80" + service = "http://127.0.0.1:30081" } ingress_rule { hostname = "feed.jinwei.me" path = "/" - service = "http://127.0.0.1:30080" + service = "http://127.0.0.1:30082" } ingress_rule { service = "http_status:404" diff --git a/rss.jinwei.me/config/roles/rss/tasks/main.yaml b/rss.jinwei.me/config/roles/rss/tasks/main.yaml index 070c48e..d70729a 100644 --- a/rss.jinwei.me/config/roles/rss/tasks/main.yaml +++ b/rss.jinwei.me/config/roles/rss/tasks/main.yaml @@ -20,7 +20,7 @@ login_user: "{{ lookup('aws_ssm', '/jinwei-me/mysql/username') }}" login_password: "{{ lookup('aws_ssm', '/jinwei-me/mysql/password') }}" name: "{{ lookup('aws_ssm', '/jinwei-me/mysql/ttrss_db_user') }}" - host: "*" + host: "%" password: "{{ lookup('aws_ssm', '/jinwei-me/mysql/ttrss_db_password') }}" priv: "{{ lookup('aws_ssm', '/jinwei-me/mysql/ttrss_db_name') }}.*:ALL" state: present 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 index 7a2411a..b79dbaa 100644 --- a/rss.jinwei.me/config/roles/rss/templates/docker-compose.yaml.j2 +++ b/rss.jinwei.me/config/roles/rss/templates/docker-compose.yaml.j2 @@ -1,29 +1,23 @@ 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 - ports: - - 30080:80 - 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 + freshrss: + image: freshrss/freshrss:edge + container_name: freshrss restart: always + logging: + options: + max-size: 10m + volumes: + # Recommended volume for FreshRSS persistent data such as configuration and SQLite databases + - {{ rss_home }}/data:/var/www/FreshRSS/data + # Optional volume for storing third-party extensions + - {{ rss_home }}/extensions:/var/www/FreshRSS/extensions + ports: + # If you want to open a port 8080 on the local machine: + - 30082:80 + environment: + # A timezone http://php.net/timezones (default is UTC) + TZ: America/Vancouver rssbot: build: -- cgit v1.2.3