sagemathinc / cocalc-docker

DEPRECATED (was -- Docker setup for running CoCalc as downloadable software on your own computer)
https://cocalc.com
Other
398 stars 103 forks source link

Fresh install of cocalc-docker fails to start up #155

Closed neverabsolute closed 2 years ago

neverabsolute commented 2 years ago

Similar to https://github.com/sagemathinc/cocalc-docker/issues/111 Also encountering this issue, docker restart cocalc and docker stop cocalc + docker start cocalc do nothing

logs on first run:

LOG: init_projects_path: initialize /projects path
LOG: creating  /projects/conf
LOG: run chmod og-rwx '/projects/conf'
chmod og-rwx '/projects/conf'
LOG: self_signed_cert
LOG: create self_signed key=/projects/conf/cert/key.pem and cert=/projects/conf/cert/cert.pem
LOG: run ['openssl', 'req', '-new', '-x509', '-nodes', '-out', '/projects/conf/cert/cert.pem', '-keyout', '/projects/conf/cert/key.pem', '-subj', '/C=US/ST=WA/L=WA/O=Network/OU=IT Department/CN=cocalc']
Generating a RSA private key
...............................................................................................................................+++++
..................................+++++
writing new private key to '/projects/conf/cert/key.pem'
-----
chdir /projects/conf/cert
openssl req -new -x509 -nodes -out /projects/conf/cert/cert.pem -keyout /projects/conf/cert/key.pem -subj "/C=US/ST=WA/L=WA/O=Network/OU=IT Department/CN=cocalc"
LOG: run chmod og-rwx /projects/conf
chmod og-rwx /projects/conf
LOG: root_ssh_keys: creating them
LOG: run rm -rf /root/.ssh/
rm -rf /root/.ssh/
LOG: run ssh-keygen -t ecdsa -N '' -f /root/.ssh/id_ecdsa
Generating public/private ecdsa key pair.
Created directory '/root/.ssh'.
Your identification has been saved in /root/.ssh/id_ecdsa
Your public key has been saved in /root/.ssh/id_ecdsa.pub
The key fingerprint is:
SHA256:K1aGcyT3gszN20MbY0b7Sg8/QGkiqr99L31r4hCUMxc root@7bb2e329c7a9
The key's randomart image is:
+---[ECDSA 256]---+
|          E      |
|         . .     |
|      . B o.     |
|     o.X.*+.     |
|     .*.S+O      |
|    .  = X.=     |
|   .  o +.*..    |
|  .  o .ooo*+    |
|   .o... ++++o   |
+----[SHA256]-----+
ssh-keygen -t ecdsa -N '' -f /root/.ssh/id_ecdsa
LOG: run cp -v /root/.ssh/id_ecdsa.pub /root/.ssh/authorized_keys
'/root/.ssh/id_ecdsa.pub' -> '/root/.ssh/authorized_keys'
cp -v /root/.ssh/id_ecdsa.pub /root/.ssh/authorized_keys
LOG: start_ssh
LOG: starting ssh
LOG: run service ssh start
 * Starting OpenBSD Secure Shell server sshd
   ...done.
service ssh start
LOG: start_postgres
LOG: postgres_perms: ensuring postgres directory perms are sufficiently restrictive
LOG: run mkdir -p /projects/postgres && chown -R sage. /projects/postgres && chmod og-rwx -R /projects/postgres
mkdir -p /projects/postgres && chown -R sage. /projects/postgres && chmod og-rwx -R /projects/postgres
LOG: start_postgres: create data directory  /projects/postgres/data
LOG: run sudo -u sage /usr/lib/postgresql/10/bin/pg_ctl init -D '/projects/postgres/data'
The files belonging to this database system will be owned by user "sage".
This user must also own the server process.

The database cluster will be initialized with locale "C.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

creating directory /projects/postgres/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... Etc/UTC
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
syncing data to disk ... ok

Success. You can now start the database server using:

    /usr/lib/postgresql/10/bin/pg_ctl -D /projects/postgres/data -l logfile start

