ptah-sh / ptah-server

Self-hosted alternative to Heroku
https://ptah.sh
Other
108 stars 3 forks source link

Unable to install ptah.sh with install script #239

Open txwgnd opened 2 days ago

txwgnd commented 2 days ago

Hello,

I would like to test ptah.sh but at the moment I'm unable to install it on a VPS running Ubuntu 24.04. There are two different possible outcomes I'm experiencing.

1. Case

Freshly setuped x86 VPS on Hetzner Cloud running Ubuntu 24.04. SSH into it with root user and running

curl -sSL https://r.ptah.sh/install-server | bash

Complete Log: Pastebin

Script is running normally untill this point:

 === Install ptah-agent systemd services ===

Reloading systemd...
Created symlink /etc/systemd/system/multi-user.target.wants/ptah-agent.service → /etc/systemd/system/ptah-agent.service.
Created symlink /etc/systemd/system/multi-user.target.wants/dird.service → /etc/systemd/system/dird.service.
Created symlink /etc/systemd/system/multi-user.target.wants/dird-restart.service → /etc/systemd/system/dird-restart.service.
Created symlink /etc/systemd/system/multi-user.target.wants/dird.path → /etc/systemd/system/dird.path.
Agent installation completed. Please check status on http://23.88.105.117:80.
2024/10/17 22:21:57 INFO sending started event base_url=http://23.88.105.117:80/api/_nodes/v1
2024/10/17 22:21:57 init swarm: failed to send started event: Post "http://23.88.105.117:80/api/_nodes/v1/events/started": dial tcp 23.88.105.117:80: connect: connection refused
2024/10/17 22:21:57 INFO Task %d (Type: %d) executed successfully. Result: %+v task_id=1 task_type=1 result=&{dockerIdRes:{Docker:{ID:n6yzocobed3cimanqtdao7jst}}}
2024/10/17 22:21:57 INFO Task %d (Type: %d) executed successfully. Result: %+v task_id=2 task_type=7 result=&{}
2024/10/17 22:21:57 INFO Task %d (Type: %d) executed successfully. Result: %+v task_id=3 task_type=0 result=&{dockerIdRes:{Docker:{ID:5tb9a35n44zbht5c8ct7bd4k4}}}
2024/10/17 22:21:57 INFO Task %d (Type: %d) executed successfully. Result: %+v task_id=4 task_type=2 result=&{dockerIdRes:{Docker:{ID:dexe7hue31n663xdybh0q5jqi}}}
2024/10/17 22:21:57 INFO Task %d (Type: %d) executed successfully. Result: %+v task_id=5 task_type=2 result=&{dockerIdRes:{Docker:{ID:b9cnq898e1fcuyisw1vdi4dgk}}}
2024/10/17 22:22:00 INFO Task %d (Type: %d) executed successfully. Result: %+v task_id=6 task_type=14 result="&{Output:[Pulling from ptah-sh/ptah-caddy Pulling fs layer Pulling fs layer Pulling fs layer Pulling fs layer Pulling fs layer Pulling fs layer Waiting Waiting Waiting Downloading Downloading Verifying Checksum Downloading Download complete Downloading Downloading Verifying Checksum Download complete Verifying Checksum Download complete Extracting Extracting Downloading Downloading Verifying Checksum Download complete Extracting Downloading Verifying Checksum Download complete Pull complete Extracting Extracting Extracting Pull complete Extracting Downloading Extracting Pull complete Extracting Downloading Extracting Downloading Extracting Verifying Checksum Download complete Extracting Extracting Extracting Pull complete Extracting Extracting Pull complete Extracting Extracting Extracting Extracting Extracting Extracting Pull complete Digest: sha256:132c304feeac4710e622f9e196fdcc0fc18602b703ad845764e01c111e17aadf Status: Downloaded newer image for ghcr.io/ptah-sh/ptah-caddy:latest]}"
panic: interface conversion: interface {} is nil, not *slog.Logger

goroutine 1 [running]:
github.com/ptah-sh/ptah-agent/internal/app/ptah-agent.Logger(...)
    /home/runner/work/ptah-agent/ptah-agent/internal/app/ptah-agent/logger.go:13
github.com/ptah-sh/ptah-agent/internal/app/ptah-agent.ContextWithLoggerValues({0xc30c70, 0x11f6900}, {0xc00392dc30, 0x2, 0x2})
    /home/runner/work/ptah-agent/ptah-agent/internal/app/ptah-agent/logger.go:21 +0xab
github.com/ptah-sh/ptah-agent/internal/app/ptah-agent.(*taskExecutor).launchDockerService(0xc00392ddb8, {0xc30c70, 0x11f6900}, 0xc00378f500)
    /home/runner/work/ptah-agent/ptah-agent/internal/app/ptah-agent/service.go:17 +0xc5
