use command instead of entrypoing
This commit is contained in:
parent
91b26b4120
commit
bf53429e0f
@ -23,4 +23,4 @@
|
|||||||
src: 'templates/Caddyfile.j2'
|
src: 'templates/Caddyfile.j2'
|
||||||
dest: /etc/caddy/Caddyfile
|
dest: /etc/caddy/Caddyfile
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
notify: restart caddy
|
notify: reload caddy
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
- name: Mount vfs
|
- name: Mount vfs
|
||||||
ansible.posix.mount:
|
ansible.posix.mount:
|
||||||
src: "{{ vfs_mount_tag }}"
|
src: "{{ our_vfs_mount_tag }}"
|
||||||
path: /mnt/vfs
|
path: /mnt/vfs
|
||||||
fstype: virtiofs
|
fstype: virtiofs
|
||||||
state: mounted
|
state: mounted
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Create directory
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: /etc/futureporn/our
|
|
||||||
state: directory
|
|
||||||
mode: "0755"
|
|
||||||
|
|
||||||
- name: Copy env file
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: ../../../../.env.production
|
|
||||||
dest: /etc/futureporn/our/.env
|
|
||||||
mode: "0600"
|
|
||||||
|
|
||||||
- name: Clone the latest code
|
|
||||||
ansible.builtin.git:
|
|
||||||
repo: https://gitea.futureporn.net/futureporn/fp
|
|
||||||
dest: /tmp/checkout
|
|
||||||
single_branch: true
|
|
||||||
version: main
|
|
||||||
clone: true
|
|
||||||
force: true
|
|
||||||
|
|
||||||
- name: Copy compose files
|
|
||||||
ansible.builtin.copy:
|
|
||||||
remote_src: true
|
|
||||||
src: "/tmp/checkout/services/our/{{ item }}"
|
|
||||||
dest: "/etc/futureporn/our/{{ item }}"
|
|
||||||
mode: "0744"
|
|
||||||
loop:
|
|
||||||
- compose.db.yaml
|
|
||||||
- compose.production.yaml
|
|
||||||
- compose.green.yaml
|
|
||||||
- compose.blue.yaml
|
|
||||||
|
|
||||||
- name: Deploy db stack
|
|
||||||
community.docker.docker_stack:
|
|
||||||
state: present
|
|
||||||
name: our-postgres
|
|
||||||
compose:
|
|
||||||
- /etc/futureporn/our/compose.db.yaml
|
|
||||||
|
|
||||||
- name: Deploy stack to green
|
|
||||||
community.docker.docker_stack:
|
|
||||||
state: present
|
|
||||||
name: our-green
|
|
||||||
compose:
|
|
||||||
- /etc/futureporn/our/compose.production.yaml
|
|
||||||
- /etc/futureporn/our/compose.green.yaml
|
|
||||||
|
|
||||||
- name: Deploy stack to blue
|
|
||||||
community.docker.docker_stack:
|
|
||||||
state: present
|
|
||||||
name: our-blue
|
|
||||||
compose:
|
|
||||||
- /etc/futureporn/our/compose.production.yaml
|
|
||||||
- /etc/futureporn/our/compose.blue.yaml
|
|
||||||
# - name: Remove stack
|
|
||||||
# community.docker.docker_stack:
|
|
||||||
# name: mystack
|
|
||||||
# state: absent
|
|
@ -8,4 +8,5 @@
|
|||||||
src: "{{ our_vfs_mount_tag }}"
|
src: "{{ our_vfs_mount_tag }}"
|
||||||
path: /mnt/vfs
|
path: /mnt/vfs
|
||||||
fstype: virtiofs
|
fstype: virtiofs
|
||||||
|
opts: defaults,_netdev
|
||||||
state: mounted
|
state: mounted
|
||||||
|
@ -8,6 +8,6 @@
|
|||||||
ansible.builtin.include_tasks:
|
ansible.builtin.include_tasks:
|
||||||
file: stack.yml
|
file: stack.yml
|
||||||
|
|
||||||
- name: Deploy our
|
- name: Deploy our via docker stack
|
||||||
ansible.builtin.include_tasks:
|
ansible.builtin.include_tasks:
|
||||||
file: deploy.yml
|
file: stack.yml
|
||||||
|
@ -43,4 +43,4 @@
|
|||||||
|
|
||||||
- name: Get the VFS mount_tag
|
- name: Get the VFS mount_tag
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
vfs_mount_tag: "{{ vfs_attach.json.mount_tag | default('') }}"
|
our_vfs_mount_tag: "{{ vfs_attach.json.mount_tag | default('') }}"
|
||||||
|
@ -1 +1,60 @@
|
|||||||
---
|
---
|
||||||
|
- name: Create directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /etc/futureporn/our
|
||||||
|
state: directory
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: Copy env file
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ../../../../.env.production
|
||||||
|
dest: /etc/futureporn/our/.env
|
||||||
|
mode: "0600"
|
||||||
|
|
||||||
|
- name: Clone the latest code
|
||||||
|
ansible.builtin.git:
|
||||||
|
repo: https://gitea.futureporn.net/futureporn/fp
|
||||||
|
dest: /tmp/checkout
|
||||||
|
single_branch: true
|
||||||
|
version: main
|
||||||
|
clone: true
|
||||||
|
force: true
|
||||||
|
|
||||||
|
- name: Copy compose files
|
||||||
|
ansible.builtin.copy:
|
||||||
|
remote_src: true
|
||||||
|
src: "/tmp/checkout/services/our/{{ item }}"
|
||||||
|
dest: "/etc/futureporn/our/{{ item }}"
|
||||||
|
mode: "0744"
|
||||||
|
loop:
|
||||||
|
- compose.db.yaml
|
||||||
|
- compose.production.yaml
|
||||||
|
- compose.green.yaml
|
||||||
|
- compose.blue.yaml
|
||||||
|
|
||||||
|
- name: Deploy db stack
|
||||||
|
community.docker.docker_stack:
|
||||||
|
state: present
|
||||||
|
name: our-postgres
|
||||||
|
compose:
|
||||||
|
- /etc/futureporn/our/compose.db.yaml
|
||||||
|
|
||||||
|
- name: Deploy stack to green
|
||||||
|
community.docker.docker_stack:
|
||||||
|
state: present
|
||||||
|
name: our-green
|
||||||
|
compose:
|
||||||
|
- /etc/futureporn/our/compose.production.yaml
|
||||||
|
- /etc/futureporn/our/compose.green.yaml
|
||||||
|
|
||||||
|
- name: Deploy stack to blue
|
||||||
|
community.docker.docker_stack:
|
||||||
|
state: present
|
||||||
|
name: our-blue
|
||||||
|
compose:
|
||||||
|
- /etc/futureporn/our/compose.production.yaml
|
||||||
|
- /etc/futureporn/our/compose.blue.yaml
|
||||||
|
# - name: Remove stack
|
||||||
|
# community.docker.docker_stack:
|
||||||
|
# name: mystack
|
||||||
|
# state: absent
|
||||||
|
@ -5,7 +5,7 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
init: true
|
init: true
|
||||||
entrypoint: >
|
command: >
|
||||||
sh -c "npx prisma migrate deploy && npm run start:server"
|
sh -c "npx prisma migrate deploy && npm run start:server"
|
||||||
volumes:
|
volumes:
|
||||||
- /mnt/vfs/futureporn:/mnt/vfs/futureporn
|
- /mnt/vfs/futureporn:/mnt/vfs/futureporn
|
||||||
|
@ -101,17 +101,17 @@ resource "vultr_vpc" "futureporn_vpc" {
|
|||||||
region = "ord"
|
region = "ord"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "bunnynet_dns_record" "future_porn_a" {
|
# resource "bunnynet_dns_record" "future_porn_a" {
|
||||||
for_each = zipmap(
|
# for_each = zipmap(
|
||||||
range(length(vultr_instance.our_vps)),
|
# range(length(vultr_instance.our_vps)),
|
||||||
vultr_instance.our_vps
|
# vultr_instance.our_vps
|
||||||
)
|
# )
|
||||||
|
|
||||||
zone = bunnynet_dns_zone.future_porn.id
|
# zone = bunnynet_dns_zone.future_porn.id
|
||||||
name = "*"
|
# name = "*"
|
||||||
type = "A"
|
# type = "A"
|
||||||
value = each.value.main_ip
|
# value = each.value.main_ip
|
||||||
}
|
# }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -141,23 +141,23 @@ resource "bunnynet_dns_zone" "future_porn" {
|
|||||||
# }
|
# }
|
||||||
|
|
||||||
# our0
|
# our0
|
||||||
resource "vultr_instance" "our_vps" {
|
# resource "vultr_instance" "our_vps" {
|
||||||
count = 1
|
# count = 1
|
||||||
hostname = "fp-our-${count.index}"
|
# hostname = "fp-our-${count.index}"
|
||||||
plan = "vc2-4c-8gb"
|
# plan = "vc2-4c-8gb"
|
||||||
region = "ord"
|
# region = "ord"
|
||||||
backups = "disabled"
|
# backups = "disabled"
|
||||||
ddos_protection = "false"
|
# ddos_protection = "false"
|
||||||
os_id = 1743
|
# os_id = 1743
|
||||||
enable_ipv6 = true
|
# enable_ipv6 = true
|
||||||
label = "fp our ${count.index}"
|
# label = "fp our ${count.index}"
|
||||||
tags = ["futureporn", "our", "tofu"]
|
# tags = ["futureporn", "our", "tofu"]
|
||||||
ssh_key_ids = [local.envs.VULTR_SSH_KEY_ID]
|
# ssh_key_ids = [local.envs.VULTR_SSH_KEY_ID]
|
||||||
user_data = base64encode(var.vps_user_data)
|
# user_data = base64encode(var.vps_user_data)
|
||||||
vpc_ids = [
|
# vpc_ids = [
|
||||||
vultr_vpc.futureporn_vpc.id
|
# vultr_vpc.futureporn_vpc.id
|
||||||
]
|
# ]
|
||||||
}
|
# }
|
||||||
|
|
||||||
|
|
||||||
# resource "bunnynet_dns_record" "future_porn_apex" {
|
# resource "bunnynet_dns_record" "future_porn_apex" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user