Skip to content

Commit

Permalink
setup nodejs
Browse files Browse the repository at this point in the history
  • Loading branch information
gempir committed Feb 4, 2024
1 parent b00fb83 commit 42829af
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions ansible/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- { role: "common", tags: ["common"] }
- { role: "geerlingguy.postgresql", tags: ["postgresql"] }
- { role: "caddy", tags: ["caddy"] }
- { role: "nodejs", tags: ["nodejs"] }
- { role: "geerlingguy.node_exporter", tags: ["node_exporter"] }
- { role: "prometheus", tags: ["prometheus"] }
- { role: "prometheus-postgres", tags: ["prometheus-postgres"] }
Expand Down
1 change: 1 addition & 0 deletions ansible/roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- ufw
- htop
- ncdu
- nodejs
- software-properties-common
state: present

Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/gempbot/templates/service-yjs.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ StartLimitBurst=10
[Service]
Restart=always
RestartSec=5
ExecStart=server/yjs
ExecStart=/home/gempbot/web/yjs/server.js
WorkingDirectory=/home/gempbot/web
Environment=NODE_ENV=production
Environment=YPERSISTENCE=/home/gempbot/yjs_db
Expand Down
31 changes: 31 additions & 0 deletions ansible/roles/nodejs/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
- become: true
tasks:
- name: Update apt cache
apt:
update_cache: yes

- name: Install Node.js dependencies
apt:
name: "{{ item }}"
state: present
loop:
- curl
- software-properties-common

- name: Add NodeSource repository
apt_repository:
repo: "deb https://deb.nodesource.com/node_20.x {{ ansible_distribution_release }} main"
state: present
update_cache: yes
filename: nodesource

- name: Install Node.js
apt:
name: nodejs
state: present

- name: Install build-essential
apt:
name: build-essential
state: present
Empty file modified web/yjs/server.js
100644 → 100755
Empty file.

0 comments on commit 42829af

Please sign in to comment.