1
0
mirror of https://github.com/etesync/server synced 2024-11-25 18:28:46 +00:00

Reorganize to add a section about FreeBSD

Pierre-Alain TORET 2024-04-24 19:54:26 +02:00
parent 8a378aab70
commit 83511e16fa

@ -1,5 +1,9 @@
Having to run uvicorn manually is annoying and not maintainable. Having to run uvicorn manually is annoying and not maintainable.
Instead, you should have `systemd` automatically start it at boot for you. Instead, you should have the system automatically start it at boot for you.
# Linux
## systemd
We can have `systemd` handle lauching uvicorn by creating a unit file for it. We can have `systemd` handle lauching uvicorn by creating a unit file for it.
Create a new file called `etebase_server.service` and paste in the following. Create a new file called `etebase_server.service` and paste in the following.
@ -33,3 +37,49 @@ $ sudo systemctl enable etebase_server
Check to see if it worked! Check to see if it worked!
If it didn't work, use the command `sudo systemctl status etebase_server` to see what went wrong. If it didn't work, use the command `sudo systemctl status etebase_server` to see what went wrong.
# FreeBSD
## rc script
Create a rc script in `/usr/local/etc/rc.d/etesync` as it's not part of the base system.
```
#!/bin/sh
#
# PROVIDE: etesync
# REQUIRE: NETWORKING LOGIN postgresql
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable etesync:
#
#etesync_enable="YES"
. /etc/rc.subr
name="etesync"
rcvar="etesync_enable"
load_rc_config $name
: ${etesync_enable="NO"}
pidfile="/var/run/etesync/etesync.pid"
procname="/usr/local/share/etesync/venv/bin/uvicorn"
command="/usr/sbin/daemon"
command_interpreter="/usr/local/share/etesync/venv/bin/python3.9"
command_args="-f -u www -o /var/log/etesync.log -p ${pidfile} /usr/local/share/etesync/venv/bin/uvicorn etebase_server.asgi:application --uds /var/run/etesync/etesync.socket --env-file /usr/local/etc/etesync/etesync_env --app-dir /usr/local/share/etesync"
run_rc_command "$1"
```
Then place your installation in `/usr/local/share/etesync` and the venv itself in `/usr/local/share/etesync/venv`
In `/usr/local/etc/etesync/etesync_env`, place the following :
```
ETEBASE_EASY_CONFIG_PATH=/usr/local/etc/etesync/etesync.ini
```
In `/usr/local/etc/etesync/etesync.ini` place your configuration as explained in other wiki sections.
Then you just have to add `etesync_enable="YES"` in `/etc/rc.conf` or run `rc_enable