Problemi di configurazione con più container

Ciao a tutti! Dopo aver cercato invano di configurare un setup multisito, ho optato per tre container separati: uno per il mio forum attuale e due per i forum archiviati. Ho scelto l’approccio socketed, sono riuscito a far funzionare NGINX e ho persino configurato Let’s Encrypt seguendo queste linee guida.

Ho assegnato un processo unicorn ai forum archiviati e uno solo al forum attuale, ma ora mi sorge un dubbio: è davvero possibile procedere così “out of the box”? Tutti i container stanno eseguendo Redis e Sidekiq in modo da creare conflitti? O dovrei collegare in qualche modo i due container degli archivi al primo e così via? Perché dopo il ripristino ricevo questo messaggio:

Oops
Il software che gestisce questo forum di discussione ha riscontrato un problema imprevisto. Ci scusiamo per l’inconveniente.

Sono state registrate informazioni dettagliate sull’errore e generata una notifica automatica. Verificheremo la situazione.

Non è necessario alcun intervento aggiuntivo. Tuttavia, se il problema persiste, potete fornire ulteriori dettagli, inclusi i passaggi per riprodurre l’errore, creando un argomento nella categoria feedback del sito.

Dalla discussione sul configurazione multisito ho capito che dovrebbero esserci due container separati per il multisito, ma non ho mai compreso appieno cosa si intenda per container “data” e “web”. Significa che il container data è l’unico a utilizzare SQL, mentre il container web gestisce Redis e Sidekiq, o come va interpretato?

Imparo in fretta e ho una certa familiarità con queste cose, ma non posso certo definirmi un sysadmin.

La raccomandazione è di avere un contenitore con Redis e Postgres e un secondo contenitore con il server web. Se hai due contenitori web, dovrai configurare un altro nginx esterno come reverse proxy per instradare il traffico ai contenitori web. Sarebbe più semplice utilizzare un singolo server multisito.

Ho questo in /etc/nginx/sites-available/default:

server {

        server_name www.uskojarukous.fi uskojarukous.fi nyforum.uskojarukous.fi;

        location /errorpages/ {
                alias /var/www/errorpages/;
        }

        location / {
                proxy_pass http://unix:/var/discourse/shared/nyforum/nginx.http.sock:;
                proxy_set_header Host $http_host;
                proxy_http_version 1.1;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Real-IP $remote_addr;
                error_page 502 =502 /errorpages/offline.html;
        }

    listen [::]:443 ssl ipv6only=on; # gestito da Certbot
    listen 443 ssl; # gestito da Certbot
    ssl_certificate /etc/letsencrypt/live/uskojarukous.fi/fullchain.pem; # gestito da Certbot
    ssl_certificate_key /etc/letsencrypt/live/uskojarukous.fi/privkey.pem; # gestito da Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # gestito da Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # gestito da Certbot



}

server {

        server_name urforum.uskojarukous.fi;

        location /errorpages/ {
                alias /var/www/errorpages/;
        }

        location / {
                proxy_pass http://unix:/var/discourse/shared/urforum/nginx.http.sock:;
                proxy_set_header Host $http_host;
                proxy_http_version 1.1;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Real-IP $remote_addr;
                error_page 502 =502 /errorpages/offline.html;
        }

    listen [::]:443 ssl; # gestito da Certbot
    listen 443 ssl; # gestito da Certbot
    ssl_certificate /etc/letsencrypt/live/uskojarukous.fi/fullchain.pem; # gestito da Certbot
    ssl_certificate_key /etc/letsencrypt/live/uskojarukous.fi/privkey.pem; # gestito da Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # gestito da Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # gestito da Certbot

}

server {

        server_name ueforum.uskojarukous.fi;

        location /errorpages/ {
                alias /var/www/errorpages/;
        }

        location / {
                proxy_pass http://unix:/var/discourse/shared/ueforum/nginx.http.sock:;
                proxy_set_header Host $http_host;
                proxy_http_version 1.1;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Real-IP $remote_addr;
                error_page 502 =502 /errorpages/offline.html;
        }

    listen [::]:443 ssl; # gestito da Certbot
    listen 443 ssl; # gestito da Certbot
    ssl_certificate /etc/letsencrypt/live/uskojarukous.fi/fullchain.pem; # gestito da Certbot
    ssl_certificate_key /etc/letsencrypt/live/uskojarukous.fi/privkey.pem; # gestito da Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # gestito da Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # gestito da Certbot

}

server {
    if ($host = www.uskojarukous.fi) {
        return 301 https://$host$request_uri;
    } # gestito da Certbot


    if ($host = nyforum.uskojarukous.fi) {
        return 301 https://$host$request_uri;
    } # gestito da Certbot


    if ($host = uskojarukous.fi) {
        return 301 https://$host$request_uri;
    } # gestito da Certbot


        listen  80;
        listen  [::]:80;

        server_name www.uskojarukous.fi uskojarukous.fi nyforum.uskojarukous.fi;
    return 404; # gestito da Certbot






}

server {
    if ($host = ueforum.uskojarukous.fi) {
        return 301 https://$host$request_uri;
    } # gestito da Certbot


        listen  80;
        listen  [::]:80;

        server_name ueforum.uskojarukous.fi;
    return 404; # gestito da Certbot


}

server {
    if ($host = urforum.uskojarukous.fi) {
        return 301 https://$host$request_uri;
    } # gestito da Certbot


        listen  80;
        listen  [::]:80;

        server_name urforum.uskojarukous.fi;
    return 404; # gestito da Certbot


}

Almeno due dei forum funzionano correttamente…