nostr/build/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Tue, 16 Jan 2024 00:04:53 -0600
changeset 224 25e44d8440d4
parent 219 0faea2a7570f
permissions -rw-r--r--
Version updates.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
fd351734f007 Prometheus and WriteFreely roles are work in progress.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
fd351734f007 Prometheus and WriteFreely roles are work in progress.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
216
6c85835d4621 Finished up dendrite build server role.
Luke Hoersten <luke@hoersten.org>
parents: 215
diff changeset
     3
- name: install golang
163
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
     4
  become: yes
224
25e44d8440d4 Version updates.
Luke Hoersten <luke@hoersten.org>
parents: 219
diff changeset
     5
  apt: name="golang-1.21-go"
25e44d8440d4 Version updates.
Luke Hoersten <luke@hoersten.org>
parents: 219
diff changeset
     6
25e44d8440d4 Version updates.
Luke Hoersten <luke@hoersten.org>
parents: 219
diff changeset
     7
- name: link go bin
25e44d8440d4 Version updates.
Luke Hoersten <luke@hoersten.org>
parents: 219
diff changeset
     8
  become: yes
25e44d8440d4 Version updates.
Luke Hoersten <luke@hoersten.org>
parents: 219
diff changeset
     9
  file:
25e44d8440d4 Version updates.
Luke Hoersten <luke@hoersten.org>
parents: 219
diff changeset
    10
    src: "/usr/lib/go-1.21/bin/go"
25e44d8440d4 Version updates.
Luke Hoersten <luke@hoersten.org>
parents: 219
diff changeset
    11
    dest: "/usr/bin/go"
25e44d8440d4 Version updates.
Luke Hoersten <luke@hoersten.org>
parents: 219
diff changeset
    12
    state: "link"
25e44d8440d4 Version updates.
Luke Hoersten <luke@hoersten.org>
parents: 219
diff changeset
    13
    mode: "0755"
163
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    14
217
e69a030975c4 Split out nostr install and build roles.
Luke Hoersten <luke@hoersten.org>
parents: 216
diff changeset
    15
- name: unarchive nostr relayer
17
41034ea52480 Completed writefreely role
Luke Hoersten <luke@hoersten.org>
parents: 2
diff changeset
    16
  unarchive:
41034ea52480 Completed writefreely role
Luke Hoersten <luke@hoersten.org>
parents: 2
diff changeset
    17
    remote_src: yes
217
e69a030975c4 Split out nostr install and build roles.
Luke Hoersten <luke@hoersten.org>
parents: 216
diff changeset
    18
    src: "{{relayer_tar}}"
17
41034ea52480 Completed writefreely role
Luke Hoersten <luke@hoersten.org>
parents: 2
diff changeset
    19
    dest: "/tmp/"
217
e69a030975c4 Split out nostr install and build roles.
Luke Hoersten <luke@hoersten.org>
parents: 216
diff changeset
    20
    creates: "{{relayer_build_dir}}"
163
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    21
219
0faea2a7570f Updated relayer whitelisted for custom nip11 info.
Luke Hoersten <luke@hoersten.org>
parents: 217
diff changeset
    22
# update name
224
25e44d8440d4 Version updates.
Luke Hoersten <luke@hoersten.org>
parents: 219
diff changeset
    23
- name: update relayer nip11 name
219
0faea2a7570f Updated relayer whitelisted for custom nip11 info.
Luke Hoersten <luke@hoersten.org>
parents: 217
diff changeset
    24
  lineinfile:
0faea2a7570f Updated relayer whitelisted for custom nip11 info.
Luke Hoersten <luke@hoersten.org>
parents: 217
diff changeset
    25
    path: "{{relayer_main_src}}"
0faea2a7570f Updated relayer whitelisted for custom nip11 info.
Luke Hoersten <luke@hoersten.org>
parents: 217
diff changeset
    26
    regexp: "^(\\s*)return \"WhitelistedRelay\"$"
0faea2a7570f Updated relayer whitelisted for custom nip11 info.
Luke Hoersten <luke@hoersten.org>
parents: 217
diff changeset
    27
    line: "\\1return \"{{relayer_name}}\""
0faea2a7570f Updated relayer whitelisted for custom nip11 info.
Luke Hoersten <luke@hoersten.org>
parents: 217
diff changeset
    28
    backrefs: yes
0faea2a7570f Updated relayer whitelisted for custom nip11 info.
Luke Hoersten <luke@hoersten.org>
parents: 217
diff changeset
    29
0faea2a7570f Updated relayer whitelisted for custom nip11 info.
Luke Hoersten <luke@hoersten.org>
parents: 217
diff changeset
    30
# update nip11 relay info
0faea2a7570f Updated relayer whitelisted for custom nip11 info.
Luke Hoersten <luke@hoersten.org>
parents: 217
diff changeset
    31
- name: update relayer nip11 info
0faea2a7570f Updated relayer whitelisted for custom nip11 info.
Luke Hoersten <luke@hoersten.org>
parents: 217
diff changeset
    32
  lineinfile:
0faea2a7570f Updated relayer whitelisted for custom nip11 info.
Luke Hoersten <luke@hoersten.org>
parents: 217
diff changeset
    33
    path: "{{relayer_handler_src}}"
0faea2a7570f Updated relayer whitelisted for custom nip11 info.
Luke Hoersten <luke@hoersten.org>
parents: 217
diff changeset
    34
    regexp: "^(\\s*){{item.k}}(\\s*)(.*)$"