sudo -u sage /usr/lib/postgresql/10/bin/pg_ctl init -D '/projects/postgres/data'
LOG: postgres_perms: ensuring postgres directory perms are sufficiently restrictive
LOG: run mkdir -p /projects/postgres && chown -R sage. /projects/postgres && chmod og-rwx -R /projects/postgres
mkdir -p /projects/postgres && chown -R sage. /projects/postgres && chmod og-rwx -R /projects/postgres
LOG: run sudo -u sage /usr/lib/postgresql/10/bin/postgres -D '/projects/postgres/data' >/projects/postgres/data/postgres.log 2>&1 &
sudo -u sage /usr/lib/postgresql/10/bin/postgres -D '/projects/postgres/data' >/projects/postgres/data/postgres.log 2>&1 &
LOG: run sudo -u sage /usr/lib/postgresql/10/bin/createuser -h '/projects/postgres/data/socket' -sE smc
sudo -u sage /usr/lib/postgresql/10/bin/createuser -h '/projects/postgres/data/socket' -sE smc
LOG: run sudo -u sage kill 47
sudo -u sage kill 47
LOG: start_postgres: starting the server
LOG: start_hub
LOG: run pkill -f cocalc-hub-server
pkill -f cocalc-hub-server
LOG: run mkdir -p /var/log/hub && cd /cocalc/src/packages/hub && npm run hub-docker-prod > /var/log/hub/out 2>/var/log/hub/err &
mkdir -p /var/log/hub && cd /cocalc/src/packages/hub && npm run hub-docker-prod > /var/log/hub/out 2>/var/log/hub/err &
LOG: reset_project_state: ensuring all projects are set as opened (not running) in the database
LOG: run echo "update projects set state='{\"state\":\"opened\"}';" | psql -t
psql: FATAL:  the database system is starting up
echo "update projects set state='{\"state\":\"opened\"}';" | psql -t
LOG: run echo "update projects set state='{\"state\":\"opened\"}';" | psql -t
psql: FATAL:  database "smc" does not exist
echo "update projects set state='{\"state\":\"opened\"}';" | psql -t
LOG: run echo "update projects set state='{\"state\":\"opened\"}';" | psql -t
psql: FATAL:  database "smc" does not exist
echo "update projects set state='{\"state\":\"opened\"}';" | psql -t
LOG: run echo "update projects set state='{\"state\":\"opened\"}';" | psql -t
UPDATE 0
echo "update projects set state='{\"state\":\"opened\"}';" | psql -t
LOG: waiting for all subprocesses to complete...
LOG: waiting for all subprocesses to complete...

logs after restart:

LOG: init_projects_path: initialize /projects path
LOG: self_signed_cert
LOG: ssl key and cert exist, so doing nothing further
LOG: root_ssh_keys: creating them
LOG: run rm -rf /root/.ssh/
rm -rf /root/.ssh/
LOG: run ssh-keygen -t ecdsa -N '' -f /root/.ssh/id_ecdsa
Generating public/private ecdsa key pair.
Created directory '/root/.ssh'.
Your identification has been saved in /root/.ssh/id_ecdsa
Your public key has been saved in /root/.ssh/id_ecdsa.pub
The key fingerprint is:
SHA256:48L1nRg05kFwIFvy+vgdgqf2WghvHnVLIAcgRQNclWU root@7bb2e329c7a9
The key's randomart image is:
+---[ECDSA 256]---+
| .o=*o=oEoo      |
|  .. ..O o       |
|      o + =      |
|       + = o     |
|    . . S =      |
|     + O = = .   |
|      X * = o    |
|     o.B o .     |
|     .+oo .      |
+----[SHA256]-----+
ssh-keygen -t ecdsa -N '' -f /root/.ssh/id_ecdsa
LOG: run cp -v /root/.ssh/id_ecdsa.pub /root/.ssh/authorized_keys
'/root/.ssh/id_ecdsa.pub' -> '/root/.ssh/authorized_keys'
cp -v /root/.ssh/id_ecdsa.pub /root/.ssh/authorized_keys
LOG: start_ssh
LOG: starting ssh
LOG: run service ssh start
 * Starting OpenBSD Secure Shell server sshd
   ...done.
service ssh start
LOG: start_postgres
LOG: postgres_perms: ensuring postgres directory perms are sufficiently restrictive
LOG: run mkdir -p /projects/postgres && chown -R sage. /projects/postgres && chmod og-rwx -R /projects/postgres
mkdir -p /projects/postgres && chown -R sage. /projects/postgres && chmod og-rwx -R /projects/postgres
LOG: start_postgres: starting the server
LOG: start_hub
LOG: run pkill -f cocalc-hub-server
pkill -f cocalc-hub-server
LOG: run mkdir -p /var/log/hub && cd /cocalc/src/packages/hub && npm run hub-docker-prod > /var/log/hub/out 2>/var/log/hub/err &
mkdir -p /var/log/hub && cd /cocalc/src/packages/hub && npm run hub-docker-prod > /var/log/hub/out 2>/var/log/hub/err &
LOG: reset_project_state: ensuring all projects are set as opened (not running) in the database
LOG: run echo "update projects set state='{\"state\":\"opened\"}';" | psql -t
psql: FATAL:  the database system is starting up
echo "update projects set state='{\"state\":\"opened\"}';" | psql -t
LOG: run echo "update projects set state='{\"state\":\"opened\"}';" | psql -t
UPDATE 0
echo "update projects set state='{\"state\":\"opened\"}';" | psql -t
LOG: waiting for all subprocesses to complete...

looks like the hub server doesn't wait long enough for the internal pqsl server to set itself up?

to start the container I ran docker run --name=cocalc --restart=always -d -v /home/ubuntu/cocalc:/projects -p 9000:443 sagemathinc/cocalc

neverabsolute commented 2 years ago

I'm stupid, went to http://localhost:9000 vs https://localhost:9000