github.com/ptah-sh/ptah-agent/internal/app/ptah-agent.(*taskExecutor).executeTask(0xc0000450d0?, {0xc30c70?, 0x11f6900?}, {0xa04b60?, 0xc00378f500?})
    /home/runner/work/ptah-agent/ptah-agent/internal/app/ptah-agent/task_executor.go:66 +0xf1
github.com/ptah-sh/ptah-agent/internal/app/ptah-agent.(*Agent).ExecTasks(0xc000362300, {0xc30c70, 0x11f6900}, {0x7ffe7efd258a?, 0xc00003c0cb?})
    /home/runner/work/ptah-agent/ptah-agent/internal/app/ptah-agent/ptah_client.go:318 +0x3dd
main.execTasks({0x7ffe7efd258a, 0xa})
    /home/runner/work/ptah-agent/ptah-agent/cmd/ptah-agent/ptah-agent.go:128 +0x29f
main.main()
    /home/runner/work/ptah-agent/ptah-agent/cmd/ptah-agent/ptah-agent.go:39 +0x21f
root@ubuntu-4gb-nbg1-2:~#

2. Case

VPS with Ubuntu 24.04, x86 architecture, 2 network-interfaces(one for public internet, the other one on private net with 10.0.0.0/24)

After running

curl -sSL https://r.ptah.sh/install-server | bash

The script gets stuck In a loop while the user is asked to select the ethernet interface for the advertised adress

Complete Log: Pastebin

Relevant part:

=== Downloading dependencies: tasks.json, db.sql and install-agent.sh ===

=== Advertised IP addresses ===
--- for other Swarm nodes to connect to this node
--- usually a private IP address
--- read more: https://r.ptah.sh/help-advertise-addr
Please choose an IP address:
1) 23.88.105.117
2) 10.0.10.2
(Enter the number of your choice)
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
Invalid selection. Please try again.
root@ubuntu-4gb-nbg1-2:~# 
bohdan-shulha commented 1 day ago

Hi @txwgnd ,

I'm sorry it happened. I have an idea about the first one. I recently made many changes to the agent software and didn't test the full cycle of bootstrapping the service.

The second one looks suspicious. This part should work completely.

I'll post an update once I fix these.

Thank you!

bohdan-shulha commented 1 day ago

Please note, the server is not yet running, I'm continuing investigation.

For some reason, bash doesn't "want" to ask for input if the script is piped. I have tried a dozen of options for running bash & read, but nothing helped.

I have fixed the agent software, so now it doesn't crash.

Please use the following instruction to install the server:

curl -o /tmp/install-ptah-server.sh -SL https://r.ptah.sh/install-server && bash /tmp/install-ptah-server.sh
txwgnd commented 1 day ago

Hi @bohdan-shulha,

Thanks for your work. Really appreciating it! As You said the error happening with the user input seems to be solved when ran without the pipe.

Running curl -o /tmp/install-ptah-server.sh -SL https://r.ptah.sh/install-server && bash /tmp/install-ptah-server.sh still runs into some errors when I tried.

As before: Hetzner Cloud instance CX22, x86, Ubuntu 24.04, 2 nic's(1 public net, 1 private net)

Complete Output: Pastebin (Problems are at the end)

bohdan-shulha commented 1 day ago

Hey,

Please note, the server is not yet running, I'm continuing investigation.

;)

BTW, your log looks much better this time.

However, I have met an issue that the initial dump is not being imported, now investigating why.

JFYI, we're almost there with your server's config (1 public and 1 private network):

Image

bohdan-shulha commented 1 day ago

It works now. Please try again. Let me know if you have any other questions or issues.

Image

txwgnd commented 1 day ago

Hello @bohdan-shulha,

unfortunately I still encounter some problems:

When run on a VPS without a private nic, the script hangs at this point:

=== Install Docker ===
--- installation script provided by Docker and available at https://get.docker.com/
# Executing docker install script, commit: 6d51e2cd8c04b38e1c2237820245f4fc262aca6c
+ sh -c apt-get -qq update >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get -y -qq install ca-certificates curl >/dev/null
+ sh -c install -m 0755 -d /etc/apt/keyrings
+ sh -c curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" -o /etc/apt/keyrings/docker.asc
+ sh -c chmod a+r /etc/apt/keyrings/docker.asc
+ sh -c echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu noble stable" > /etc/apt/sources.list.d/docker.list
+ sh -c apt-get -qq update >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get -y -qq install docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-ce-rootless-extras docker-buildx-plugin >/dev/null

Tried it three times to make sure it persists. Console is freezing completely at this point.

When run with 2 nics there are this weird things after the finish message:

