~starkingdoms/starkingdoms

ref: 4b312c89225174ec940d281e46b4205c46e2328a starkingdoms/ansible/deploy.yaml -rw-r--r-- 4.6 KiB
4b312c89 — c0repwn3r deploy to all hosts 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
- 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 }}"