Skip to content

add a new location for Russia#57

Merged
ZetaMap merged 1 commit into
xpdustry:mainfrom
TOWUK:patch-1
Jun 27, 2026
Merged

add a new location for Russia#57
ZetaMap merged 1 commit into
xpdustry:mainfrom
TOWUK:patch-1

Conversation

@TOWUK

@TOWUK TOWUK commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

server based on 4c75f4b commit (Jun 19)

@TOWUK

TOWUK commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

I use systemD to run node smoothly, maybe someone knows how to improve it or is it good too?
[Unit]
Description=CLAJ Server
After=network.target
[Service]
Type=simple
User=root
Group=root
WorkingDirectory=/root/claj
ExecStart=/usr/bin/java -Xms256M -Xmx256M -jar claj-server.jar 1111
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target

@ZetaMap

ZetaMap commented Jun 23, 2026

Copy link
Copy Markdown
Member

mm why not but the name is a little bit too long, "MindCup Russia" is better no?
also why not using a service but a good practice is to avoid a much as possible to run a program as root. you can try to create a user just for that and place the server in a more appropriate folder, instead of the root homedir. or you can use docker if you want.
anyway @lapin-b what do you think about his service file, as you done the same thing?

@ZetaMap ZetaMap added the server location New public server(s) request label Jun 23, 2026
@TOWUK

TOWUK commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

yes, I know, the practice for the user is their own service, but there is nothing on this machine, and unfortunately I did not study linux well, logging into the same ssh with a key, as indicated by the hoster (from whom I rented a VDS)

@TOWUK

TOWUK commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

let's do this, you tell me how to do it in linux os - I'll do it and run it, fortunately there are enough resources

@ZetaMap

ZetaMap commented Jun 25, 2026

Copy link
Copy Markdown
Member

XD you absolutely want to put contry+region. For moment the region is useless, you just need to name your server Node name+country.

@ZetaMap

ZetaMap commented Jun 25, 2026

Copy link
Copy Markdown
Member

And for your service you can create a new user by doing "adduser claj", and then change the root user into your service, by claj. also you can move the server to the opt folder by doing "mkdit /opt/claj; mv /root/claj-server.jar /opt/claj", and then change the working directory to that one. And to finish, set the permissions by doing "chow claj:claj -R /opt/claj".

This should work.

@TOWUK

TOWUK commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

systemctl status claj.service

● claj.service - CLAJ Server
Loaded: loaded (/etc/systemd/system/claj.service; enabled; preset: enabled)
Active: active (running) since Thu 2026-06-25 12:51:49 UTC; 6s ago
Invocation: eb7d4a8353dd4746b1edb635f7423859
Main PID: 71821 (java)
Tasks: 20 (limit: 2315)
Memory: 41.8M (peak: 42.3M)
CPU: 484ms
CGroup: /system.slice/claj.service
└─71821 /usr/bin/java -Xms256M -Xmx256M -jar claj-server.jar 1111

Jun 25 12:51:49 joni systemd[1]: Started claj.service - CLAJ Server.
Jun 25 12:51:49 joni java[71821]: [25-06-2026 12:51:49] [I] Server loaded and hosted on port 1111. Type 'help' for help.

GNU nano 8.4 /etc/systemd/system/claj.service

[Unit]
Description=CLAJ Server
After=network.target
[Service]
Type=simple
User=claj
Group=claj
WorkingDirectory=/home/claj
ExecStart=/usr/bin/java -Xms256M -Xmx256M -jar claj-server.jar 1111
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target

@TOWUK

TOWUK commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

it is usually customary to specify the region in Russia, because it happens that in the east (Kamchatka/border with China) the US ping is less than in Russia itself on the border of Finland (west / St. Petersburg)

@TOWUK

TOWUK commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

is it possible to run it somehow but with access to the console? but not through tmux/screen solutions?

@ZetaMap

ZetaMap commented Jun 25, 2026

Copy link
Copy Markdown
Member

@lapin-b can you help about that? you done the same thing.

@lapin-b

lapin-b commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

is it possible to run it somehow but with access to the console? but not through tmux/screen solutions?