0faea2a7570f Updated relayer whitelisted for custom nip11 info.
Luke Hoersten <luke@hoersten.org>
parents: 217
diff changeset
    35
    line: "\\1{{item.k}}\\2\"{{item.v}}\","
0faea2a7570f Updated relayer whitelisted for custom nip11 info.
Luke Hoersten <luke@hoersten.org>
parents: 217
diff changeset
    36
    backrefs: yes
0faea2a7570f Updated relayer whitelisted for custom nip11 info.
Luke Hoersten <luke@hoersten.org>
parents: 217
diff changeset
    37
  loop:
0faea2a7570f Updated relayer whitelisted for custom nip11 info.
Luke Hoersten <luke@hoersten.org>
parents: 217
diff changeset
    38
    - {"k": "Description:", "v": "{{relayer_description}}"}
0faea2a7570f Updated relayer whitelisted for custom nip11 info.
Luke Hoersten <luke@hoersten.org>
parents: 217
diff changeset
    39
    - {"k": "PubKey:", "v": "{{relayer_admin_pubkey}}"}
0faea2a7570f Updated relayer whitelisted for custom nip11 info.
Luke Hoersten <luke@hoersten.org>
parents: 217
diff changeset
    40
    - {"k": "Contact:", "v": "{{relayer_admin_contact}}"}
0faea2a7570f Updated relayer whitelisted for custom nip11 info.
Luke Hoersten <luke@hoersten.org>
parents: 217
diff changeset
    41
    - {"k": "Version:", "v": "{{relayer_version}}"}
0faea2a7570f Updated relayer whitelisted for custom nip11 info.
Luke Hoersten <luke@hoersten.org>
parents: 217
diff changeset
    42
217
e69a030975c4 Split out nostr install and build roles.
Luke Hoersten <luke@hoersten.org>
parents: 216
diff changeset
    43
- name: check if relayer build exists
163
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    44
  stat:
224
25e44d8440d4 Version updates.
Luke Hoersten <luke@hoersten.org>
parents: 219
diff changeset
    45
    path: "{{relayer_build_dir}}/examples/whitelisted/whitelisted"
163
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    46
  register: build_file
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    47
217
e69a030975c4 Split out nostr install and build roles.
Luke Hoersten <luke@hoersten.org>
parents: 216
diff changeset
    48
- name: build relayer
e69a030975c4 Split out nostr install and build roles.
Luke Hoersten <luke@hoersten.org>
parents: 216
diff changeset
    49
  command: "go build"
163
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    50
  args:
224
25e44d8440d4 Version updates.
Luke Hoersten <luke@hoersten.org>
parents: 219
diff changeset
    51
    chdir: "{{relayer_build_dir}}/examples/whitelisted"
163
40b78af86337 Tons of updates.
Luke Hoersten <luke@hoersten.org>
parents: 159
diff changeset
    52
  when: not build_file.stat.exists
216
6c85835d4621 Finished up dendrite build server role.
Luke Hoersten <luke@hoersten.org>
parents: 215
diff changeset
    53
6c85835d4621 Finished up dendrite build server role.
Luke Hoersten <luke@hoersten.org>
parents: 215
diff changeset
    54
- name: create build server dir
6c85835d4621 Finished up dendrite build server role.
Luke Hoersten <luke@hoersten.org>
parents: 215
diff changeset
    55
  become: yes
6c85835d4621 Finished up dendrite build server role.
Luke Hoersten <luke@hoersten.org>
parents: 215
diff changeset
    56
  file:
217
e69a030975c4 Split out nostr install and build roles.
Luke Hoersten <luke@hoersten.org>
parents: 216
diff changeset
    57
    path: "{{relayer_srv_dir}}"
216
6c85835d4621 Finished up dendrite build server role.
Luke Hoersten <luke@hoersten.org>
parents: 215
diff changeset
    58
    mode: "0755"
6c85835d4621 Finished up dendrite build server role.
Luke Hoersten <luke@hoersten.org>
parents: 215
diff changeset
    59
    state: "directory"
6c85835d4621 Finished up dendrite build server role.
Luke Hoersten <luke@hoersten.org>
parents: 215
diff changeset
    60
  when: not build_file.stat.exists
6c85835d4621 Finished up dendrite build server role.
Luke Hoersten <luke@hoersten.org>
parents: 215
diff changeset
    61
217
e69a030975c4 Split out nostr install and build roles.
Luke Hoersten <luke@hoersten.org>
parents: 216
diff changeset
    62
- name: copy bin to build server dir
216
6c85835d4621 Finished up dendrite build server role.
Luke Hoersten <luke@hoersten.org>
parents: 215
diff changeset
    63
  become: yes
217
e69a030975c4 Split out nostr install and build roles.
Luke Hoersten <luke@hoersten.org>
parents: 216
diff changeset
    64
  copy:
e69a030975c4 Split out nostr install and build roles.
Luke Hoersten <luke@hoersten.org>
parents: 216
diff changeset
    65
    remote_src: yes
224
25e44d8440d4 Version updates.
Luke Hoersten <luke@hoersten.org>
parents: 219
diff changeset
    66
    src: "{{relayer_build_dir}}/examples/whitelisted/whitelisted"
217
e69a030975c4 Split out nostr install and build roles.
Luke Hoersten <luke@hoersten.org>
parents: 216
diff changeset
    67
    dest: "{{relayer_srv_dir}}/nostr-relayer-whitelisted"
216
6c85835d4621 Finished up dendrite build server role.
Luke Hoersten <luke@hoersten.org>
parents: 215
diff changeset
    68
  when: not build_file.stat.exists