Skip to content

Commit d3f1b21

Browse files
committed
Do not run init job for h2 storage
1 parent bd31bcf commit d3f1b21

File tree

6 files changed

+7
-4
lines changed

6 files changed

+7
-4
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ You should see output for each IP with a `SUCCESS` status:
154154
After confirming connectivity, proceed to install Apache SkyWalking using the Ansible playbook:
155155

156156
```
157-
ansible-playbook -u ec2-user playbooks/install-skywalking.yml -i inventory/skywalking.yaml
157+
ansible-playbook skywalking.yml
158158
```
159159

160160
### 4. Configurations

ansible/roles/skywalking/tasks/main.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@
6565

6666
- name: Check hostgroup size
6767
set_fact:
68-
group_size: "{{ groups['skywalking_oap'] | length }}"
69-
oap_init_node: "{{ [groups['skywalking_oap'][0]] }}"
68+
oap_init_node: "{{ (inventory_hostname in groups['skywalking_oap'] and hostvars[inventory_hostname]['database']['type'] == 'h2') | ternary([], [groups['skywalking_oap'][0]]) }}"
7069

7170
- name: Run the OAPSericeInit script
7271
command: "sudo -u skywalking -- sh -c 'set -a; source /home/skywalking/oap.env; set +a; /usr/local/skywalking/bin/oapServiceInit.sh'"

ansible/roles/skywalking/templates/skywalking-oap.service.j2

+4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ Type=simple
2222
User=skywalking
2323
Group=skywalking
2424
EnvironmentFile=/home/skywalking/oap.env
25+
{% if hostvars[inventory_hostname]['database']['type'] == 'h2' %}
26+
ExecStart=/usr/local/skywalking/bin/oapService.sh
27+
{% else %}
2528
ExecStart=/usr/local/skywalking/bin/oapServiceNoInit.sh
29+
{% endif %}
2630
TimeoutSec=300
2731
KillMode=process
2832
ExecReload=/bin/kill -HUP $MAINPID
File renamed without changes.

aws/ec2-main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ resource "aws_security_group" "public-egress-access" {
3333
resource "local_file" "inventories" {
3434
filename = "${path.module}/../ansible/inventory/skywalking.yaml"
3535
file_permission = "0600"
36-
content = templatefile("${path.module}/../ansible/inventory/template/skywalking.yaml.tftpl", {
36+
content = templatefile("${path.module}/../ansible/template/inventory.yaml.tftpl", {
3737
bastion = aws_instance.bastion[0]
3838
oap_instances = aws_instance.skywalking-oap
3939
ui_instances = aws_instance.skywalking-ui

0 commit comments

Comments
 (0)