=== Install ptah-agent systemd services ===
Reloading systemd...
Created symlink /etc/systemd/system/multi-user.target.wants/ptah-agent.service → /etc/systemd/system/ptah-agent.service.
Created symlink /etc/systemd/system/multi-user.target.wants/dird.service → /etc/systemd/system/dird.service.
Created symlink /etc/systemd/system/multi-user.target.wants/dird-restart.service → /etc/systemd/system/dird-restart.service.
Created symlink /etc/systemd/system/multi-user.target.wants/dird.path → /etc/systemd/system/dird.path.
Agent installation completed. Please check status on http://23.88.105.117:80.
2024/10/18 23:27:22 INFO sending started event base_url=http://23.88.105.117:80/api/_nodes/v1
2024/10/18 23:27:22 init swarm: failed to send started event: Post "http://23.88.105.117:80/api/_nodes/v1/events/started": dial tcp 23.88.105.117:80: connect: connection refused
time=2024-10-18T23:27:22.707Z level=INFO msg="task executed successfully" task_id=1 task_type=1 result=&{dockerIdRes:{Docker:{ID:xwrwyepycs5036yjfl4nto0uv}}}
time=2024-10-18T23:27:22.743Z level=INFO msg="task executed successfully" task_id=2 task_type=7 result=&{}
time=2024-10-18T23:27:22.754Z level=INFO msg="task executed successfully" task_id=3 task_type=0 result=&{dockerIdRes:{Docker:{ID:nlk6cbo1ijv1kuinas2w9yhfg}}}
time=2024-10-18T23:27:22.756Z level=INFO msg="task executed successfully" task_id=4 task_type=2 result=&{dockerIdRes:{Docker:{ID:ywooer521vneymgx1wnwl3pam}}}
time=2024-10-18T23:27:22.758Z level=INFO msg="task executed successfully" task_id=5 task_type=2 result=&{dockerIdRes:{Docker:{ID:u4ystxceezobnnln04mzqe03k}}}
time=2024-10-18T23:27:25.323Z level=INFO msg="task executed successfully" task_id=6 task_type=14 result="&{Output:[Pulling from ptah-sh/ptah-caddy Pulling fs layer Pulling fs layer Pulling fs layer Pulling fs layer Pulling fs layer Pulling fs layer Waiting Waiting Waiting Downloading Verifying Checksum Download complete Extracting Downloading Downloading Verifying Checksum Download complete Downloading Downloading Verifying Checksum Download complete Extracting Extracting Downloading Verifying Checksum Download complete Pull complete Extracting Downloading Extracting Extracting Extracting Downloading Downloading Pull complete Extracting Extracting Pull complete Downloading Downloading Verifying Checksum Download complete Extracting Downloading Verifying Checksum Download complete Extracting Extracting Extracting Extracting Extracting Pull complete Extracting Extracting Pull complete Extracting Extracting Extracting Extracting Extracting Extracting Pull complete Digest: sha256:132c304feeac4710e622f9e196fdcc0fc18602b703ad845764e01c111e17aadf Status: Downloaded newer image for ghcr.io/ptah-sh/ptah-caddy:latest]}"

Used curl -o /tmp/install-ptah-server.sh -SL https://r.ptah.sh/install-server && bash /tmp/install-ptah-server.sh both times.

Thanks in advance, Tom

bohdan-shulha commented 23 hours ago

Hey Tom,

Thanks for the feedback. I have launched it successfully in both scenarios. Could you please run the script again and wait a few minutes?

It takes some time to download everything and wait for the services to launch.

I'll add more useful logging later so that no one else gets confused with the installation being "stuck".

Thanks!

bohdan-shulha commented 21 hours ago

Hey Tom,

I have run a couple more tests and, indeed, there is a "stuck"-like process, despite everything working fine on the second run.

There is a bug in the agent part which checks if the service has been successfully started.

I am going to fix it in a few hours. Thanks for discovering this!

txwgnd commented 10 hours ago

Hi @bohdan-shulha,

I wasn't sure if you wanted me to test it again after your second answer, but I did it anyway. I waited for the script a long time to really end itself. It actually timed out.

Ended with this gibberish:

ting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Pull complete Extracting Extracting Pull complete Extracting Extracting Pull complete Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Pull complete Extracting Extracting Pull complete Extracting Extracting Pull complete Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Extracting Pull complete Extracting Extracting Extracting Pull complete Extracting Extracting Extracting Extracting Extracting Extracting Extracting Pull complete Digest: sha256:2ab3fea36ceef5df209a7e0a9ff32b7a2bd00db5a95e5d5de40a337f942bfc02 Status: Downloaded newer image for ghcr.io/ptah-sh/ptah-server:latest]}"
2024/10/19 22:21:10 Error executing tasks: error executing task 16: launch docker service (monitor): timeout
root@ptah:~# 

We will get there! :)