|
| 1 | +[< botEnSky](../README.md) |
| 2 | + |
| 3 | +# Operator guide - OPS guide --- DRAFT VERSION |
| 4 | + |
| 5 | +BotEnSky application is currently deployed on render.com free plan without special requirements out of setting environment. |
| 6 | +This page don't talk about render.com as there is nothing to add to official doc. |
| 7 | + |
| 8 | +BotEnSky application planB (#142) is to deploy it on a private VM having special requirements : ex. #143 Coolify PaaS |
| 9 | + |
| 10 | +💁 NOTE: this is a DRAFT VERSION, as for now only local test has been done |
| 11 | + |
| 12 | +This page describe VM requirements + Coolify PaaS installation. |
| 13 | + |
| 14 | +For BotEnSky applications install, cf. [OPS_app](./OPS_app.md) |
| 15 | + |
| 16 | +## Requirements |
| 17 | + |
| 18 | +### A Secure Linux Virtual machine (VM) |
| 19 | +- Example : OVH dedicated VM ([VPS help doc](https://help.ovhcloud.com/csm/fr-vps-getting-started?id=kb_article_view&sysparm_article=KB0047736)) |
| 20 | +- you could use your own VM, or VM provider to instantiate a new Linux VM. |
| 21 | +- you must have an ssh access to the VM. |
| 22 | + |
| 23 | +### Ssh notice |
| 24 | + |
| 25 | +- configure VM ssh service, and keep pk in a secure place, |
| 26 | +- refuse ssh root login with password (mandatory), |
| 27 | +- add an ssh script `/etc/ssh/scripts/sshnotify.sh` that will notify ssh connexions to your favorite tchat app channel. |
| 28 | + |
| 29 | +TODO: add more details on this |
| 30 | + |
| 31 | +### Fail2Ban service is recommended |
| 32 | +- add [fail2ban](https://github.com/fail2ban/fail2ban) : a project that monitor and ban IP of ssh attempts too many failures |
| 33 | +```` |
| 34 | +systemctl start/enable/stop fail2ban |
| 35 | +```` |
| 36 | + |
| 37 | +To see banned ip : |
| 38 | +``` |
| 39 | +sudo fail2ban-client status |
| 40 | +sudo fail2ban-client status sshd |
| 41 | +``` |
| 42 | + |
| 43 | +### Coolify |
| 44 | +💁 NOTE: this is a DRAFT VERSION, for now only local QA using WSL2 has been done. |
| 45 | + |
| 46 | +#### Coolify install |
| 47 | +- Follow [Coolify installation guide](https://coolify.io/docs/installation) |
| 48 | +- On issue, you could rely on [manual as fallback](https://coolify.io/docs/get-started/installation#manual-installation) |
| 49 | +- ✔️ at the end, you have docker installed on your VM, and coolify visible from your browser. |
| 50 | +- ➕👤 create a Coolify administrator account with a secure password. |
| 51 | + |
| 52 | + |
| 53 | +### Coolify - TIPS |
| 54 | +#### Coolify Start |
| 55 | +```bash |
| 56 | +sudo su - |
| 57 | +cd /data/coolify |
| 58 | +docker compose \ |
| 59 | + --env-file /data/coolify/source/.env \ |
| 60 | + -f /data/coolify/source/docker-compose.yml \ |
| 61 | + -f /data/coolify/source/docker-compose.prod.yml \ |
| 62 | + up -d --pull always --remove-orphans --force-recreate |
| 63 | +```` |
| 64 | + |
| 65 | +go to http://youserver:8000 |
| 66 | + |
| 67 | +#### Coolify Stop |
| 68 | +```bash |
| 69 | +docker compose \ |
| 70 | + --env-file /data/coolify/source/.env \ |
| 71 | + -f /data/coolify/source/docker-compose.yml \ |
| 72 | + -f /data/coolify/source/docker-compose.prod.yml down |
| 73 | +``` |
| 74 | + |
| 75 | +#### Coolify Recover admin account |
| 76 | + |
| 77 | +💁 TIP: I dont remember the email used by account creation |
| 78 | + |
| 79 | +```bash |
| 80 | +docker exec -it coolify-db psql -U coolify |
| 81 | +```` |
| 82 | +
|
| 83 | +Then in Postgres console : |
| 84 | +
|
| 85 | +````sql |
| 86 | +\c coolify |
| 87 | +SELECT email FROM users; |
| 88 | +```` |
| 89 | +
|
| 90 | +💁 TIP: I want to reset admin account creation (not tested) |
| 91 | +
|
| 92 | +```bash |
| 93 | +docker exec -it coolify bash |
| 94 | +php artisan coolify:reset-password |
| 95 | +``` |
| 96 | + |
| 97 | +TIP: save it in a safe place (like Keepass) |
0 commit comments