hessu / aprsc

aprsc, a core APRS-IS server
125 stars 40 forks source link

Multiple instances on the same machine? doc/MULTIPLE.md is outdated #81

Closed ha5dzs closed 10 months ago

ha5dzs commented 1 year ago

Hi,

I am having an issue with running multiple instances of aprsc. The config files seem to be ok, and I can run them individually. For simplicity, I won't use `-foobar' suffixes, I will just type everything as it is.

The two instances that I want are for the aprs network and for the cwop network. I created my own config files, which I don't think I need to share here.

Here is how I start them manually:

sudo /opt/aprsc/sbin/aprsc -u aprsc -c etc/aprsc.conf -t /opt/aprsc -e info -r logs -f

sudo /opt/aprsc/sbin/aprsc -u aprsc -c etc/aprsc-cwop.conf -n aprsc-cwop -t /opt/aprsc -e info -r logs -o file -f

Now, as per doc/MULTIPLE.md, I edited the /etc/default/aprsc and I added the multiple-instance-specific stuff.

Unfortunately, irrespective of whether I create the DAEMON_OPTS_BASE variable, or the DAEMON_OPTS_cwop variable, the second instance does not seem to start.

I can start the first instance with no problems:

sudo systemctl start aprsc

but, if I want to use the wildcard version (aprsc@.service)

sudo systemctl enable aprsc-cwop

I get the error of: Failed to enable unit: Unit file aprsc-cwop.service does not exist. Similarly, when I try to start it:

 sudo systemctl start aprs-cwop

I get a similar error message. Failed to start aprs-cwop.service: Unit aprs-cwop.service not found.

As an initial work-around, I consolidated the multiple instance start to one single line:

sudo /opt/aprsc/sbin/aprsc -u aprsc -c etc/aprsc.conf -t /opt/aprsc -e info -r logs -f && sudo /opt/aprsc/sbin/aprsc -u aprsc -c etc/aprsc-cwop.conf -n aprsc-cwop -t /opt/aprsc -e info -r logs -o file -f

I'd prefer to use this as a system service, because our beloved IT department does not like random scripts being executed on their servers. So, I created a secondary systemd service, which loads the cwop settings and its separate environment.

In addition to creating a new service that starts aprsc with a different config file, I also modified it to call a separate copy of /opt/aprsc/sbin/aprsc-prepare-chroot.sh, which is now named as /opt/aprsc/sbin/aprsc-prepare-chroot-cwop.sh.

I could leave this running in perpetuity, but I am concerned that an update might break it in the future.

So, to the best of my knowledge, the way it's written in doc/MULTIPLE.md does not work on my system (Ubuntu 22.04LTS, Jammy), but I managed to get it to work as above.

Am I missing something?

Zoltan A65FH/M0MBA/HA5DZS

ha5dzs commented 1 year ago

Update: Just upgraded to 2.1.15, and it seems fine the way it is.

snip commented 10 months ago

Hi i upgraded to 2.1.15 and now my other instances than the main one seems not able to be started :( With 2.1.5 when i was doing sudo service aprsc status i was able to see the 2 instances, but not anymore with 2.1.15. I'm facing this issue with Ubuntu 20.04.6 LTS.

Any tips?

hessu commented 10 months ago

Hi,

Sorry, doc/MULTIPLE.md is outdated. On current versions of aprsc and the systemd service files, you can disable the main aprsc service, and enable & start aprsc@instance1, aprsc@instance2, etc.

Prepare config files as /opt/aprsc/etc/aprsc-cwop.conf, etc/aprsc-aprsis.conf for example, and:

systemctl stop aprsc
systemctl disable aprsc
systemctl enable aprsc@cwop
systemctl start aprsc@cwop
systemctl enable aprsc@aprsis
systemctl start aprsc@aprsis
ha5dzs commented 10 months ago

Okay, noted, thanks. I will update my docs too.