-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: getting sqlite stuff ready for production
- Loading branch information
Showing
46 changed files
with
1,191 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,3 +87,4 @@ temp/ | |
.ssl-key | ||
.ssl-dhparam | ||
.ssl-csr | ||
ecosystem-sqlite-private.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright (c) Forward Email LLC | ||
# SPDX-License-Identifier: BUSL-1.1 | ||
|
||
--- | ||
- name: Import security playbook | ||
ansible.builtin.import_playbook: security.yml | ||
- name: Import Node.js playbook | ||
ansible.builtin.import_playbook: node.yml | ||
- name: Import SSH keys playbook | ||
ansible.builtin.import_playbook: ssh-keys.yml | ||
|
||
- hosts: sqlite | ||
name: SQLITE | ||
become: true | ||
become_user: root | ||
# this was already defined in the ufw role | ||
# https://github.com/Oefenweb/ansible-ufw/blob/master/handlers/main.yml | ||
handlers: | ||
- name: Reload UFW | ||
ufw: | ||
state: reloaded | ||
tasks: | ||
# ufw | ||
- name: Enable ufw | ||
ufw: | ||
state: enabled | ||
policy: deny | ||
direction: incoming | ||
- name: Limit ufw ssh | ||
ufw: | ||
rule: limit | ||
port: 22 | ||
proto: tcp | ||
- name: Allow ssh | ||
ufw: | ||
rule: allow | ||
port: 22 | ||
proto: tcp | ||
- name: Allow websocket port | ||
ufw: | ||
rule: allow | ||
port: {{ lookup('env', 'SQLITE_WEBSOCKET_PORT' }} | ||
proto: tcp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,15 @@ | ||
{ | ||
"apps": [ | ||
{ | ||
"name": "smtp-tls", | ||
"script": "smtp.js", | ||
"name": "sqlite", | ||
"script": "sqlite.js", | ||
"exec_mode": "cluster", | ||
"wait_ready": true, | ||
"instances": "max", | ||
"pmx": false, | ||
"env_production": { | ||
"NODE_ENV": "production", | ||
"SMTP_PORT": 2587 | ||
} | ||
}, | ||
{ | ||
"name": "smtp-ssl", | ||
"script": "smtp.js", | ||
"exec_mode": "cluster", | ||
"wait_ready": true, | ||
"instances": "max", | ||
"pmx": false, | ||
"env_production": { | ||
"NODE_ENV": "production", | ||
"SMTP_PORT": 2465 | ||
} | ||
}, | ||
{ | ||
"name": "smtp-bree", | ||
"script": "smtp-bree.js", | ||
"exec_mode": "fork", | ||
"wait_ready": true, | ||
"instances": "1", | ||
"pmx": false, | ||
"env_production": { | ||
"NODE_ENV": "production" | ||
} | ||
} | ||
], | ||
"deploy": { | ||
"production": { | ||
"user": "deploy", | ||
"host": [{% for host in groups['smtp'] %}"{{ hostvars[host].ansible_host }}"{% if not loop.last %}, {% endif %}{% endfor %}], | ||
"ref": "origin/master", | ||
"repo": "{{ lookup('env', 'GITHUB_REPO') }}", | ||
"path": "/var/www/production", | ||
"pre-deploy": "git reset --hard", | ||
"post-deploy": "pnpm install && NODE_ENV=production npm start build && pm2 startOrGracefulReload ecosystem-smtp.json --env production --update-env" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[Unit] | ||
Description=Disable Transparent Huge Pages (THP) | ||
DefaultDependencies=no | ||
After=sysinit.target local-fs.target | ||
Before=mongod.service | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/bin/sh -c 'echo never | tee /sys/kernel/mm/transparent_hugepage/enabled > /dev/null' | ||
ExecStart=/bin/sh -c 'echo never | tee /sys/kernel/mm/transparent_hugepage/defrag > /dev/null' | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.