From 1859f62813f0c586ea49f912944fb25efd60520f Mon Sep 17 00:00:00 2001 From: Luke Hoersten Date: Mon, 23 Mar 2026 22:22:36 -0500 Subject: Fixed log rotation and log2ram sizing. --- ergo/defaults/main.yaml | 2 ++ ergo/files/ergo.service | 20 -------------------- ergo/tasks/main.yaml | 11 ++++++----- ergo/templates/config.yaml.j2 | 6 +++--- ergo/templates/ergo.service.j2 | 20 ++++++++++++++++++++ ergo/templates/nginx.conf.j2 | 2 +- 6 files changed, 32 insertions(+), 29 deletions(-) delete mode 100644 ergo/files/ergo.service create mode 100644 ergo/templates/ergo.service.j2 (limited to 'ergo') diff --git a/ergo/defaults/main.yaml b/ergo/defaults/main.yaml index 23bcec3..c1edf28 100644 --- a/ergo/defaults/main.yaml +++ b/ergo/defaults/main.yaml @@ -7,4 +7,6 @@ ergo_arch: "arm64" ergo_tar_name: "ergo-{{ergo_version}}-linux-{{ergo_arch}}" ergo_tar: "{{ergo_tar_name}}.tar.gz" ergo_url: "https://github.com/ergochat/ergo/releases/download/v{{ergo_version}}/{{ergo_tar}}" +ergo_run_dir: "/var/ergo" +ergo_data_dir: "/var/ergo" ergo_force_nick_equals_account: false diff --git a/ergo/files/ergo.service b/ergo/files/ergo.service deleted file mode 100644 index 54ff847..0000000 --- a/ergo/files/ergo.service +++ /dev/null @@ -1,20 +0,0 @@ -[Unit] -Description=ergo -#After=network.target -# If you are using MySQL for history storage, comment out the above line -# and uncomment these two instead (you must independently install and configure -# MySQL for your system): -Wants=mysql.service -After=network.target mysql.service - -[Service] -Type=simple -User=ergo -WorkingDirectory=/var/ergo -ExecStart=/usr/local/bin/ergo run --conf /etc/ergo/config.yaml -ExecReload=/bin/kill -HUP $MAINPID -Restart=on-failure -LimitNOFILE=1048576 - -[Install] -WantedBy=multi-user.target diff --git a/ergo/tasks/main.yaml b/ergo/tasks/main.yaml index fd5da50..5998713 100644 --- a/ergo/tasks/main.yaml +++ b/ergo/tasks/main.yaml @@ -26,14 +26,15 @@ - name: create ergo dirs become: yes file: - path: "{{item}}/ergo" + path: "{{item}}" owner: "ergo" group: "ergo" mode: "0755" state: "directory" loop: - - "/etc" - - "/var" + - "/etc/ergo" + - "{{ergo_run_dir}}" + - "{{ergo_data_dir}}" - name: configure ergo become: yes @@ -54,8 +55,8 @@ - name: install ergo service become: yes - copy: - src: "ergo.service" + template: + src: "ergo.service.j2" dest: "/lib/systemd/system/ergo.service" mode: "0644" notify: restart ergo diff --git a/ergo/templates/config.yaml.j2 b/ergo/templates/config.yaml.j2 index a0c3249..c2e22a8 100644 --- a/ergo/templates/config.yaml.j2 +++ b/ergo/templates/config.yaml.j2 @@ -58,7 +58,7 @@ server: # proxy: false # Example of a Unix domain socket for proxying: - "/var/ergo/socket": + "{{ergo_run_dir}}/socket": # Example of a Tor listener: any connection that comes in on this listener will # be considered a Tor connection. It is strongly recommended that this listener @@ -288,7 +288,7 @@ server: # ergo will write files to disk under certain circumstances, e.g., # CPU profiling or data export. by default, these files will be written # to the working directory. set this to customize: - output-path: "/var/ergo" + output-path: "{{ergo_run_dir}}" # account options accounts: @@ -685,7 +685,7 @@ debug: # datastore configuration datastore: # path to the datastore - path: "/var/ergo/ergo.db" + path: "{{ergo_data_dir}}/ergo.db" # if the database schema requires an upgrade, `autoupgrade` will attempt to # perform it automatically on startup. the database will be backed diff --git a/ergo/templates/ergo.service.j2 b/ergo/templates/ergo.service.j2 new file mode 100644 index 0000000..a885a3d --- /dev/null +++ b/ergo/templates/ergo.service.j2 @@ -0,0 +1,20 @@ +[Unit] +Description=ergo +#After=network.target +# If you are using MySQL for history storage, comment out the above line +# and uncomment these two instead (you must independently install and configure +# MySQL for your system): +Wants=mysql.service +After=network.target mysql.service + +[Service] +Type=simple +User=ergo +WorkingDirectory={{ergo_run_dir}} +ExecStart=/usr/local/bin/ergo run --conf /etc/ergo/config.yaml +ExecReload=/bin/kill -HUP $MAINPID +Restart=on-failure +LimitNOFILE=1048576 + +[Install] +WantedBy=multi-user.target diff --git a/ergo/templates/nginx.conf.j2 b/ergo/templates/nginx.conf.j2 index 1b1a83b..b6c9354 100644 --- a/ergo/templates/nginx.conf.j2 +++ b/ergo/templates/nginx.conf.j2 @@ -1,6 +1,6 @@ server { listen 6697 ssl; - proxy_pass unix:/var/ergo/socket; + proxy_pass unix:{{ergo_run_dir}}/socket; proxy_protocol on; ssl_certificate {{nginx_ssl_cert}}; -- cgit v1.2.3