Obrigado, Ed!
Mudei a permissão agora:
root@nano-app:/var/www/discourse# ls -l /etc/ssl/private/ssl-cert-snakeoil.key
-rw-r----- 1 root ssl-cert 1704 Jul 20 00:14 /etc/ssl/private/ssl-cert-snakeoil.key
Mas a reconstrução ainda falha com:
sudo ./launcher rebuild app
x86_64 arch detected.
WARNING: containers/app.yml file is world-readable. You can secure this file by running: chmod o-rwx containers/app.yml
Ensuring launcher is up to date
Fetching origin
Launcher is up-to-date
Stopping old container
+ /usr/bin/docker stop -t 60 app
app
2.0.20220818-0047: Pulling from discourse/base
Digest: sha256:7734701087766821ffb2ddcef423754798bd345c2ac0d550131c6e6905c268e8
Status: Image is up to date for discourse/base:2.0.20220818-0047
docker.io/discourse/base:2.0.20220818-0047
/usr/local/lib/ruby/gems/2.7.0/gems/pups-1.1.1/lib/pups.rb
/usr/local/bin/pups --stdin
I, [2022-11-25T17:38:07.880613 #1] INFO -- : Reading from stdin
I, [2022-11-25T17:38:07.884660 #1] INFO -- : > locale-gen $LANG && update-locale
I, [2022-11-25T17:38:07.915616 #1] INFO -- : Generating locales (this might take a while)...
Generation complete.
I, [2022-11-25T17:38:07.915833 #1] INFO -- : > mkdir -p /shared/postgres_run
I, [2022-11-25T17:38:07.918412 #1] INFO -- :
I, [2022-11-25T17:38:07.918633 #1] INFO -- : > chown postgres:postgres /shared/postgres_run
I, [2022-11-25T17:38:07.920622 #1] INFO -- :
I, [2022-11-25T17:38:07.920765 #1] INFO -- : > chmod 775 /shared/postgres_run
I, [2022-11-25T17:38:07.922483 #1] INFO -- :
I, [2022-11-25T17:38:07.922608 #1] INFO -- : > rm -fr /var/run/postgresql
I, [2022-11-25T17:38:07.924505 #1] INFO -- :
I, [2022-11-25T17:38:07.924632 #1] INFO -- : > ln -s /shared/postgres_run /var/run/postgresql
I, [2022-11-25T17:38:07.926371 #1] INFO -- :
I, [2022-11-25T17:38:07.926506 #1] INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
2022/11/25 17:38:07 socat[19] E connect(6, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): No such file or directory
I, [2022-11-25T17:38:07.930281 #1] INFO -- :
I, [2022-11-25T17:38:07.930387 #1] INFO -- : > rm -fr /shared/postgres_run/.s*
I, [2022-11-25T17:38:07.932835 #1] INFO -- :
I, [2022-11-25T17:38:07.932934 #1] INFO -- : > rm -fr /shared/postgres_run/*.pid
I, [2022-11-25T17:38:07.935169 #1] INFO -- :
I, [2022-11-25T17:38:07.935269 #1] INFO -- : > mkdir -p /shared/postgres_run/13-main.pg_stat_tmp
I, [2022-11-25T17:38:07.937189 #1] INFO -- :
I, [2022-11-25T17:38:07.937320 #1] INFO -- : > chown postgres:postgres /shared/postgres_run/13-main.pg_stat_tmp
I, [2022-11-25T17:38:07.939169 #1] INFO -- :
I, [2022-11-25T17:38:07.943171 #1] INFO -- : File > /etc/service/postgres/run chmod: +x chown:
I, [2022-11-25T17:38:07.947176 #1] INFO -- : File > /etc/service/postgres/log/run chmod: +x chown:
I, [2022-11-25T17:38:07.951156 #1] INFO -- : File > /etc/runit/3.d/99-postgres chmod: +x chown:
I, [2022-11-25T17:38:07.955181 #1] INFO -- : File > /root/upgrade_postgres chmod: +x chown:
I, [2022-11-25T17:38:07.955375 #1] INFO -- : > chown -R root /var/lib/postgresql/13/main
I, [2022-11-25T17:38:08.024558 #1] INFO -- :
I, [2022-11-25T17:38:08.024689 #1] INFO -- : > [ ! -e /shared/postgres_data ] && install -d -m 0755 -o postgres -g postgres /shared/postgres_data && sudo -E -u postgres /usr/lib/postgresql/13/bin/initdb -D /shared/postgres_data || exit 0
I, [2022-11-25T17:38:08.026753 #1] INFO -- :
I, [2022-11-25T17:38:08.026809 #1] INFO -- : > chown -R postgres:postgres /shared/postgres_data
I, [2022-11-25T17:38:08.038131 #1] INFO -- :
I, [2022-11-25T17:38:08.038249 #1] INFO -- : > chown -R postgres:postgres /var/run/postgresql
I, [2022-11-25T17:38:08.040545 #1] INFO -- :
I, [2022-11-25T17:38:08.040726 #1] INFO -- : > /root/upgrade_postgres
I, [2022-11-25T17:38:08.044864 #1] INFO -- :
I, [2022-11-25T17:38:08.045002 #1] INFO -- : > rm /root/upgrade_postgres
I, [2022-11-25T17:38:08.046952 #1] INFO -- :
I, [2022-11-25T17:38:08.047197 #1] INFO -- : Replacing data_directory = '/var/lib/postgresql/13/main' with data_directory = '/shared/postgres_data' in /etc/postgresql/13/main/postgresql.conf
I, [2022-11-25T17:38:08.047658 #1] INFO -- : Replacing (?-mix:#?listen_addresses *=.*) with listen_addresses = '*' in /etc/postgresql/13/main/postgresql.conf
I, [2022-11-25T17:38:08.047886 #1] INFO -- : Replacing (?-mix:#?synchronous_commit *=.*) with synchronous_commit = $db_synchronous_commit in /etc/postgresql/13/main/postgresql.conf
I, [2022-11-25T17:38:08.048083 #1] INFO -- : Replacing (?-mix:#?shared_buffers *=.*) with shared_buffers = $db_shared_buffers in /etc/postgresql/13/main/postgresql.conf
I, [2022-11-25T17:38:08.048276 #1] INFO -- : Replacing (?-mix:#?work_mem *=.*) with work_mem = $db_work_mem in /etc/postgresql/13/main/postgresql.conf
I, [2022-11-25T17:38:08.048520 #1] INFO -- : Replacing (?-mix:#?default_text_search_config *=.*) with default_text_search_config = '$db_default_text_search_config' in /etc/postgresql/13/main/postgresql.conf
I, [2022-11-25T17:38:08.048721 #1] INFO -- : > install -d -m 0755 -o postgres -g postgres /shared/postgres_backup
I, [2022-11-25T17:38:08.051177 #1] INFO -- :
I, [2022-11-25T17:38:08.051547 #1] INFO -- : Replacing (?-mix:#?checkpoint_segments *=.*) with checkpoint_segments = $db_checkpoint_segments in /etc/postgresql/13/main/postgresql.conf
I, [2022-11-25T17:38:08.051777 #1] INFO -- : Replacing (?-mix:#?logging_collector *=.*) with logging_collector = $db_logging_collector in /etc/postgresql/13/main/postgresql.conf
I, [2022-11-25T17:38:08.051980 #1] INFO -- : Replacing (?-mix:#?log_min_duration_statement *=.*) with log_min_duration_statement = $db_log_min_duration_statement in /etc/postgresql/13/main/postgresql.conf
I, [2022-11-25T17:38:08.052185 #1] INFO -- : Replacing (?-mix:^#local +replication +postgres +peer$) with local replication postgres peer in /etc/postgresql/13/main/pg_hba.conf
I, [2022-11-25T17:38:08.052376 #1] INFO -- : Replacing (?-mix:^host.*all.*all.*127.*$) with host all all 0.0.0.0/0 md5 in /etc/postgresql/13/main/pg_hba.conf
I, [2022-11-25T17:38:08.052547 #1] INFO -- : Replacing (?-mix:^host.*all.*all.*::1\/128.*$) with host all all ::/0 md5 in /etc/postgresql/13/main/pg_hba.conf
I, [2022-11-25T17:38:08.052696 #1] INFO -- : > HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main
I, [2022-11-25T17:38:08.054007 #1] INFO -- : > sleep 60
2022-11-25 17:38:08.085 UTC [42] FATAL: private key file "/etc/ssl/private/ssl-cert-snakeoil.key" must be owned by the database user or root
2022-11-25 17:38:08.085 UTC [42] LOG: database system is shut down
I, [2022-11-25T17:39:08.056117 #1] INFO -- :
I, [2022-11-25T17:39:08.056699 #1] INFO -- : > su postgres -c 'createdb discourse' || true
createdb: error: could not connect to database template1: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
I, [2022-11-25T17:39:08.105263 #1] INFO -- :
I, [2022-11-25T17:39:08.105431 #1] INFO -- : > su postgres -c 'psql discourse -c "create user discourse;"' || true
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
I, [2022-11-25T17:39:08.142885 #1] INFO -- :
I, [2022-11-25T17:39:08.143051 #1] INFO -- : > su postgres -c 'psql discourse -c "grant all privileges on database discourse to discourse;"' || true
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
I, [2022-11-25T17:39:08.180416 #1] INFO -- :
I, [2022-11-25T17:39:08.180582 #1] INFO -- : > su postgres -c 'psql discourse -c "alter schema public owner to discourse;"'
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
I, [2022-11-25T17:39:08.217735 #1] INFO -- :
I, [2022-11-25T17:39:08.218076 #1] INFO -- : Terminating async processes
FAILED
--------------------
Pups::ExecError: su postgres -c 'psql discourse -c "alter schema public owner to discourse;"' failed with return #<Process::Status: pid 54 exit 2>
Location of failure: /usr/local/lib/ruby/gems/2.7.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params "su postgres -c 'psql $db_name -c \"alter schema public owner to $db_user;\"'"
bootstrap failed with exit code 2
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
Quanto à forma como a permissão do snakeoil.key mudou, não sei. Houve alguma confusão na pasta var/discourse alterando permissões de usuário para root, mas eu não estava nem perto da estrutura de pastas /etc.
Verifiquei o status do docker e obtive alguns avisos aqui:
docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2022-11-25 18:47:58 CET; 5min ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 1793 (dockerd)
Tasks: 39
Memory: 118.1M
CGroup: /system.slice/docker.service
├─1793 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
├─2128 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 443 -container-ip xxx.xx.x.x -container-port 443
├─2134 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 443 -container-ip xxx.xx.x.x -container-port 443
├─2148 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 80 -container-ip xxx.xx.x.x -container-port 80
└─2155 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 80 -container-ip xxx.xx.x.x -container-port 80
nov. 25 18:47:57 nano dockerd[1793]: time="2022-11-25T18:47:57.319069348+01:00" level=warning msg="Your kernel does not support cgroup blkio weight"
nov. 25 18:47:57 nano dockerd[1793]: time="2022-11-25T18:47:57.319076217+01:00" level=warning msg="Your kernel does not support cgroup blkio weight_device"
nov. 25 18:47:57 nano dockerd[1793]: time="2022-11-25T18:47:57.319414040+01:00" level=info msg="Loading containers: start."
nov. 25 18:47:57 nano dockerd[1793]: time="2022-11-25T18:47:57.679737834+01:00" level=info msg="Default bridge (docker0) is assigned with an IP address xxx.xx.x.x . Daemon option --bip can be used to set a preferred IP address"
nov. 25 18:47:57 nano dockerd[1793]: time="2022-11-25T18:47:57.770958200+01:00" level=warning msg="auplink flush failed: " error="exec: \"auplink\": executable file not found in $PATH" method=Unmount storage-driver=aufs
nov. 25 18:47:58 nano dockerd[1793]: time="2022-11-25T18:47:58.375910870+01:00" level=info msg="Loading containers: done."
nov. 25 18:47:58 nano dockerd[1793]: time="2022-11-25T18:47:58.391980297+01:00" level=info msg="Docker daemon" commit=3056208 graphdriver(s)=aufs version=20.10.21
nov. 25 18:47:58 nano dockerd[1793]: time="2022-11-25T18:47:58.392379728+01:00" level=info msg="Daemon has completed initialization"
nov. 25 18:47:58 nano systemd[1]: Started Docker Application Container Engine.
nov. 25 18:47:58 nano dockerd[1793]: time="2022-11-25T18:47:58.470697756+01:00" level=info msg="API listen on /run/docker.sock"