Non è la mia prima installazione di Discourse, ma sono riuscito a bloccarmi dopo tre tentativi di eseguire una installazione standard su un droplet Digital Ocean (1GB NVMe SSD Premium AMD) con Ubuntu 22.04 LTS. Ho seguito la guida e fornito un indirizzo email per LetsEncrypt, come ho fatto molte volte in passato. Dopo che l’installazione di Discourse non è apparsa nel browser (né tramite il record A né tramite l’IP diretto del droplet), ho confermato che l’installazione rifiuta le connessioni sia sulle porte http che https e da allora mi sto dando alla pazza gioia.
L’unica cosa strana che ho notato durante l’installazione è che Docker non era preinstallato sul droplet di Digital Ocean e mi ha chiesto di installarlo dopo aver rilevato che il clone git del contenitore Discourse lo richiedeva. A parte questo, ho proceduto come al solito e ho testato sia Docker che l’installazione di Discourse.
Buone notizie - Discourse esegue correttamente il test di recapito delle email, il che implica che l’installazione è presente e in esecuzione, e Docker sembra funzionare bene (dopo aver eseguito “docker run -it --rm hello-world”). Ho anche fatto il ping a github.com e ho ricevuto risposte, quindi non sembra esserci un problema di firewall o di connettività.
Problema: connessioni rifiutate
Tuttavia, l’esecuzione di “curl -v localhost:8080” restituisce:
* Trying 127.0.0.1:8080...
* connect to 127.0.0.1 port 8080 failed: Connection refused
* Trying ::1:8080...
* connect to ::1 port 8080 failed: Connection refused
* Failed to connect to localhost port 8080 after 1 ms: Connection refused
* Closing connection 0
curl -v localhost restituisce:
* Trying 127.0.0.1:80...
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET / HTTP/1.1
> Host: localhost
> User-Agent: curl/7.81.0
> Accept: */*
>
* Empty reply from server
* Closing connection 0
curl: (52) Empty reply from server
Ecco il mio file app.yml e i risultati dell’esecuzione di discourse-doctor:
app.yml
## Quanti richieste web simultanee sono supportate? Dipende dalla memoria e dai core della CPU.
## verrà impostato automaticamente da bootstrap in base alle CPU rilevate, oppure puoi sovrascriverlo
UNICORN_WORKERS: 2
## TODO: Il nome di dominio a cui risponderà questa istanza di Discourse
## Obbligatorio. Discourse non funzionerà con un semplice numero IP.
DISCOURSE_HOSTNAME: community.example.io
## Decommenta se vuoi che il contenitore venga avviato con lo stesso
## hostname (-h option) come specificato sopra (default "$hostname-$config")
#DOCKER_USE_HOSTNAME: true
## TODO: Elenco di email separate da virgola che diventeranno amministratori e sviluppatori
## all'iscrizione iniziale, ad esempio 'user1@example.com,user2@example.com'
DISCOURSE_DEVELOPER_EMAILS: 'example@example.com'
## TODO: Il server SMTP utilizzato per validare i nuovi account e inviare notifiche
## INDIRIZZO SMTP, nome utente e password sono obbligatori
## ATTENZIONE: il carattere '#' nella password SMTP può causare problemi!
DISCOURSE_SMTP_ADDRESS: smtp.mailgun.org
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: no-reply@example.io
DISCOURSE_SMTP_PASSWORD: "XXXXXX"
#DISCOURSE_SMTP_ENABLE_START_TLS: true # (opzionale, default true)
DISCOURSE_SMTP_DOMAIN: community.example.io
DISCOURSE_NOTIFICATION_EMAIL: noreply@community.example.io
## Se hai aggiunto il modello Lets Encrypt, decommenta qui sotto per ottenere un certificato SSL gratuito
LETSENCRYPT_ACCOUNT_EMAIL: example@example.com
## L'indirizzo CDN http o https per questa istanza di Discourse (configurato per il recupero)
## vedi https://meta.discourse.org/t/14857 per i dettagli
#DISCOURSE_CDN_URL: https://discourse-cdn.example.com
## La chiave IP di geolocalizzazione MaxMind per la ricerca degli indirizzi IP
## vedi https://meta.discourse.org/t/-/137387/23 per i dettagli
DISCOURSE_MAXMIND_LICENSE_KEY: XXXXX
## Il contenitore Docker è senza stato; tutti i dati sono memorizzati in /shared
volumes:
- volume:
host: /var/discourse/shared/standalone
guest: /shared
- volume:
## TODO: Il nome di dominio a cui risponderà questa istanza di Discourse
## Obbligatorio. Discourse non funzionerà con un semplice numero IP.
DISCOURSE_HOSTNAME: community.example.io
## Decommenta se vuoi che il contenitore venga avviato con lo stesso
## hostname (-h option) come specificato sopra (default "$hostname-$config")
#DOCKER_USE_HOSTNAME: true
## TODO: Elenco di email separate da virgola che diventeranno amministratori e sviluppatori
## all'iscrizione iniziale, ad esempio 'user1@example.com,user2@example.com'
DISCOURSE_DEVELOPER_EMAILS: 'example@example.com'
## TODO: Il server SMTP utilizzato per validare i nuovi account e inviare notifiche
## INDIRIZZO SMTP, nome utente e password sono obbligatori
## ATTENZIONE: il carattere '#' nella password SMTP può causare problemi!
DISCOURSE_SMTP_ADDRESS: smtp.mailgun.org
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: no-reply@example.io
DISCOURSE_SMTP_PASSWORD: "XXXXXXXX"
#DISCOURSE_SMTP_ENABLE_START_TLS: true # (opzionale, default true)
DISCOURSE_SMTP_DOMAIN: community.example.io
DISCOURSE_NOTIFICATION_EMAIL: noreply@community.example.io
## Se hai aggiunto il modello Lets Encrypt, decommenta qui sotto per ottenere un certificato SSL gratuito
LETSENCRYPT_ACCOUNT_EMAIL: example@example.com
## L'indirizzo CDN http o https per questa istanza di Discourse (configurato per il recupero)
## vedi https://meta.discourse.org/t/14857 per i dettagli
#DISCOURSE_CDN_URL: https://discourse-cdn.example.com
## La chiave IP di geolocalizzazione MaxMind per la ricerca degli indirizzi IP
## vedi https://meta.discourse.org/t/-/137387/23 per i dettagli
DISCOURSE_MAXMIND_LICENSE_KEY: XXXXXX
## Il contenitore Docker è senza stato; tutti i dati sono memorizzati in /shared
volumes:
- volume:
host: /var/discourse/shared/standalone
guest: /shared
- volume:
host: /var/discourse/shared/standalone/log/var-log
guest: /var/log
risultati di discourse-doctor
Found containers/app.yml
==================== IMPOSTAZIONI YML ====================
DISCOURSE_HOSTNAME=community.example.io
SMTP_ADDRESS=smtp.mailgun.org
DEVELOPER_EMAILS=example@example.com
SMTP_PASSWORD=XXXXXXXX
SMTP_PORT=587
SMTP_USER_NAME=no-reply@example.io
LETSENCRYPT_ACCOUNT_EMAIL=example@example.com
==================== INFORMAZIONI DOCKER ====================
VERSIONE DOCKER: Docker version 20.10.21, build baeda1f
PROCESSI DOCKER (docker ps -a)
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e1d88ff15b5b local_discourse/app "/sbin/boot" 18 minutes ago Up 18 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp app
e1d88ff15b5b local_discourse/app "/sbin/boot" 18 minutes ago Up 18 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp app
Il contenitore Discourse app è in esecuzione
==================== PLUGIN ====================
- git clone https://github.com/discourse/docker_manager.git
Nessun plugin non ufficiale rilevato.
Vedi https://github.com/discourse/discourse/blob/main/lib/plugin/metadata.rb per l'elenco ufficiale.
========================================
Versione di Discourse su community.example.io: NON TROVATA
Versione di Discourse su localhost: NON TROVATA
==================== INFORMAZIONI SULLA MEMORIA ====================
RAM (MB): 1016
total used free shared buff/cache available
Mem: 969 687 61 21 220 110
Swap: 2047 241 1806
==================== CONTROLLO SPAZIO SU DISCO ====================
---------- Spazio su disco OS ----------
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 25G 8.2G 16G 34% /
==================== INFORMAZIONI SUL DISCO ====================
Disk /dev/loop0: 63.22 MiB, 66293760 bytes, 129480 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop1: 102.98 MiB, 107986944 bytes, 210912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop2: 47.98 MiB, 50315264 bytes, 98272 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/vda: 25 GiB, 26843545600 bytes, 52428800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 728BDF97-580D-4B6F-9462-7E2540D5378B
Device Start End Sectors Size Type
/dev/vda1 227328 52428766 52201439 24.9G Linux filesystem
/dev/vda14 2048 10239 8192 4M BIOS boot
/dev/vda15 10240 227327 217088 106M EFI System
Le voci della tabella delle partizioni non sono in ordine sul disco.
Disk /dev/vdb: 466 KiB, 477184 bytes, 932 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
==================== FINE INFORMAZIONI SUL DISCO ====================
==================== TEST MAIL ====================
Per un test robusto, ottieni un indirizzo da http://www.mail-tester.com/
O semplicemente invia un messaggio di prova a te stesso.
Indirizzo email per il test della posta? ('n' per saltare) [example@example.com ]:
Invio della posta a example@example.com . . .
Test dell'invio a example@example.com usando smtp.mailgun.org:587, username:no-reply@example.io con autenticazione plain.
Connessione al server SMTP riuscita.
Invio a example@example.com. . .
Messaggio accettato dal server SMTP.
Message-ID: e3455d15-eb48-48bf-9859-a30f1acc765c@community.example.io
Se non ricevi il messaggio, controlla la cartella SPAM
o ripeti il test usando un servizio come http://www.mail-tester.com/.
Se il messaggio non viene recapitato, non è un problema di Discourse.
Controlla i log del server SMTP per il Message-ID sopra per vedere perché
non è stato recapitato.
Sostituzione: SMTP_PASSWORD
Sostituzione: LETSENCRYPT_ACCOUNT_EMAIL
Sostituzione: DEVELOPER_EMAILS
Sostituzione: DISCOURSE_DB_PASSWORD
Sostituzione: Invio della posta a
==================== FINE! ====================
Ho anche eseguito ./launcher enter app nella directory di Discourse + il comando top per verificare che nginx, redis, postmaster e ruby siano tutti in esecuzione. Non vedo nginx nell’elenco…
launcher enter app --> risultati di top
Tasks: 31 total, 1 running, 30 sleeping, 0 stopped, 0 zombie
%Cpu(s): 1.3 us, 2.3 sy, 0.0 ni, 96.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.3 st
MiB Mem : 969.4 total, 72.4 free, 659.0 used, 238.0 buff/cache
MiB Swap: 2048.0 total, 1667.2 free, 380.8 used. 141.1 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
4528 discour+ 25 5 951480 289404 3096 S 0.3 29.2 4:21.14 ruby
1 root 20 0 6772 0 0 S 0.0 0.0 0:00.02 boot
4428 root 20 0 2340 24 0 S 0.0 0.0 0:01.14 runsvdir
4429 root 20 0 2188 0 0 S 0.0 0.0 0:00.00 runsv
4430 root 20 0 2188 0 0 S 0.0 0.0 0:00.00 runsv
4431 root 20 0 2188 0 0 S 0.0 0.0 0:00.00 runsv
4432 root 20 0 2188 0 0 S 0.0 0.0 0:00.00 runsv
4433 root 20 0 2188 280 256 S 0.0 0.0 1:28.21 runsv
4434 root 20 0 2188 0 0 S 0.0 0.0 0:00.00 runsv
4435 root 20 0 2336 0 0 S 0.0 0.0 0:00.05 svlogd
4436 redis 20 0 58072 2900 1624 S 0.0 0.3 3:17.52 redis-server
4438 root 20 0 2336 0 0 S 0.0 0.0 0:00.00 svlogd
4439 discour+ 20 0 15256 1128 912 S 0.0 0.1 0:25.85 unicorn_launche
4441 root 20 0 6620 488 384 S 0.0 0.0 0:00.21 cron
4442 postgres 20 0 213172 5220 4776 S 0.0 0.5 0:02.75 postmaster
4445 root 20 0 151068 132 0 S 0.0 0.0 0:00.06 rsyslogd
4458 postgres 20 0 213392 10404 9896 S 0.0 1.0 0:00.78 postmaster
4459 postgres 20 0 213172 5004 4604 S 0.0 0.5 0:01.50 postmaster
4460 postgres 20 0 213172 4956 4588 S 0.0 0.5 0:27.50 postmaster
4461 postgres 20 0 213840 2264 1652 S 0.0 0.2 0:01.98 postmaster
4462 postgres 20 0 68200 788 0 S 0.0 0.1 0:05.01 postmaster
4463 postgres 20 0 213724 1164 700 S 0.0 0.1 0:00.05 postmaster
4464 discour+ 20 0 457692 171868 1364 S 0.0 17.3 0:22.71 ruby
4503 postgres 20 0 220116 11116 10812 S 0.0 1.1 0:01.51 postmaster
4538 discour+ 20 0 768724 169816 1032 S 0.0 17.1 0:08.27 ruby
4549 discour+ 20 0 768724 169948 1220 S 0.0 17.1 0:08.55 ruby
4580 postgres 20 0 219408 10580 10460 S 0.0 1.1 0:00.13 postmaster
134464 postgres 20 0 217332 21388 17444 S 0.0 2.2 0:00.24 postmaster
137350 root 20 0 7036 3468 2972 S 0.0 0.3 0:00.02 bash
137382 root 20 0 10108 3756 3080 R 0.0 0.4 0:00.08 top
137609 discour+ 20 0 13760 2004 1732 S 0.0 0.2 0:00.00 sleep
Ho dato un’occhiata al file error.log all’interno di var/discourse/shared/standalone/log/var-log/nginx:
2022/12/12 07:55:26 [emerg] 5040#5040: cannot load certificate "/shared/ssl/community.example.io.cer": PEM_read_bio_X509_AUX(>
2022/12/12 07:55:27 [emerg] 5042#5042: cannot load certificate "/shared/ssl/community.example.io.cer": PEM_read_bio_X509_AUX(>
2022/12/12 07:55:28 [emerg] 5044#5044: cannot load certificate "/shared/ssl/community.example.io.cer": PEM_read_bio_X509_AUX(>
2022/12/12 07:55:29 [emerg] 5046#5046: cannot load certificate "/shared/ssl/community.example.io.cer": PEM_read_bio_X509_AUX(>
....
