Try to run script-server on ubuntu-server
Hi @bugy congrats for this amazing tool.
I'm trying to use script-server for my job but i'm stuck in a loop. My goal is to run the scripts present on a ubuntu-server machine from the script-server broswer interface.
To do that I installed script-server on the remote machine and ran the launcher in a docker container, as mentioned here. Thanks to that I'm able to open the localhost:5000 page and run the scripts.
Now i have three problems:
- When i close the ssh terminal, the web page crash
-
If I try to run the launcher.py as service, exactly as mentioned here, the service does not start (or if start, when i close the terminal it crash), whether I specify ExecStart with python command (
ExecStart=sudo /home/server/.python_venv/script-server/bin/python /home/server/projects/script-server/launcher.py) or via docker
(ExecStart=/usr/bin/docker run -d -p 5000:5000 -v /host/path/to/conf.json:/app/conf/conf.json -v /host/path/to/runners/:/app/conf/runners -v /host/path/to/scripts/:/app/custom_projects/ bugy/script-server:1.18.0). -
The only web page that i can succesfully use is the localhost page and not the ip server page. Infact, even if i specify the server ip in the "address" field of conf.json, the page doesn't open.
For example this is my conf.json:
I know these are a lot of questions, but your help would be greatly appreciated. Thanks
Your docker mounts are possibly incorrect...
The /app/conf/whatever paths should be edited to wherever those conf files live /in your live filesystem/. Same for the path to your scripts, you need a location in your live filesystem to mount into the container. I don't know if symlinks or hardlinks would work properly (so, like, creating a repo directory of "scripts to present in SS", with links to wherever those scripts live on the filesystem), or if you'll actually need to keep the actual scripts in that directory, but you can troubleshoot that later.
On Wed, Jan 29, 2025, 12:23 PM Adriano Palumbo @.***> wrote:
Hi @bugy https://github.com/bugy congrats for this amazing tool. I'm trying to use script-server for my job but i'm stuck in a loop. My goal is to run the scripts present on a ubuntu-server machine from the script-server broswer interface. To do that I installed script-server on the remote machine and ran the launcher in a docker container, as mentioned here https://github.com/bugy/script-server/issues/171#issuecomment-461620836. Thanks to that I'm able to open the localhost:5000 page and run the scripts.
Screenshot.2025-01-29.180155.png (view on web) https://github.com/user-attachments/assets/2d91aea6-4707-49f6-8a21-66867e7d3f2d
Now i have three problems:
- When i close the ssh terminal, the web page crash
Screenshot.2025-01-29.180437.png (view on web) https://github.com/user-attachments/assets/7fb9d540-5a3e-46c4-9b18-260fe6156590
If I try to run the launcher.py as service, exactly as mentioned here https://github.com/bugy/script-server/wiki/Running-as-a-linux-service#systemd, the service does not start (or if start, when i close the terminal it crash), whether I specify ExecStart with python command (ExecStart=sudo /home/server/.python_venv/script-server/bin/python /home/server/projects/script-server/launcher.py) or via docker (ExecStart=/usr/bin/docker run -d -p 5000:5000 -v /host/path/to/conf.json:/app/conf/conf.json -v /host/path/to/runners/:/app/conf/runners -v /host/path/to/scripts/:/app/custom_projects/ bugy/script-server:1.18.0 ). 3.
The only web page that i can succesfully use is the localhost page and not the ip server page. Infact, even if i specify the server ip in the "address" field of conf.json, the page doesn't open. For example this is my conf.json:
Screenshot.2025-01-29.181557.png (view on web) https://github.com/user-attachments/assets/d736da0c-6a68-4bef-a8fd-4736dd68e4f7
I know these are a lot of questions, but your help would be greatly appreciated. Thanks
— Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/781, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3HBI3SYRSZGRE4YVXYLEZD2NEFAVAVCNFSM6AAAAABWDMJR7CVHI2DSMVQWIX3LMV43ASLTON2WKOZSHAYTQOBRGE2TQOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Oops, got those backwards.
The /app/conf/* and /app/custom_projects are the mounts in the container. The /host/path/to/* paths are the ones that need to point to the outside-of-docker files on your filesystem.
On Wed, Jan 29, 2025, 12:30 PM Mark Neill @.***> wrote:
Your docker mounts are possibly incorrect...
The /app/conf/whatever paths should be edited to wherever those conf files live /in your live filesystem/. Same for the path to your scripts, you need a location in your live filesystem to mount into the container. I don't know if symlinks or hardlinks would work properly (so, like, creating a repo directory of "scripts to present in SS", with links to wherever those scripts live on the filesystem), or if you'll actually need to keep the actual scripts in that directory, but you can troubleshoot that later.
On Wed, Jan 29, 2025, 12:23 PM Adriano Palumbo @.***> wrote:
Hi @bugy https://github.com/bugy congrats for this amazing tool. I'm trying to use script-server for my job but i'm stuck in a loop. My goal is to run the scripts present on a ubuntu-server machine from the script-server broswer interface. To do that I installed script-server on the remote machine and ran the launcher in a docker container, as mentioned here https://github.com/bugy/script-server/issues/171#issuecomment-461620836. Thanks to that I'm able to open the localhost:5000 page and run the scripts.
Screenshot.2025-01-29.180155.png (view on web) https://github.com/user-attachments/assets/2d91aea6-4707-49f6-8a21-66867e7d3f2d
Now i have three problems:
- When i close the ssh terminal, the web page crash
Screenshot.2025-01-29.180437.png (view on web) https://github.com/user-attachments/assets/7fb9d540-5a3e-46c4-9b18-260fe6156590
If I try to run the launcher.py as service, exactly as mentioned here https://github.com/bugy/script-server/wiki/Running-as-a-linux-service#systemd, the service does not start (or if start, when i close the terminal it crash), whether I specify ExecStart with python command (ExecStart=sudo /home/server/.python_venv/script-server/bin/python /home/server/projects/script-server/launcher.py) or via docker (ExecStart=/usr/bin/docker run -d -p 5000:5000 -v /host/path/to/conf.json:/app/conf/conf.json -v /host/path/to/runners/:/app/conf/runners -v /host/path/to/scripts/:/app/custom_projects/ bugy/script-server:1.18.0 ). 3.
The only web page that i can succesfully use is the localhost page and not the ip server page. Infact, even if i specify the server ip in the "address" field of conf.json, the page doesn't open. For example this is my conf.json:
Screenshot.2025-01-29.181557.png (view on web) https://github.com/user-attachments/assets/d736da0c-6a68-4bef-a8fd-4736dd68e4f7
I know these are a lot of questions, but your help would be greatly appreciated. Thanks
— Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/781, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3HBI3SYRSZGRE4YVXYLEZD2NEFAVAVCNFSM6AAAAABWDMJR7CVHI2DSMVQWIX3LMV43ASLTON2WKOZSHAYTQOBRGE2TQOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Hi @adripalu
Regarding 1 and 2: how do you run script server? Do you just ssh and then run launcher from a command line? Could it be related? https://www.reddit.com/r/docker/comments/r53hsh/docker_goes_to_sleep_as_soon_as_i_quit_the_ssh/
Regarding 3: did you try to run any other remote services? When you are in your ssh session, can you try wget your_server_ip:5000/index.html (you can use curl instead of wget)
Also don't use address option. It's too complicated under docker. Default setting is the most permissive one
Thanks for the answers
@MNeill73
Yes, /app/conf/* and /app/custom_projects are the path mounted in the container and /host/path/to/* are the path in the ssh filesystem.
Are you saying that I should mount the paths of my local filesystem on docker container and not the paths of the ssh filesystem?
@bugy
1-2) Yes, i just access to the server with ssh and then run the launcher via cli (docker or python env).
Yes, my issue is exactly the same of the link. I tried to run the launcher in the tmux session as suggested there, but still the same problems: when i close ssh the web page crash.
3) I tried to wget/curl http://ip_erver/index.html and it doesn't work, but it works with http://0.0.0.0:5000 (default conf.json, no address specified).
I also tried to run the launcher with nohup with the following commands:
nohup /home/server/.python_venv/script-server/bin/python /home/server/projects/script-server/launcher.py > nohup.out & or nohup docker run -d -p 5000:5000 -v /host/path/to/conf.json:/app/conf/conf.json -v /host/path/to/runners/:/app/conf/runners -v /host/path/to/scripts/:/app/custom_projects/ bugy/script-server:1.18.0 > nohup.out & but the web page (if start) still crash after exit from ssh.
I'd like to have SS running as service (with docker o python script) to have it always up and running. Infact, the ultimate goal is to allow my colleagues to run my scripts on SS from their PCs when I'm not present in the lab
- I tried to wget/curl http://ip_erver/index.html and it doesn't work, but it works with http://0.0.0.0:5000/ (default conf.json, no address specified).
Did you specify the port? http://ip_erver/index.html it's not here
Yes, my issue is exactly the same of the link. I tried to run the launcher in the tmux session as suggested there
I think the correct way to go is to run script server as a service. Which error do you get, when you try to run it as a service?
@bugy
Yes i specified the default port (5000), i just forget to mention it in the last message, I'm sorry.
Ok I'm going to run it again as a service. Do you suggest to run the launcher with the docker or with the python env ?
Should I use "address" with the server ip or it's better to leave the default conf.json?
Run it as a python for simplicity And use default conf
This is my conf.json file
{
"title" : "Pipelines runner"
}
this is the script-server.service file:
[Unit]
Description=Script Server
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
ExecStart=/home/server/.python_venv/script-server/bin/python /home/server/projects/script-server/launcher.py
[Install]
WantedBy=multi-user.target
actived with:
systemctl enable script-server.service
systemctl start script-server.service
As you can see below, the service succesfully started and the web page works.
● script-server.service - Script Server
Loaded: loaded (/usr/lib/systemd/system/script-server.service; enabled; preset: enabled)
Active: active (running) since Thu 2025-01-30 14:18:51 UTC; 6min ago
Main PID: 1703920 (python)
Tasks: 4 (limit: 230383)
Memory: 20.0M (peak: 20.4M)
CPU: 263ms
CGroup: /system.slice/script-server.service
└─1703920 /home/server/.python_venv/script-server/bin/python /home/server/projects/script-server/launcher.py
Jan 30 14:18:51 ubuntu systemd[1]: Started script-server.service - Script Server.
Jan 30 14:18:51 ubuntu python[1703920]: 2025-01-30 14:18:51,556 [root.INFO] Starting Script Server, v1.18.0
Jan 30 14:18:51 ubuntu python[1703920]: 2025-01-30 14:18:51,561 [asyncio.DEBUG] Using selector: EpollSelector
Jan 30 14:19:25 ubuntu python[1703920]: Server is running on: http://0.0.0.0:5000
Jan 30 14:19:25 ubuntu python[1703920]: 2025-01-30 14:19:25,322 [tornado.access.INFO] 302 GET / (127.0.0.1) 0.55ms
Jan 30 14:19:25 ubuntu python[1703920]: 2025-01-30 14:19:25,341 [tornado.general.ERROR] Could not open static file '/home/server/projects/script-server/conf/theme/theme.css'
Jan 30 14:19:25 ubuntu python[1703920]: 2025-01-30 14:19:25,341 [tornado.access.INFO] 200 GET /theme/theme.css (127.0.0.1) 0.70ms
Jan 30 14:19:25 ubuntu python[1703920]: 2025-01-30 14:19:25,417 [tornado.access.INFO] 304 GET /auth/info (127.0.0.1) 0.75ms
Jan 30 14:19:25 ubuntu python[1703920]: 2025-01-30 14:19:25,420 [tornado.access.INFO] 304 GET /conf (127.0.0.1) 0.41ms
Jan 30 14:19:25 ubuntu python[1703920]: 2025-01-30 14:19:25,425 [tornado.access.INFO] 304 GET /scripts (127.0.0.1) 1.37ms
Jan 30 14:19:25 ubuntu python[1703920]: 2025-01-30 14:19:25,429 [tornado.access.INFO] 304 GET /executions/active (127.0.0.1) 0.80ms
Jan 30 14:19:28 ubuntu python[1703920]: 2025-01-30 14:19:28,315 [tornado.access.INFO] 200 GET /theme/theme.css (127.0.0.1) 1.28ms
Jan 30 14:19:28 ubuntu python[1703920]: 2025-01-30 14:19:28,358 [tornado.access.INFO] 304 GET /auth/info (127.0.0.1) 1.29ms
Jan 30 14:19:28 ubuntu python[1703920]: 2025-01-30 14:19:28,359 [tornado.access.INFO] 304 GET /executions/active (127.0.0.1) 1.08ms
Jan 30 14:19:28 ubuntu python[1703920]: 2025-01-30 14:19:28,362 [tornado.access.INFO] 304 GET /scripts (127.0.0.1) 2.04ms
Jan 30 14:19:28 ubuntu python[1703920]: 2025-01-30 14:19:28,363 [tornado.access.INFO] 304 GET /conf (127.0.0.1) 1.07ms
Again, when i close the ssh the web crash as the photo posted above.
Just to double check: are you sure, that your server keeps running after you close ssh? What kind of the server do you have?
Yes I'm 100% sure that the server keeps running after I close ssh.
The server is Ubuntu 24.04.1 LTS.
Searching on web here, here2, here3 I'm thinking that maybe it's a normal systemd/ssh behaviour that I must change.
Anyway, the problem to the server ip still remain, infact i can connect only to localhost.
Anyway, the problem to the server ip still remain, infact i can connect only to localhost.
to double-check, is ifconfig showing the same IP, as you are trying to access?
May be there is some external gateway, which assigns the IP and server is not aware of it. The first step we must achieve is to make wget work locally (in SSH session)
Yes the IP is the same as the one I am trying to access.
I tried nohup, tmux , loginctl enable-linger commands, switch the service from /lib/systemd/system/ to /etc/systemd/system/...but nothing. In addition, it appears that the service is tied to the vscode window from which I have ssh access to the server.
I think is a service/server related issue.
Still open to any suggestions.