From b35eff7ffbd20776181789142f8aee8bc8a93a6d Mon Sep 17 00:00:00 2001 From: c0repwn3r Date: Fri, 21 Apr 2023 20:36:06 -0400 Subject: [PATCH] add the rest of the deployment actions --- ansible/deploy-beta.yaml | 50 +++++++++++ ansible/deploy-bleeding.yaml | 50 +++++++++++ ansible/deploy-stable.yaml | 51 ++++++++++++ ansible/deploy.yaml | 153 ---------------------------------- ansible/restart-beta.yaml | 15 ++++ ansible/restart-bleeding.yaml | 15 ++++ ansible/restart-stable.yaml | 15 ++++ ansible/restart.yaml | 15 ++++ ansible/start-beta.yaml | 11 +++ ansible/start-bleeding.yaml | 11 +++ ansible/start-stable.yaml | 11 +++ ansible/start.yaml | 11 +++ ansible/stop-beta.yaml | 11 +++ ansible/stop-bleeding.yaml | 11 +++ ansible/stop-stable.yaml | 11 +++ ansible/stop.yaml | 11 +++ ansible/update-beta.yaml | 11 +++ ansible/update-bleeding.yaml | 11 +++ ansible/update-stable.yaml | 11 +++ ansible/update.yaml | 11 +++ 20 files changed, 343 insertions(+), 153 deletions(-) create mode 100644 ansible/deploy-beta.yaml create mode 100644 ansible/deploy-bleeding.yaml create mode 100644 ansible/deploy-stable.yaml delete mode 100644 ansible/deploy.yaml create mode 100644 ansible/restart-beta.yaml create mode 100644 ansible/restart-bleeding.yaml create mode 100644 ansible/restart-stable.yaml create mode 100644 ansible/restart.yaml create mode 100644 ansible/start-beta.yaml create mode 100644 ansible/start-bleeding.yaml create mode 100644 ansible/start-stable.yaml create mode 100644 ansible/start.yaml create mode 100644 ansible/stop-beta.yaml create mode 100644 ansible/stop-bleeding.yaml create mode 100644 ansible/stop-stable.yaml create mode 100644 ansible/stop.yaml create mode 100644 ansible/update-beta.yaml create mode 100644 ansible/update-bleeding.yaml create mode 100644 ansible/update-stable.yaml create mode 100644 ansible/update.yaml diff --git a/ansible/deploy-beta.yaml b/ansible/deploy-beta.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d7e7d8dd278b63cb58d9396cdf358edd8f0700ac --- /dev/null +++ b/ansible/deploy-beta.yaml @@ -0,0 +1,50 @@ +- name: Deploy beta servers + hosts: starkingdoms_prod_servers_beta + vars: + # Randomly generated per-deployment secrets + api_key: "{{ lookup('community.general.random_string', base64=True, length=24) }}" + jwt_signing_secret: "{{ lookup('community.general.random_string', base64=True, length=24) }}" + + # Database info + db_name: starkingdoms-bleeding + + # What version of the docker container should be deployed? + version: beta + + ws_port: 3204 + api_port: 3205 + web_port: 3206 + + api_config_dir: /home/stk-deploy/config + db_data_dir: /home/stk-deploy/data + compose_dir: /home/stk-deploy + + api_url: https://api.beta.starkingdoms.tk + game_url: https://beta.starkingdoms.tk + tasks: + - name: Ensure host connectivity + ansible.builtin.ping: + - name: Create configuration directory + ansible.builtin.file: + path: "{{ api_config_dir }}" + state: directory + mode: 0755 + - name: Create data directory + ansible.builtin.file: + path: "{{ db_data_dir }}" + state: directory + mode: 0755 + - name: Create API config file + ansible.builtin.template: + src: ../docker/config.jinja.toml + dest: "{{ api_config_dir }}/config.toml" + force: no + - name: Create docker-compose config file + ansible.builtin.template: + src: ../docker/docker-compose.jinja.yml + dest: "{{ compose_dir }}/docker-compose.yml" + force: no + - name: Start the server + ansible.builtin.shell: + cmd: docker-compose up -d + chdir: "{{ compose_dir }}" diff --git a/ansible/deploy-bleeding.yaml b/ansible/deploy-bleeding.yaml new file mode 100644 index 0000000000000000000000000000000000000000..bdd05d8a3797e06f8808d3af0640d2c4fda315b6 --- /dev/null +++ b/ansible/deploy-bleeding.yaml @@ -0,0 +1,50 @@ +- name: Deploy bleeding servers + hosts: starkingdoms_prod_servers_bleeding + vars: + # Randomly generated per-deployment secrets + api_key: "{{ lookup('community.general.random_string', base64=True, length=24) }}" + jwt_signing_secret: "{{ lookup('community.general.random_string', base64=True, length=24) }}" + + # Database info + db_name: starkingdoms-bleeding + + # What version of the docker container should be deployed? + version: bleeding + + ws_port: 3204 + api_port: 3205 + web_port: 3206 + + api_config_dir: /home/stk-deploy/config + db_data_dir: /home/stk-deploy/data + compose_dir: /home/stk-deploy + + api_url: https://api.bleeding.starkingdoms.tk + game_url: https://bleeding.starkingdoms.tk + tasks: + - name: Ensure host connectivity + ansible.builtin.ping: + - name: Create configuration directory + ansible.builtin.file: + path: "{{ api_config_dir }}" + state: directory + mode: 0755 + - name: Create data directory + ansible.builtin.file: + path: "{{ db_data_dir }}" + state: directory + mode: 0755 + - name: Create API config file + ansible.builtin.template: + src: ../docker/config.jinja.toml + dest: "{{ api_config_dir }}/config.toml" + force: no + - name: Create docker-compose config file + ansible.builtin.template: + src: ../docker/docker-compose.jinja.yml + dest: "{{ compose_dir }}/docker-compose.yml" + force: no + - name: Start the server + ansible.builtin.shell: + cmd: docker-compose up -d + chdir: "{{ compose_dir }}" \ No newline at end of file diff --git a/ansible/deploy-stable.yaml b/ansible/deploy-stable.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d58bcf5438de9a6676cf3cab8625ae983f754af8 --- /dev/null +++ b/ansible/deploy-stable.yaml @@ -0,0 +1,51 @@ + +- name: Deploy stable servers + hosts: starkingdoms_prod_servers_stable + vars: + # Randomly generated per-deployment secrets + api_key: "{{ lookup('community.general.random_string', base64=True, length=24) }}" + jwt_signing_secret: "{{ lookup('community.general.random_string', base64=True, length=24) }}" + + # Database info + db_name: starkingdoms-bleeding + + # What version of the docker container should be deployed? + version: stable + + ws_port: 3204 + api_port: 3205 + web_port: 3206 + + api_config_dir: /home/stk-deploy/config + db_data_dir: /home/stk-deploy/data + compose_dir: /home/stk-deploy + + api_url: https://api.starkingdoms.tk + game_url: https://starkingdoms.tk + tasks: + - name: Ensure host connectivity + ansible.builtin.ping: + - name: Create configuration directory + ansible.builtin.file: + path: "{{ api_config_dir }}" + state: directory + mode: 0755 + - name: Create data directory + ansible.builtin.file: + path: "{{ db_data_dir }}" + state: directory + mode: 0755 + - name: Create API config file + ansible.builtin.template: + src: ../docker/config.jinja.toml + dest: "{{ api_config_dir }}/config.toml" + force: no + - name: Create docker-compose config file + ansible.builtin.template: + src: ../docker/docker-compose.jinja.yml + dest: "{{ compose_dir }}/docker-compose.yml" + force: no + - name: Start the server + ansible.builtin.shell: + cmd: docker-compose up -d + chdir: "{{ compose_dir }}" \ No newline at end of file diff --git a/ansible/deploy.yaml b/ansible/deploy.yaml deleted file mode 100644 index 34cffe7c59af0d0431c067a32e78564b87e7d999..0000000000000000000000000000000000000000 --- a/ansible/deploy.yaml +++ /dev/null @@ -1,153 +0,0 @@ -- name: Deploy bleeding servers - hosts: starkingdoms_prod_servers_bleeding - vars: - # Randomly generated per-deployment secrets - api_key: "{{ lookup('community.general.random_string', base64=True, length=24) }}" - jwt_signing_secret: "{{ lookup('community.general.random_string', base64=True, length=24) }}" - - # Database info - db_name: starkingdoms-bleeding - - # What version of the docker container should be deployed? - version: bleeding - - ws_port: 3204 - api_port: 3205 - web_port: 3206 - - api_config_dir: /home/stk-deploy/config - db_data_dir: /home/stk-deploy/data - compose_dir: /home/stk-deploy - - api_url: https://api.bleeding.starkingdoms.tk - game_url: https://bleeding.starkingdoms.tk - tasks: - - name: Ensure host connectivity - ansible.builtin.ping: - - name: Create configuration directory - ansible.builtin.file: - path: "{{ api_config_dir }}" - state: directory - mode: 0755 - - name: Create data directory - ansible.builtin.file: - path: "{{ db_data_dir }}" - state: directory - mode: 0755 - - name: Create API config file - ansible.builtin.template: - src: ../docker/config.jinja.toml - dest: "{{ api_config_dir }}/config.toml" - force: no - - name: Create docker-compose config file - ansible.builtin.template: - src: ../docker/docker-compose.jinja.yml - dest: "{{ compose_dir }}/docker-compose.yml" - force: no - - name: Start the server - ansible.builtin.shell: - cmd: docker-compose up -d - chdir: "{{ compose_dir }}" - - -- name: Deploy beta servers - hosts: starkingdoms_prod_servers_beta - vars: - # Randomly generated per-deployment secrets - api_key: "{{ lookup('community.general.random_string', base64=True, length=24) }}" - jwt_signing_secret: "{{ lookup('community.general.random_string', base64=True, length=24) }}" - - # Database info - db_name: starkingdoms-bleeding - - # What version of the docker container should be deployed? - version: beta - - ws_port: 3204 - api_port: 3205 - web_port: 3206 - - api_config_dir: /home/stk-deploy/config - db_data_dir: /home/stk-deploy/data - compose_dir: /home/stk-deploy - - api_url: https://api.beta.starkingdoms.tk - game_url: https://beta.starkingdoms.tk - tasks: - - name: Ensure host connectivity - ansible.builtin.ping: - - name: Create configuration directory - ansible.builtin.file: - path: "{{ api_config_dir }}" - state: directory - mode: 0755 - - name: Create data directory - ansible.builtin.file: - path: "{{ db_data_dir }}" - state: directory - mode: 0755 - - name: Create API config file - ansible.builtin.template: - src: ../docker/config.jinja.toml - dest: "{{ api_config_dir }}/config.toml" - force: no - - name: Create docker-compose config file - ansible.builtin.template: - src: ../docker/docker-compose.jinja.yml - dest: "{{ compose_dir }}/docker-compose.yml" - force: no - - name: Start the server - ansible.builtin.shell: - cmd: docker-compose up -d - chdir: "{{ compose_dir }}" - -- name: Deploy stable servers - hosts: starkingdoms_prod_servers_stable - vars: - # Randomly generated per-deployment secrets - api_key: "{{ lookup('community.general.random_string', base64=True, length=24) }}" - jwt_signing_secret: "{{ lookup('community.general.random_string', base64=True, length=24) }}" - - # Database info - db_name: starkingdoms-bleeding - - # What version of the docker container should be deployed? - version: stable - - ws_port: 3204 - api_port: 3205 - web_port: 3206 - - api_config_dir: /home/stk-deploy/config - db_data_dir: /home/stk-deploy/data - compose_dir: /home/stk-deploy - - api_url: https://api.starkingdoms.tk - game_url: https://starkingdoms.tk - tasks: - - name: Ensure host connectivity - ansible.builtin.ping: - - name: Create configuration directory - ansible.builtin.file: - path: "{{ api_config_dir }}" - state: directory - mode: 0755 - - name: Create data directory - ansible.builtin.file: - path: "{{ db_data_dir }}" - state: directory - mode: 0755 - - name: Create API config file - ansible.builtin.template: - src: ../docker/config.jinja.toml - dest: "{{ api_config_dir }}/config.toml" - force: no - - name: Create docker-compose config file - ansible.builtin.template: - src: ../docker/docker-compose.jinja.yml - dest: "{{ compose_dir }}/docker-compose.yml" - force: no - - name: Start the server - ansible.builtin.shell: - cmd: docker-compose up -d - chdir: "{{ compose_dir }}" \ No newline at end of file diff --git a/ansible/restart-beta.yaml b/ansible/restart-beta.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f567cc73cc053998bf7375bf1c84bdb8e88ed9aa --- /dev/null +++ b/ansible/restart-beta.yaml @@ -0,0 +1,15 @@ +- name: Restart beta servers + hosts: starkingdoms_prod_servers_beta + vars: + compose_dir: /home/stk-deploy + tasks: + - name: Ensure host connectivity + ansible.builtin.ping: + - name: Stop the server + ansible.builtin.shell: + cmd: docker-compose down + chdir: "{{ compose_dir }}" + - name: Start the server + ansible.builtin.shell: + cmd: docker-compose up -d + chdir: "{{ compose_dir }}" \ No newline at end of file diff --git a/ansible/restart-bleeding.yaml b/ansible/restart-bleeding.yaml new file mode 100644 index 0000000000000000000000000000000000000000..147300cbd85750a4af602b8e9f1ffc88a19e981a --- /dev/null +++ b/ansible/restart-bleeding.yaml @@ -0,0 +1,15 @@ +- name: Restart bleeding servers + hosts: starkingdoms_prod_servers_bleeding + vars: + compose_dir: /home/stk-deploy + tasks: + - name: Ensure host connectivity + ansible.builtin.ping: + - name: Stop the server + ansible.builtin.shell: + cmd: docker-compose down + chdir: "{{ compose_dir }}" + - name: Start the server + ansible.builtin.shell: + cmd: docker-compose up -d + chdir: "{{ compose_dir }}" \ No newline at end of file diff --git a/ansible/restart-stable.yaml b/ansible/restart-stable.yaml new file mode 100644 index 0000000000000000000000000000000000000000..2ea7b6d5a074a98aa55cdd7520fcd6b72344b369 --- /dev/null +++ b/ansible/restart-stable.yaml @@ -0,0 +1,15 @@ +- name: Restart stable servers + hosts: starkingdoms_prod_servers_stable + vars: + compose_dir: /home/stk-deploy + tasks: + - name: Ensure host connectivity + ansible.builtin.ping: + - name: Stop the server + ansible.builtin.shell: + cmd: docker-compose down + chdir: "{{ compose_dir }}" + - name: Start the server + ansible.builtin.shell: + cmd: docker-compose up -d + chdir: "{{ compose_dir }}" \ No newline at end of file diff --git a/ansible/restart.yaml b/ansible/restart.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9f531a2eaf3c8a528d2349b2cd3f0f6ceaeed4e2 --- /dev/null +++ b/ansible/restart.yaml @@ -0,0 +1,15 @@ +- name: Restart all servers + hosts: starkingdoms_prod_servers + vars: + compose_dir: /home/stk-deploy + tasks: + - name: Ensure host connectivity + ansible.builtin.ping: + - name: Stop the server + ansible.builtin.shell: + cmd: docker-compose down + chdir: "{{ compose_dir }}" + - name: Start the server + ansible.builtin.shell: + cmd: docker-compose up -d + chdir: "{{ compose_dir }}" \ No newline at end of file diff --git a/ansible/start-beta.yaml b/ansible/start-beta.yaml new file mode 100644 index 0000000000000000000000000000000000000000..fd8e5e41f5db3ccbb51637c0dabfd8d7853d1af9 --- /dev/null +++ b/ansible/start-beta.yaml @@ -0,0 +1,11 @@ +- name: Start beta servers + hosts: starkingdoms_prod_servers_beta + vars: + compose_dir: /home/stk-deploy + tasks: + - name: Ensure host connectivity + ansible.builtin.ping: + - name: Start the server + ansible.builtin.shell: + cmd: docker-compose up -d + chdir: "{{ compose_dir }}" \ No newline at end of file diff --git a/ansible/start-bleeding.yaml b/ansible/start-bleeding.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e132a00ada3ce6fcb40852318e965d9ba2cd76f6 --- /dev/null +++ b/ansible/start-bleeding.yaml @@ -0,0 +1,11 @@ +- name: Start bleeding servers + hosts: starkingdoms_prod_servers_bleeding + vars: + compose_dir: /home/stk-deploy + tasks: + - name: Ensure host connectivity + ansible.builtin.ping: + - name: Start the server + ansible.builtin.shell: + cmd: docker-compose up -d + chdir: "{{ compose_dir }}" \ No newline at end of file diff --git a/ansible/start-stable.yaml b/ansible/start-stable.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f7626bc98e4d7590976275d911d3917619f607b1 --- /dev/null +++ b/ansible/start-stable.yaml @@ -0,0 +1,11 @@ +- name: Start stable servers + hosts: starkingdoms_prod_servers_beta + vars: + compose_dir: /home/stk-deploy + tasks: + - name: Ensure host connectivity + ansible.builtin.ping: + - name: Start the server + ansible.builtin.shell: + cmd: docker-compose up -d + chdir: "{{ compose_dir }}" \ No newline at end of file diff --git a/ansible/start.yaml b/ansible/start.yaml new file mode 100644 index 0000000000000000000000000000000000000000..26ad6661bfca6b3b100c17c26faaf41648d77a29 --- /dev/null +++ b/ansible/start.yaml @@ -0,0 +1,11 @@ +- name: Start all servers + hosts: starkingdoms_prod_servers + vars: + compose_dir: /home/stk-deploy + tasks: + - name: Ensure host connectivity + ansible.builtin.ping: + - name: Start the server + ansible.builtin.shell: + cmd: docker-compose up -d + chdir: "{{ compose_dir }}" \ No newline at end of file diff --git a/ansible/stop-beta.yaml b/ansible/stop-beta.yaml new file mode 100644 index 0000000000000000000000000000000000000000..29afe8225ffbf03d05cd3c1aa71614ed8caa4ae3 --- /dev/null +++ b/ansible/stop-beta.yaml @@ -0,0 +1,11 @@ +- name: Stop beta servers + hosts: starkingdoms_prod_servers_beta + vars: + compose_dir: /home/stk-deploy + tasks: + - name: Ensure host connectivity + ansible.builtin.ping: + - name: Stop the server + ansible.builtin.shell: + cmd: docker-compose down + chdir: "{{ compose_dir }}" \ No newline at end of file diff --git a/ansible/stop-bleeding.yaml b/ansible/stop-bleeding.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0f2c3ac0c6fa7efe1d228e3f697b932cfcc3d6cf --- /dev/null +++ b/ansible/stop-bleeding.yaml @@ -0,0 +1,11 @@ +- name: Stop bleeding servers + hosts: starkingdoms_prod_servers_beta + vars: + compose_dir: /home/stk-deploy + tasks: + - name: Ensure host connectivity + ansible.builtin.ping: + - name: Stop the server + ansible.builtin.shell: + cmd: docker-compose down + chdir: "{{ compose_dir }}" \ No newline at end of file diff --git a/ansible/stop-stable.yaml b/ansible/stop-stable.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6cdda3f7d23686e453b8a955b3fa5eecbcb9f1e2 --- /dev/null +++ b/ansible/stop-stable.yaml @@ -0,0 +1,11 @@ +- name: Stop stable servers + hosts: starkingdoms_prod_servers_stable + vars: + compose_dir: /home/stk-deploy + tasks: + - name: Ensure host connectivity + ansible.builtin.ping: + - name: Stop the server + ansible.builtin.shell: + cmd: docker-compose down + chdir: "{{ compose_dir }}" \ No newline at end of file diff --git a/ansible/stop.yaml b/ansible/stop.yaml new file mode 100644 index 0000000000000000000000000000000000000000..57aa3f5e9b97d5ada94a3f13d8553efc5b91e4f5 --- /dev/null +++ b/ansible/stop.yaml @@ -0,0 +1,11 @@ +- name: Stop all servers + hosts: starkingdoms_prod_servers + vars: + compose_dir: /home/stk-deploy + tasks: + - name: Ensure host connectivity + ansible.builtin.ping: + - name: Stop the server + ansible.builtin.shell: + cmd: docker-compose down + chdir: "{{ compose_dir }}" \ No newline at end of file diff --git a/ansible/update-beta.yaml b/ansible/update-beta.yaml new file mode 100644 index 0000000000000000000000000000000000000000..628bd522a361d20cd7d3483eeea3c982fbe14f4c --- /dev/null +++ b/ansible/update-beta.yaml @@ -0,0 +1,11 @@ +- name: Update beta servers + hosts: starkingdoms_prod_servers_beta + vars: + compose_dir: /home/stk-deploy + tasks: + - name: Ensure host connectivity + ansible.builtin.ping: + - name: Update the server + ansible.builtin.shell: + cmd: docker-compose pull + chdir: "{{ compose_dir }}" \ No newline at end of file diff --git a/ansible/update-bleeding.yaml b/ansible/update-bleeding.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f67456f9e93067f55f23e5f46dfc38149e2a3b56 --- /dev/null +++ b/ansible/update-bleeding.yaml @@ -0,0 +1,11 @@ +- name: Update bleeding servers + hosts: starkingdoms_prod_servers_bleeding + vars: + compose_dir: /home/stk-deploy + tasks: + - name: Ensure host connectivity + ansible.builtin.ping: + - name: Update the server + ansible.builtin.shell: + cmd: docker-compose pull + chdir: "{{ compose_dir }}" \ No newline at end of file diff --git a/ansible/update-stable.yaml b/ansible/update-stable.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6eaa66f93f4b97341ff68aa29f1d68030d985db1 --- /dev/null +++ b/ansible/update-stable.yaml @@ -0,0 +1,11 @@ +- name: Update stable servers + hosts: starkingdoms_prod_servers_stable + vars: + compose_dir: /home/stk-deploy + tasks: + - name: Ensure host connectivity + ansible.builtin.ping: + - name: Update the server + ansible.builtin.shell: + cmd: docker-compose pull + chdir: "{{ compose_dir }}" \ No newline at end of file diff --git a/ansible/update.yaml b/ansible/update.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d0297b061ff253fde1723d93e3245c037f3c037d --- /dev/null +++ b/ansible/update.yaml @@ -0,0 +1,11 @@ +- name: Update all servers + hosts: starkingdoms_prod_servers + vars: + compose_dir: /home/stk-deploy + tasks: + - name: Ensure host connectivity + ansible.builtin.ping: + - name: Update the server + ansible.builtin.shell: + cmd: docker-compose pull + chdir: "{{ compose_dir }}" \ No newline at end of file