use command instead of entrypoing
This commit is contained in:
parent
91b26b4120
commit
bf53429e0f
@ -23,4 +23,4 @@
|
||||
src: 'templates/Caddyfile.j2'
|
||||
dest: /etc/caddy/Caddyfile
|
||||
mode: "0644"
|
||||
notify: restart caddy
|
||||
notify: reload caddy
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
- name: Mount vfs
|
||||
ansible.posix.mount:
|
||||
src: "{{ vfs_mount_tag }}"
|
||||
src: "{{ our_vfs_mount_tag }}"
|
||||
path: /mnt/vfs
|
||||
fstype: virtiofs
|
||||
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 }}"
|
||||
path: /mnt/vfs
|
||||
fstype: virtiofs
|
||||
opts: defaults,_netdev
|
||||
state: mounted
|
||||
|
@ -8,6 +8,6 @@
|
||||
ansible.builtin.include_tasks:
|
||||
file: stack.yml
|
||||
|
||||
- name: Deploy our
|
||||
- name: Deploy our via docker stack
|
||||
ansible.builtin.include_tasks:
|
||||
file: deploy.yml
|
||||
file: stack.yml
|
||||
|
@ -43,4 +43,4 @@
|
||||
|
||||
- name: Get the VFS mount_tag
|
||||
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:
|
||||
- postgres
|
||||
init: true
|
||||
entrypoint: >
|
||||
command: >
|
||||
sh -c "npx prisma migrate deploy && npm run start:server"
|
||||
volumes:
|
||||
- /mnt/vfs/futureporn:/mnt/vfs/futureporn
|
||||
|
@ -101,17 +101,17 @@ resource "vultr_vpc" "futureporn_vpc" {
|
||||
region = "ord"
|
||||
}
|
||||
|
||||
resource "bunnynet_dns_record" "future_porn_a" {
|
||||
for_each = zipmap(
|
||||
range(length(vultr_instance.our_vps)),
|
||||
vultr_instance.our_vps
|
||||
)
|
||||
# resource "bunnynet_dns_record" "future_porn_a" {
|
||||
# for_each = zipmap(
|
||||
# range(length(vultr_instance.our_vps)),
|
||||
# vultr_instance.our_vps
|
||||
# )
|
||||
|
||||
zone = bunnynet_dns_zone.future_porn.id
|
||||
name = "*"
|
||||
type = "A"
|
||||
value = each.value.main_ip
|
||||
}
|
||||
# zone = bunnynet_dns_zone.future_porn.id
|
||||
# name = "*"
|
||||
# type = "A"
|
||||
# value = each.value.main_ip
|
||||
# }
|
||||
|
||||
|
||||
|
||||
@ -141,23 +141,23 @@ resource "bunnynet_dns_zone" "future_porn" {
|
||||
# }
|
||||
|
||||
# our0
|
||||
resource "vultr_instance" "our_vps" {
|
||||
count = 1
|
||||
hostname = "fp-our-${count.index}"
|
||||
plan = "vc2-4c-8gb"
|
||||
region = "ord"
|
||||
backups = "disabled"
|
||||
ddos_protection = "false"
|
||||
os_id = 1743
|
||||
enable_ipv6 = true
|
||||
label = "fp our ${count.index}"
|
||||
tags = ["futureporn", "our", "tofu"]
|
||||
ssh_key_ids = [local.envs.VULTR_SSH_KEY_ID]
|
||||
user_data = base64encode(var.vps_user_data)
|
||||
vpc_ids = [
|
||||
vultr_vpc.futureporn_vpc.id
|
||||
]
|
||||
}
|
||||
# resource "vultr_instance" "our_vps" {
|
||||
# count = 1
|
||||
# hostname = "fp-our-${count.index}"
|
||||
# plan = "vc2-4c-8gb"
|
||||
# region = "ord"
|
||||
# backups = "disabled"
|
||||
# ddos_protection = "false"
|
||||
# os_id = 1743
|
||||
# enable_ipv6 = true
|
||||
# label = "fp our ${count.index}"
|
||||
# tags = ["futureporn", "our", "tofu"]
|
||||
# ssh_key_ids = [local.envs.VULTR_SSH_KEY_ID]
|
||||
# user_data = base64encode(var.vps_user_data)
|
||||
# vpc_ids = [
|
||||
# vultr_vpc.futureporn_vpc.id
|
||||
# ]
|
||||
# }
|
||||
|
||||
|
||||
# resource "bunnynet_dns_record" "future_porn_apex" {
|
||||
|
Loading…
x
Reference in New Issue
Block a user