@TOWUK Yes you can. According to systemd's docs, you create a .socket file with the same name of the server (that would be claj.socket for you) that creates a named pipe, then you wire the standard input into that pipe. My setup is as follows.

The "socket" file:

# New file at /etc/systemd/system/claj.socket
[Unit]
Description = Socket to communicate with claj.service

[Socket]
ListenFIFO=/run/claj.fifo
# The FIFO (named pipe) is not removed when the socket exits
ExecStopPost = /bin/rm -f /run/claj.fifo
SocketUser=claj
SocketGroup=root

Then you add the following contents after the [Service] section of your claj.service.

StandardInput=socket
StandardOutput=journal
StandardError=journal

To interact with the server standard input, you write things into /run/claj.fifo and then you read the journal that should contain the output. The command I use for that is the following:

# Write stuff into the named pipe, wait for a little bit, get the output from the journal
echo rooms > /run/claj.fifo ; sleep 0.1 ; journalctl --no-pager -eu claj

@ZetaMap ZetaMap force-pushed the patch-1 branch 3 times, most recently from 436b577 to daeb123 Compare June 27, 2026 13:59
@ZetaMap

ZetaMap commented Jun 27, 2026

Copy link
Copy Markdown
Member

commits squashed, i accept.
please also note that your node must have a good uptime, by that i mean if your node is always down or it is for too long, i will remove it (after some warnings indeed).
and also don't forget to check sometimes for updates, as the server doesn't have an auto-updater, you will have to download the latest version each time a new release comes.

@ZetaMap ZetaMap merged commit 2ab6de3 into xpdustry:main Jun 27, 2026
@TOWUK

TOWUK commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

commits squashed, i accept. please also note that your node must have a good uptime, by that i mean if your node is always down or it is for too long, i will remove it (after some warnings indeed). and also don't forget to check sometimes for updates, as the server doesn't have an auto-updater, you will have to download the latest version each time a new release comes.

okay, thanks, I'll try to maintain stability and availability, as well as update the claj server build approximately every 2 weeks (locally build on a PC from the current repository and upload to the server)

@TOWUK

TOWUK commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

I also studied the issue of interaction with AI, and he told me how to do it using the above method with a socket:

/etc/systemd/system/claj.socket :

[Socket]
ListenFIFO=/run/claj.fifo
SocketUser=claj
SocketGroup=claj
SocketMode=0660
RemoveOnStop=true

/etc/systemd/system/claj.service :

[Unit]
Description=CLaJ Server
Requires=claj.socket
After=network.target

[Service]
User=claj
Group=claj

WorkingDirectory=/home/claj
ExecStart=/usr/bin/java -Xms256M -Xmx256M -jar claj-server.jar 1111

StandardInput=socket
StandardOutput=journal
StandardError=journal

Restart=always
RestartSec=5
StartLimitIntervalSec=60
StartLimitBurst=5

[Install]
WantedBy=multi-user.target

/usr/local/bin/claj :

#!/usr/bin/env bash
set -euo pipefail

FIFO="/run/claj.fifo"
SERVICE="claj.service"

if ! systemctl is-active --quiet "$SERVICE"; then
    echo "ERROR: $SERVICE NOT RUNNING!" >&2
    exit 1
fi

if [ ! -p "$FIFO" ]; then
    echo "ERROR: $FIFO DOES NOT EXIST" >&2
    exit 1
fi

if [ "$EUID" -ne 0 ]; then
    echo "$@" | sudo tee "$FIFO" > /dev/null
else
    echo "$@" > "$FIFO"
fi

sleep 1

if [ "$EUID" -ne 0 ]; then
    sudo journalctl -q -u "$SERVICE" --since "5 seconds ago" --no-pager
else
    journalctl -q -u "$SERVICE" --since "5 seconds ago" --no-pager
fi

chmod +x /usr/local/bin/claj + crontab -e

TZ=Europe/Moscow

58 2 * * * timeout 5 sh -c '[ -p /run/claj.fifo ] && echo "say all Global restart after 2 minutes (3:00 MSK)" > /run/claj.fifo
0 3 * * * systemctl restart claj.service

@TOWUK TOWUK deleted the patch-1 branch June 27, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

server location New public server(s) request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants