src.nth.io/

summaryrefslogtreecommitdiff
path: root/lnurld/server
diff options
context:
space:
mode:
authorLuke Hoersten <[email protected]>2023-07-22 23:27:09 -0500
committerLuke Hoersten <[email protected]>2023-07-22 23:27:09 -0500
commit4f2dd12d36b447f6b28844ff4db9414f935272d3 (patch)
tree91a81167b225ec9944632c68c4ddc6b0dfb5aab1 /lnurld/server
parent58d6bb46618d2cfef3a2f381e46b5eba193d7270 (diff)
Got lnurld running.
Diffstat (limited to 'lnurld/server')
-rw-r--r--lnurld/server/defaults/main.yaml5
-rw-r--r--lnurld/server/handlers/main.yaml5
-rw-r--r--lnurld/server/tasks/main.yaml50
-rw-r--r--lnurld/server/templates/config.yaml.j218
-rw-r--r--lnurld/server/templates/lnurld.service.j221
5 files changed, 99 insertions, 0 deletions
diff --git a/lnurld/server/defaults/main.yaml b/lnurld/server/defaults/main.yaml
new file mode 100644
index 0000000..82afffb
--- /dev/null
+++ b/lnurld/server/defaults/main.yaml
@@ -0,0 +1,5 @@
+---
+
+lnurld_user: "bitcoin"
+lnurld_host: "127.0.0.1"
+lnurld_port: "8088"
diff --git a/lnurld/server/handlers/main.yaml b/lnurld/server/handlers/main.yaml
new file mode 100644
index 0000000..2935e95
--- /dev/null
+++ b/lnurld/server/handlers/main.yaml
@@ -0,0 +1,5 @@
+---
+
+- name: restart lnurld service
+ become: yes
+ systemd: name="lnurld.service" state="restarted" daemon_reload="yes"
diff --git a/lnurld/server/tasks/main.yaml b/lnurld/server/tasks/main.yaml
new file mode 100644
index 0000000..04e5232
--- /dev/null
+++ b/lnurld/server/tasks/main.yaml
@@ -0,0 +1,50 @@
+---
+
+- name: add lnurld user
+ become: yes
+ user: name="{{lnurld_user}}" shell="/bin/false" system="yes"
+
+- name: install lnurld bin
+ become: yes
+ get_url:
+ url: "{{lnurld_bin_url}}"
+ dest: "/usr/local/bin/lnurld"
+ mode: "0755"
+ notify: restart lnurld service
+
+- name: create lnurld data dir
+ become: yes
+ file:
+ path: "{{lnurld_data_dir}}"
+ mode: "0710"
+ owner: "{{lnurld_user}}"
+ group: "{{lnurld_user}}"
+ state: "directory"
+
+- name: create lnurld etc dir
+ become: yes
+ file:
+ path: "/etc/lnurld/"
+ mode: "0755"
+ state: "directory"
+
+- name: install lnurld config
+ become: yes
+ template:
+ src: "config.yaml.j2"
+ dest: "/etc/lnurld/config.yaml"
+ owner: "{{lnurld_user}}"
+ group: "{{lnurld_user}}"
+ mode: "0600"
+ notify: restart lnurld service
+
+- name: install lnurld systemd service
+ become: yes
+ template:
+ src: "lnurld.service.j2"
+ dest: "/lib/systemd/system/lnurld.service"
+ notify: restart lnurld service
+
+- name: ensure service is started
+ become: yes
+ systemd: name="lnurld.service" enabled="yes" state="started"
diff --git a/lnurld/server/templates/config.yaml.j2 b/lnurld/server/templates/config.yaml.j2
new file mode 100644
index 0000000..9377ecd
--- /dev/null
+++ b/lnurld/server/templates/config.yaml.j2
@@ -0,0 +1,18 @@
+listen: {{lnurld_host}}:{{lnurld_port}}
+data-dir: {{lnurld_data_dir}}
+credentials:
+ admin: {{lnurld_admin_pass}}
+lnd:
+ cert-file: {{lnurld_lnd_cert_file}}
+ macaroon-file: {{lnurld_lnd_invoice_macaroon}}
+accounts:
+{% for account in lnurld_accounts %}
+ {{account.name}}:
+ currency: usd
+ description: {{account.desc}}
+ is-also-email: {{account.is_email|default(false)}}
+ comment-allowed: 210
+ min-sendable: 1
+ max-sendable: 1_000_000
+{% else %} []
+{% endfor %}
diff --git a/lnurld/server/templates/lnurld.service.j2 b/lnurld/server/templates/lnurld.service.j2
new file mode 100644
index 0000000..499fdba
--- /dev/null
+++ b/lnurld/server/templates/lnurld.service.j2
@@ -0,0 +1,21 @@
+[Unit]
+Description=LNURL Daemon
+Wants=lnd.service
+After=lnd.service
+
+[Service]
+Environment="GIN_MODE=release"
+ExecStart=/usr/local/bin/lnurld
+
+User={{lnurld_user}}
+Group={{lnurld_user}}
+
+Type=simple
+KillMode=process
+LimitNOFILE=128000
+TimeoutSec=240
+Restart=always
+RestartSec=60
+
+[Install]
+WantedBy=multi-user.target