aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2022-12-12 14:33:53 -0800
committerclarkzjw <[email protected]>2022-12-12 14:33:53 -0800
commit41a97aa43ed021a57da2f0bdabda677ba39e1786 (patch)
tree335a958b419eb0f48747a335b7ca9979a35e96dd
parentae273d3a79fa4a902ecbaca6fdbf49631e8d7234 (diff)
downloadjinwei.me-41a97aa43ed021a57da2f0bdabda677ba39e1786.tar.gz
infra: remove rssrss
-rw-r--r--jinwei.me/infra/cloudflare.tf17
-rw-r--r--jinwei.me/infra/variables.tf5
-rw-r--r--rss.jinwei.me/config/roles/rss/tasks/main.yaml12
-rw-r--r--rss.jinwei.me/config/roles/rss/templates/docker-compose.yaml.j229
-rw-r--r--rss.jinwei.me/infra/rds.tf2
-rw-r--r--rss.jinwei.me/infra/ssm.tf28
-rw-r--r--rss.jinwei.me/infra/variables.tf10
7 files changed, 26 insertions, 77 deletions
diff --git a/jinwei.me/infra/cloudflare.tf b/jinwei.me/infra/cloudflare.tf
index 1b157d8..d0f7b8a 100644
--- a/jinwei.me/infra/cloudflare.tf
+++ b/jinwei.me/infra/cloudflare.tf
@@ -35,18 +35,6 @@ resource "cloudflare_record" "tunnel_dns" {
35 proxied = true 35 proxied = true
36} 36}
37 37
38# TODO
39# since cloudflare terraform provider does not provide an argo tunnel data source
40# refactor this as a separate module?
41# https://registry.terraform.io/providers/cloudflare/cloudflare/3.29.0
42resource "cloudflare_record" "rss_dns" {
43 zone_id = data.cloudflare_zones.domain.zones[0].id
44 name = var.feed_domain
45 value = "${cloudflare_argo_tunnel.tunnel.id}.cfargotunnel.com"
46 type = "CNAME"
47 proxied = true
48}
49
50resource "cloudflare_tunnel_config" "tunnel_route" { 38resource "cloudflare_tunnel_config" "tunnel_route" {
51 account_id = var.cloudflare_account_id 39 account_id = var.cloudflare_account_id
52 tunnel_id = cloudflare_argo_tunnel.tunnel.id 40 tunnel_id = cloudflare_argo_tunnel.tunnel.id
@@ -58,11 +46,6 @@ resource "cloudflare_tunnel_config" "tunnel_route" {
58 service = "http://127.0.0.1:30081" 46 service = "http://127.0.0.1:30081"
59 } 47 }
60 ingress_rule { 48 ingress_rule {
61 hostname = "feed.jinwei.me"
62 path = "/"
63 service = "http://127.0.0.1:30082"
64 }
65 ingress_rule {
66 service = "http_status:404" 49 service = "http_status:404"
67 } 50 }
68 } 51 }
diff --git a/jinwei.me/infra/variables.tf b/jinwei.me/infra/variables.tf
index a3cf8bb..87283cc 100644
--- a/jinwei.me/infra/variables.tf
+++ b/jinwei.me/infra/variables.tf
@@ -55,11 +55,6 @@ variable "site_domain" {
55 default = "jinwei.me" 55 default = "jinwei.me"
56} 56}
57 57
58variable "feed_domain" {
59 type = string
60 default = "feed.jinwei.me"
61}
62
63variable "s3_cdn_name" { 58variable "s3_cdn_name" {
64 type = string 59 type = string
65 default = "static" 60 default = "static"
diff --git a/rss.jinwei.me/config/roles/rss/tasks/main.yaml b/rss.jinwei.me/config/roles/rss/tasks/main.yaml
index d70729a..f62c897 100644
--- a/rss.jinwei.me/config/roles/rss/tasks/main.yaml
+++ b/rss.jinwei.me/config/roles/rss/tasks/main.yaml
@@ -4,25 +4,25 @@
4 - python3-pymysql 4 - python3-pymysql
5 update_cache: true 5 update_cache: true
6 6
7- name: create ttrss database if not exists 7- name: create rss database if not exists
8 community.mysql.mysql_db: 8 community.mysql.mysql_db:
9 login_host: "{{ lookup('aws_ssm', '/jinwei-me/mysql/host') }}" 9 login_host: "{{ lookup('aws_ssm', '/jinwei-me/mysql/host') }}"
10 login_port: "{{ lookup('aws_ssm', '/jinwei-me/mysql/port') }}" 10 login_port: "{{ lookup('aws_ssm', '/jinwei-me/mysql/port') }}"
11 login_user: "{{ lookup('aws_ssm', '/jinwei-me/mysql/username') }}" 11 login_user: "{{ lookup('aws_ssm', '/jinwei-me/mysql/username') }}"
12 login_password: "{{ lookup('aws_ssm', '/jinwei-me/mysql/password') }}" 12 login_password: "{{ lookup('aws_ssm', '/jinwei-me/mysql/password') }}"
13 name: "{{ lookup('aws_ssm', '/jinwei-me/mysql/ttrss_db_name') }}" 13 name: "{{ lookup('aws_ssm', '/jinwei-me/mysql/rss_db_name') }}"
14 state: present 14 state: present
15 15
16- name: create ttrss database user 16- name: create rss database user
17 community.mysql.mysql_user: 17 community.mysql.mysql_user:
18 login_host: "{{ lookup('aws_ssm', '/jinwei-me/mysql/host') }}" 18 login_host: "{{ lookup('aws_ssm', '/jinwei-me/mysql/host') }}"
19 login_port: "{{ lookup('aws_ssm', '/jinwei-me/mysql/port') }}" 19 login_port: "{{ lookup('aws_ssm', '/jinwei-me/mysql/port') }}"
20 login_user: "{{ lookup('aws_ssm', '/jinwei-me/mysql/username') }}" 20 login_user: "{{ lookup('aws_ssm', '/jinwei-me/mysql/username') }}"
21 login_password: "{{ lookup('aws_ssm', '/jinwei-me/mysql/password') }}" 21 login_password: "{{ lookup('aws_ssm', '/jinwei-me/mysql/password') }}"
22 name: "{{ lookup('aws_ssm', '/jinwei-me/mysql/ttrss_db_user') }}" 22 name: "{{ lookup('aws_ssm', '/jinwei-me/mysql/rss_db_user') }}"
23 host: "%" 23 host: "%"
24 password: "{{ lookup('aws_ssm', '/jinwei-me/mysql/ttrss_db_password') }}" 24 password: "{{ lookup('aws_ssm', '/jinwei-me/mysql/rss_user_password') }}"
25 priv: "{{ lookup('aws_ssm', '/jinwei-me/mysql/ttrss_db_name') }}.*:ALL" 25 priv: "{{ lookup('aws_ssm', '/jinwei-me/mysql/rss_db_name') }}.*:ALL"
26 state: present 26 state: present
27 27
28- name: create rss_home 28- name: create rss_home
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
deleted file mode 100644
index b79dbaa..0000000
--- a/rss.jinwei.me/config/roles/rss/templates/docker-compose.yaml.j2
+++ /dev/null
@@ -1,29 +0,0 @@
1version: "3"
2services:
3 freshrss:
4 image: freshrss/freshrss:edge
5 container_name: freshrss
6 restart: always
7 logging:
8 options:
9 max-size: 10m
10 volumes:
11 # Recommended volume for FreshRSS persistent data such as configuration and SQLite databases
12 - {{ rss_home }}/data:/var/www/FreshRSS/data
13 # Optional volume for storing third-party extensions
14 - {{ rss_home }}/extensions:/var/www/FreshRSS/extensions
15 ports:
16 # If you want to open a port 8080 on the local machine:
17 - 30082:80
18 environment:
19 # A timezone http://php.net/timezones (default is UTC)
20 TZ: America/Vancouver
21
22 rssbot:
23 build:
24 context: .
25 dockerfile: ./Dockerfile.rssbot
26 container_name: ttrss_rssbot
27 restart: always
28 environment:
29 - TOKEN={{ lookup('aws_ssm', '/jinwei-me/tgbot/token') }}
diff --git a/rss.jinwei.me/infra/rds.tf b/rss.jinwei.me/infra/rds.tf
index ad719ea..d1a77a4 100644
--- a/rss.jinwei.me/infra/rds.tf
+++ b/rss.jinwei.me/infra/rds.tf
@@ -1,4 +1,4 @@
1resource "random_password" "ttrss_password" { 1resource "random_password" "rss_password" {
2 length = 16 2 length = 16
3 special = false 3 special = false
4} 4}
diff --git a/rss.jinwei.me/infra/ssm.tf b/rss.jinwei.me/infra/ssm.tf
index 62aaba7..59d0f36 100644
--- a/rss.jinwei.me/infra/ssm.tf
+++ b/rss.jinwei.me/infra/ssm.tf
@@ -1,34 +1,34 @@
1resource "aws_ssm_parameter" "ttrss_site_url" { 1resource "aws_ssm_parameter" "rss_site_url" {
2 name = "/${var.name}/ttrss/url" 2 name = "/${var.name}/rss/url"
3 type = "String" 3 type = "String"
4 value = var.ttrss_site_url 4 value = var.rss_site_url
5} 5}
6 6
7resource "aws_ssm_parameter" "ttrss_db_name" { 7resource "aws_ssm_parameter" "rss_db_name" {
8 name = "/${var.name}/mysql/ttrss_db_name" 8 name = "/${var.name}/mysql/rss_db_name"
9 type = "String" 9 type = "String"
10 value = var.ttrss_db_name 10 value = var.rss_db_name
11} 11}
12 12
13resource "aws_ssm_parameter" "ttrss_db_user" { 13resource "aws_ssm_parameter" "rss_db_user" {
14 name = "/${var.name}/mysql/ttrss_db_user" 14 name = "/${var.name}/mysql/rss_db_user"
15 type = "String" 15 type = "String"
16 value = var.ttrss_db_user 16 value = var.rss_db_user
17} 17}
18 18
19resource "aws_ssm_parameter" "ttrss_db_password" { 19resource "aws_ssm_parameter" "rss_db_password" {
20 name = "/${var.name}/mysql/ttrss_db_password" 20 name = "/${var.name}/mysql/rss_user_password"
21 type = "SecureString" 21 type = "SecureString"
22 value = random_password.ttrss_password.result 22 value = random_password.rss_password.result
23} 23}
24 24
25resource "aws_ssm_parameter" "ttrss_tgbot_token" { 25resource "aws_ssm_parameter" "rss_tgbot_token" {
26 name = "/${var.name}/tgbot/token" 26 name = "/${var.name}/tgbot/token"
27 type = "SecureString" 27 type = "SecureString"
28 value = var.rss_tgbot_token 28 value = var.rss_tgbot_token
29} 29}
30 30
31resource "aws_ssm_parameter" "ttrss_tgbot_version" { 31resource "aws_ssm_parameter" "rss_tgbot_version" {
32 name = "/${var.name}/tgbot/version" 32 name = "/${var.name}/tgbot/version"
33 type = "String" 33 type = "String"
34 value = var.tg_bot_version 34 value = var.tg_bot_version
diff --git a/rss.jinwei.me/infra/variables.tf b/rss.jinwei.me/infra/variables.tf
index 01b051b..667b41b 100644
--- a/rss.jinwei.me/infra/variables.tf
+++ b/rss.jinwei.me/infra/variables.tf
@@ -12,15 +12,15 @@ variable "region" {
12 description = "AWS region" 12 description = "AWS region"
13} 13}
14 14
15variable "ttrss_db_name" { 15variable "rss_db_name" {
16 default = "ttrss" 16 default = "rss"
17} 17}
18 18
19variable "ttrss_db_user" { 19variable "rss_db_user" {
20 default = "ttrss" 20 default = "rss"
21} 21}
22 22
23variable "ttrss_site_url" { 23variable "rss_site_url" {
24 default = "https://feed.jinwei.me" 24 default = "https://feed.jinwei.me"
25} 25}
26 26
Powered by cgit v1.2.3 (git 2.41.0)