stephane-klein / backlog

My public backlog
30 stars 1 forks source link

Publier un playground d'hébergement Discourse suivant sa méthode de déploiement officiel #191

Open stephane-klein opened 1 year ago

stephane-klein commented 1 year ago

Suite à mes difficultés avec #188, je souhaite via cette issue publier un playground d'hébergement Discourse suivant la méthode officiel de déploiement de Discourse.

Je souhaite pouvoir tester ce déploiement localement, dans un Vagrant propulsé par Virtualbox.

Je précise que la méthode officielle de déploiement de Discourse ne suis pas la méthode 12 factor (voir #190).

Todo :

stephane-klein commented 1 year ago

Dans un premier temps, je vais essayer de suivre https://github.com/discourse/discourse/blob/main/docs/INSTALL-cloud.md

stephane-klein commented 1 year ago

J'aimerais bien que le playground que j'essaie d'écrire soit en mode infra as code et éviter au maximum de devoir exécuter des actions interactives.

stephane-klein commented 1 year ago

Exécuté dans une VM Ubuntu 22.10 :

root@ubuntu2210:/home/vagrant# git clone https://github.com/discourse/discourse_docker.git /var/discourse
Cloning into '/var/discourse'...
remote: Enumerating objects: 5821, done.
remote: Counting objects: 100% (141/141), done.
remote: Compressing objects: 100% (75/75), done.
remote: Total 5821 (delta 81), reused 102 (delta 62), pack-reused 5680
Receiving objects: 100% (5821/5821), 1.27 MiB | 12.65 MiB/s, done.
Resolving deltas: 100% (3789/3789), done.
root@ubuntu2210:/home/vagrant# cd /va
vagrant/ var/
root@ubuntu2210:/home/vagrant# cd /var/discourse/
root@ubuntu2210:/var/discourse# chmod 700 c
cids/       containers/
root@ubuntu2210:/var/discourse# chmod 700 containers/
root@ubuntu2210:/var/discourse# ./discourse-setup
Failed to find docker or docker.io on your PATH.
Enter to install Docker from https://get.docker.com/ or Ctrl+C to exit
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 18565  100 18565    0     0  78573      0 --:--:-- --:--:-- --:--:-- 78333
# Executing docker install script, commit: a8a6b338bdfedd7ddefb96fe3e7fe7d4036d945a
+ sh -c apt-get update -qq >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
Scanning processes...
Scanning candidates...
Use of uninitialized value in hex at /usr/share/perl5/NeedRestart/uCode/AMD.pm line 175.                 ]
Scanning processor microcode...
Scanning linux images...
+ sh -c mkdir -p /etc/apt/keyrings && chmod -R 0755 /etc/apt/keyrings
+ sh -c curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | gpg --dearmor --yes -o /etc/apt/keyrings/docker.gpg
+ sh -c chmod a+r /etc/apt/keyrings/docker.gpg
+ sh -c echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu kinetic stable" > /etc/apt/sources.list.d/docker.list
+ sh -c apt-get update -qq >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-ce-rootless-extras docker-buildx-plugin >/dev/null
Scanning processes...
Scanning candidates...
Use of uninitialized value in hex at /usr/share/perl5/NeedRestart/uCode/AMD.pm line 175.                 ]
Scanning processor microcode...
Scanning linux images...
+ sh -c docker version
Client: Docker Engine - Community
 Version:           23.0.3
 API version:       1.42
 Go version:        go1.19.7
 Git commit:        3e7cbfd
 Built:             Tue Apr  4 22:06:17 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          23.0.3
  API version:      1.42 (minimum version 1.12)
  Go version:       go1.19.7
  Git commit:       59118bf
  Built:            Tue Apr  4 22:06:17 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.20
  GitCommit:        2806fc1057397dbaeefbea0e4e17bddfbd388f38
 runc:
  Version:          1.1.5
  GitCommit:        v1.1.5-0-gf19387a
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

================================================================================

To run Docker as a non-privileged user, consider setting up the
Docker daemon in rootless mode for your user:

    dockerd-rootless-setuptool.sh install

Visit https://docs.docker.com/go/rootless/ to learn about rootless mode.

To run the Docker daemon as a fully privileged service, but granting non-root
users access, refer to https://docs.docker.com/go/daemon-access/

WARNING: Access to the remote API on a privileged Docker daemon is equivalent
         to root access on the host. Refer to the 'Docker daemon attack surface'
         documentation for details: https://docs.docker.com/go/attack-surface/

================================================================================

Ports 80 and 443 are free for use
'samples/standalone.yml' -> 'containers/app.yml'
Found 2GB of memory and 2 physical CPU cores
setting db_shared_buffers = 256MB
setting UNICORN_WORKERS = 4
containers/app.yml memory parameters updated.

Hostname for your Discourse? [discourse.example.com]: forum.example.com

Checking your domain name . . .
Connection to forum.example.com succeeded.
Email address for admin account(s)? [me@example.com,you@example.com]:
SMTP server address? [smtp.example.com]:
SMTP port? [587]:
SMTP user name? [user@example.com]:
SMTP password? [pa$$word]: password
notification email address? [noreply@forum.example.com]:
Optional email address for Let's Encrypt warnings? (ENTER to skip) [me@example.com]:
Optional Maxmind License key (ENTER to continue without MAXMIND GeoLite2 geolocation database) [1234567890123456]:

Does this look right?

Hostname          : forum.example.com
Email             : me@example.com,you@example.com
SMTP address      : smtp.example.com
SMTP port         : 587
SMTP username     : user@example.com
SMTP password     : password
Notification email: noreply@forum.example.com
Maxmind license: (unset)

ENTER to continue, 'n' to try again, Ctrl+C to exit:
stephane-klein commented 1 year ago

J'ai continué l'installation, j'ai eu cette erreur :

letsencrypt.ssl.template.yml enabled

Configuration file at containers/app.yml updated successfully!

DISCOURSE_SMTP_ADDRESS left at incorrect default of smtp.example.com
DISCOURSE_SMTP_USER_NAME left at incorrect default of user@example.com
DISCOURSE_DEVELOPER_EMAILS left at incorrect default of me@example.com,you@example.com

Sorry, these containers/app.yml settings aren't valid -- can't continue!
If you have unusual requirements, edit containers/app.yml and then:
./launcher bootstrap app
stephane-klein commented 1 year ago

J'ai quand même essayé de continuer l'installation :

root@ubuntu2210:/var/discourse# ./launcher bootstrap app
x86_64 arch detected.

WARNING: We are about to start downloading the Discourse base image
This process may take anywhere between a few minutes to an hour, depending on your network speed

Please be patient

2.0.20230313-1023: Pulling from discourse/base
3f9582a2cbe7: Pull complete
70cc8ca3f661: Pull complete
b54200a62e69: Pull complete
Digest: sha256:f7467469ab9e39c3548d4478e3f416c05b34a0ee58eb6e40b963e562005669cc
Status: Downloaded newer image for discourse/base:2.0.20230313-1023
docker.io/discourse/base:2.0.20230313-1023
2.0.20230313-1023: Pulling from discourse/base
Digest: sha256:f7467469ab9e39c3548d4478e3f416c05b34a0ee58eb6e40b963e562005669cc
Status: Image is up to date for discourse/base:2.0.20230313-1023
docker.io/discourse/base:2.0.20230313-1023
/usr/local/lib/ruby/gems/3.2.0/gems/pups-1.1.1/lib/pups.rb
/usr/local/bin/pups --stdin
I, [2023-04-09T15:04:47.235860 #1]  INFO -- : Reading from stdin
I, [2023-04-09T15:04:47.239769 #1]  INFO -- : > locale-gen $LANG && update-locale
I, [2023-04-09T15:04:47.279681 #1]  INFO -- : Generating locales (this might take a while)...
Generation complete.

I, [2023-04-09T15:04:47.279890 #1]  INFO -- : > mkdir -p /shared/postgres_run
I, [2023-04-09T15:04:47.286399 #1]  INFO -- :
I, [2023-04-09T15:04:47.287397 #1]  INFO -- : > chown postgres:postgres /shared/postgres_run
I, [2023-04-09T15:04:47.291045 #1]  INFO -- :
I, [2023-04-09T15:04:47.291426 #1]  INFO -- : > chmod 775 /shared/postgres_run
I, [2023-04-09T15:04:47.294700 #1]  INFO -- :
I, [2023-04-09T15:04:47.295037 #1]  INFO -- : > rm -fr /var/run/postgresql
I, [2023-04-09T15:04:47.296602 #1]  INFO -- :
I, [2023-04-09T15:04:47.297102 #1]  INFO -- : > ln -s /shared/postgres_run /var/run/postgresql
I, [2023-04-09T15:04:47.299666 #1]  INFO -- :
I, [2023-04-09T15:04:47.300052 #1]  INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
2023/04/09 15:04:47 socat[19] E connect(6, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): No such file or directory
I, [2023-04-09T15:04:47.320283 #1]  INFO -- :
I, [2023-04-09T15:04:47.320783 #1]  INFO -- : > rm -fr /shared/postgres_run/.s*
I, [2023-04-09T15:04:47.323328 #1]  INFO -- :
I, [2023-04-09T15:04:47.323407 #1]  INFO -- : > rm -fr /shared/postgres_run/*.pid
I, [2023-04-09T15:04:47.325083 #1]  INFO -- :
I, [2023-04-09T15:04:47.325156 #1]  INFO -- : > mkdir -p /shared/postgres_run/13-main.pg_stat_tmp
I, [2023-04-09T15:04:47.326619 #1]  INFO -- :
I, [2023-04-09T15:04:47.326913 #1]  INFO -- : > chown postgres:postgres /shared/postgres_run/13-main.pg_stat_tmp
I, [2023-04-09T15:04:47.328339 #1]  INFO -- :
I, [2023-04-09T15:04:47.331333 #1]  INFO -- : File > /etc/service/postgres/run  chmod: +x  chown:
I, [2023-04-09T15:04:47.334038 #1]  INFO -- : File > /etc/service/postgres/log/run  chmod: +x  chown:
I, [2023-04-09T15:04:47.336746 #1]  INFO -- : File > /etc/runit/3.d/99-postgres  chmod: +x  chown:
I, [2023-04-09T15:04:47.339624 #1]  INFO -- : File > /root/upgrade_postgres  chmod: +x  chown:
I, [2023-04-09T15:04:47.339937 #1]  INFO -- : > chown -R root /var/lib/postgresql/13/main
I, [2023-04-09T15:04:48.406025 #1]  INFO -- :
I, [2023-04-09T15:04:48.406362 #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
initdb: 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.
I, [2023-04-09T15:04:49.339945 #1]  INFO -- : The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.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.

fixing permissions on existing directory /shared/postgres_data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

Success. You can now start the database server using:

    /usr/lib/postgresql/13/bin/pg_ctl -D /shared/postgres_data -l logfile start

I, [2023-04-09T15:04:49.340143 #1]  INFO -- : > chown -R postgres:postgres /shared/postgres_data
I, [2023-04-09T15:04:49.348913 #1]  INFO -- :
I, [2023-04-09T15:04:49.349703 #1]  INFO -- : > chown -R postgres:postgres /var/run/postgresql
I, [2023-04-09T15:04:49.353189 #1]  INFO -- :
I, [2023-04-09T15:04:49.353743 #1]  INFO -- : > /root/upgrade_postgres
I, [2023-04-09T15:04:49.364448 #1]  INFO -- :
I, [2023-04-09T15:04:49.364755 #1]  INFO -- : > rm /root/upgrade_postgres
I, [2023-04-09T15:04:49.367485 #1]  INFO -- :
I, [2023-04-09T15:04:49.368123 #1]  INFO -- : Replacing data_directory = '/var/lib/postgresql/13/main' with data_directory = '/shared/postgres_data' in /etc/postgresql/13/main/postgresql.conf
I, [2023-04-09T15:04:49.368772 #1]  INFO -- : Replacing (?-mix:#?listen_addresses *=.*) with listen_addresses = '*' in /etc/postgresql/13/main/postgresql.conf
I, [2023-04-09T15:04:49.369086 #1]  INFO -- : Replacing (?-mix:#?synchronous_commit *=.*) with synchronous_commit = $db_synchronous_commit in /etc/postgresql/13/main/postgresql.conf
I, [2023-04-09T15:04:49.369408 #1]  INFO -- : Replacing (?-mix:#?shared_buffers *=.*) with shared_buffers = $db_shared_buffers in /etc/postgresql/13/main/postgresql.conf
I, [2023-04-09T15:04:49.369782 #1]  INFO -- : Replacing (?-mix:#?work_mem *=.*) with work_mem = $db_work_mem in /etc/postgresql/13/main/postgresql.conf
I, [2023-04-09T15:04:49.370061 #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, [2023-04-09T15:04:49.370331 #1]  INFO -- : > install -d -m 0755 -o postgres -g postgres /shared/postgres_backup
I, [2023-04-09T15:04:49.375847 #1]  INFO -- :
I, [2023-04-09T15:04:49.376807 #1]  INFO -- : Replacing (?-mix:#?checkpoint_segments *=.*) with checkpoint_segments = $db_checkpoint_segments in /etc/postgresql/13/main/postgresql.conf
I, [2023-04-09T15:04:49.377747 #1]  INFO -- : Replacing (?-mix:#?logging_collector *=.*) with logging_collector = $db_logging_collector in /etc/postgresql/13/main/postgresql.conf
I, [2023-04-09T15:04:49.378353 #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, [2023-04-09T15:04:49.379282 #1]  INFO -- : Replacing (?-mix:^#local +replication +postgres +peer$) with local replication postgres  peer in /etc/postgresql/13/main/pg_hba.conf
I, [2023-04-09T15:04:49.379873 #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, [2023-04-09T15:04:49.380507 #1]  INFO -- : Replacing (?-mix:^host.*all.*all.*::1\/128.*$) with host all all ::/0 md5 in /etc/postgresql/13/main/pg_hba.conf
I, [2023-04-09T15:04:49.380897 #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, [2023-04-09T15:04:49.384494 #1]  INFO -- : > sleep 5
2023-04-09 15:04:49.424 UTC [57] LOG:  starting PostgreSQL 13.10 (Debian 13.10-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2023-04-09 15:04:49.425 UTC [57] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2023-04-09 15:04:49.425 UTC [57] LOG:  listening on IPv6 address "::", port 5432
2023-04-09 15:04:49.428 UTC [57] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-04-09 15:04:49.432 UTC [60] LOG:  database system was shut down at 2023-04-09 15:04:49 UTC
2023-04-09 15:04:49.436 UTC [57] LOG:  database system is ready to accept connections
I, [2023-04-09T15:04:54.404776 #1]  INFO -- :
I, [2023-04-09T15:04:54.406031 #1]  INFO -- : > su postgres -c 'createdb discourse' || true
2023-04-09 15:04:54.623 UTC [70] postgres@postgres LOG:  duration: 120.613 ms  statement: CREATE DATABASE discourse;
I, [2023-04-09T15:04:54.625564 #1]  INFO -- :
I, [2023-04-09T15:04:54.626388 #1]  INFO -- : > su postgres -c 'psql discourse -c "create user discourse;"' || true
I, [2023-04-09T15:04:54.682360 #1]  INFO -- : CREATE ROLE

I, [2023-04-09T15:04:54.682837 #1]  INFO -- : > su postgres -c 'psql discourse -c "grant all privileges on database discourse to discourse;"' || true
I, [2023-04-09T15:04:54.723338 #1]  INFO -- : GRANT

I, [2023-04-09T15:04:54.724184 #1]  INFO -- : > su postgres -c 'psql discourse -c "alter schema public owner to discourse;"'
I, [2023-04-09T15:04:54.764779 #1]  INFO -- : ALTER SCHEMA

I, [2023-04-09T15:04:54.765234 #1]  INFO -- : > su postgres -c 'psql template1 -c "create extension if not exists hstore;"'
I, [2023-04-09T15:04:54.819765 #1]  INFO -- : CREATE EXTENSION

I, [2023-04-09T15:04:54.820538 #1]  INFO -- : > su postgres -c 'psql template1 -c "create extension if not exists pg_trgm;"'
I, [2023-04-09T15:04:54.872623 #1]  INFO -- : CREATE EXTENSION

I, [2023-04-09T15:04:54.873538 #1]  INFO -- : > su postgres -c 'psql discourse -c "create extension if not exists hstore;"'
I, [2023-04-09T15:04:54.925408 #1]  INFO -- : CREATE EXTENSION

I, [2023-04-09T15:04:54.926139 #1]  INFO -- : > su postgres -c 'psql discourse -c "create extension if not exists pg_trgm;"'
I, [2023-04-09T15:04:54.972130 #1]  INFO -- : CREATE EXTENSION

I, [2023-04-09T15:04:54.972773 #1]  INFO -- : > sudo -u postgres psql discourse
I, [2023-04-09T15:04:54.975401 #1]  INFO -- : update pg_database set encoding = pg_char_to_encoding('UTF8') where datname = 'discourse' AND encoding = pg_char_to_encoding('SQL_ASCII');

I, [2023-04-09T15:04:55.027648 #1]  INFO -- : File > /var/lib/postgresql/take-database-backup  chmod: +x  chown: postgres:postgres
I, [2023-04-09T15:04:55.030951 #1]  INFO -- : File > /var/spool/cron/crontabs/postgres  chmod:   chown:
I, [2023-04-09T15:04:55.031088 #1]  INFO -- : > echo postgres installed!
I, [2023-04-09T15:04:55.033484 #1]  INFO -- : postgres installed!

I, [2023-04-09T15:04:55.039856 #1]  INFO -- : File > /etc/service/redis/run  chmod: +x  chown:
I, [2023-04-09T15:04:55.044937 #1]  INFO -- : File > /etc/service/redis/log/run  chmod: +x  chown:
I, [2023-04-09T15:04:55.048718 #1]  INFO -- : File > /etc/runit/3.d/10-redis  chmod: +x  chown:
I, [2023-04-09T15:04:55.049554 #1]  INFO -- : Replacing daemonize yes with  in /etc/redis/redis.conf
I, [2023-04-09T15:04:55.050413 #1]  INFO -- : Replacing (?-mix:^pidfile.*$) with  in /etc/redis/redis.conf
I, [2023-04-09T15:04:55.051034 #1]  INFO -- : > install -d -m 0755 -o redis -g redis /shared/redis_data
I, [2023-04-09T15:04:55.054994 #1]  INFO -- :
I, [2023-04-09T15:04:55.055853 #1]  INFO -- : Replacing (?-mix:^logfile.*$) with logfile "" in /etc/redis/redis.conf
I, [2023-04-09T15:04:55.056758 #1]  INFO -- : Replacing (?-mix:^bind .*$) with  in /etc/redis/redis.conf
I, [2023-04-09T15:04:55.057373 #1]  INFO -- : Replacing (?-mix:^dir .*$) with dir /shared/redis_data in /etc/redis/redis.conf
I, [2023-04-09T15:04:55.057980 #1]  INFO -- : Replacing (?-mix:^protected-mode yes) with protected-mode no in /etc/redis/redis.conf
I, [2023-04-09T15:04:55.058551 #1]  INFO -- : Replacing # io-threads 4 with io-threads $redis_io_threads in /etc/redis/redis.conf
I, [2023-04-09T15:04:55.059099 #1]  INFO -- : > echo redis installed
I, [2023-04-09T15:04:55.064494 #1]  INFO -- : redis installed

I, [2023-04-09T15:04:55.065025 #1]  INFO -- : > cat /etc/redis/redis.conf | grep logfile
I, [2023-04-09T15:04:55.072735 #1]  INFO -- : logfile ""

I, [2023-04-09T15:04:55.073530 #1]  INFO -- : > exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf
I, [2023-04-09T15:04:55.076844 #1]  INFO -- : > sleep 10
118:C 09 Apr 2023 15:04:55.089 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
118:C 09 Apr 2023 15:04:55.089 # Redis version=7.0.7, bits=64, commit=00000000, modified=0, pid=118, just started
118:C 09 Apr 2023 15:04:55.089 # Configuration loaded
118:M 09 Apr 2023 15:04:55.089 * monotonic clock: POSIX clock_gettime
118:M 09 Apr 2023 15:04:55.091 * Running mode=standalone, port=6379.
118:M 09 Apr 2023 15:04:55.091 # Server initialized
118:M 09 Apr 2023 15:04:55.091 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
118:M 09 Apr 2023 15:04:55.092 * Ready to accept connections
I, [2023-04-09T15:05:05.080982 #1]  INFO -- :
I, [2023-04-09T15:05:05.081669 #1]  INFO -- : > thpoff echo "thpoff is installed!"
I, [2023-04-09T15:05:05.089360 #1]  INFO -- : thpoff is installed!

I, [2023-04-09T15:05:05.089895 #1]  INFO -- : > /usr/local/bin/ruby -e 'if ENV["DISCOURSE_SMTP_ADDRESS"] == "smtp.example.com"; puts "Aborting! Mail is not configured!"; exit 1; end'
I, [2023-04-09T15:05:05.191049 #1]  INFO -- : Aborting! Mail is not configured!

I, [2023-04-09T15:05:05.191940 #1]  INFO -- : Terminating async processes
I, [2023-04-09T15:05:05.192011 #1]  INFO -- : Sending INT to 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 pid: 57
I, [2023-04-09T15:05:05.192057 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 118
118:signal-handler (1681052705) Received SIGTERM scheduling shutdown...
2023-04-09 15:05:05.192 UTC [57] LOG:  received fast shutdown request
2023-04-09 15:05:05.194 UTC [57] LOG:  aborting any active transactions
2023-04-09 15:05:05.197 UTC [57] LOG:  background worker "logical replication launcher" (PID 66) exited with exit code 1
2023-04-09 15:05:05.198 UTC [61] LOG:  shutting down
118:M 09 Apr 2023 15:05:05.223 # User requested shutdown...
118:M 09 Apr 2023 15:05:05.224 * Saving the final RDB snapshot before exiting.
118:M 09 Apr 2023 15:05:05.226 * DB saved on disk
118:M 09 Apr 2023 15:05:05.227 # Redis is now ready to exit, bye bye...
2023-04-09 15:05:05.251 UTC [57] LOG:  database system is shut down

FAILED
--------------------
Pups::ExecError: /usr/local/bin/ruby -e 'if ENV["DISCOURSE_SMTP_ADDRESS"] == "smtp.example.com"; puts "Aborting! Mail is not configured!"; exit 1; end' failed with return #<Process::Status: pid 127 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params "/usr/local/bin/ruby -e 'if ENV[\"DISCOURSE_SMTP_ADDRESS\"] == \"smtp.example.com\"; puts \"Aborting! Mail is not configured!\"; exit 1; end'"
bootstrap failed with exit code 1
** 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.
4dec173515a5919c7552df112432edb292fdcb81cf60b86c58b75bfb8f2d9cc2
stephane-klein commented 1 year ago

Je vais mettre en place un https://github.com/maildev/maildev dans la VM, afin de l'utiliser dans ma configuration Discourse.

Lors de mes tests, je souhaite pouvoir intercepter les mails, par conséquent, Maildev est adapté à mon usage de Playground.

stephane-klein commented 1 year ago
# apt install python3-pip
# pip install docker-compose
# cd /vagrant/
# docker-compose up -d
# docker-compose ps
      Name            Command             State                               Ports
--------------------------------------------------------------------------------------------------------
vagrant_maildev_1   bin/maildev   Up (health: starting)   0.0.0.0:1025->1025/tcp, 0.0.0.0:1080->1080/tcp
stephane-klein commented 1 year ago

J'ai set des paramètres smtp dans containers/app.yml et j'ai relancé : ./launcher bootstrap app.

Le temps de traitement de cette commande est long…

stephane-klein commented 1 year ago

En fin d'exécution, je vois :

103:M 09 Apr 2023 15:35:06.160 # Redis is now ready to exit, bye bye...
2023-04-09 15:35:06.321 UTC [42] LOG:  database system is shut down
sha256:029efd027e029c7c020ca1625ecf6aa9a8aa5fc950cd9bdedc4ca2f49906985c
26f90576bc0e5fc7eeb3e3605480a53b4b6aede6e795a0c96442a8739770ec57
Successfully bootstrapped, to startup use ./launcher start app
stephane-klein commented 1 year ago

Je lance :

root@ubuntu2210:/var/discourse# ./launcher start app
x86_64 arch detected.
stephane-klein commented 1 year ago
root@ubuntu2210:/var/discourse# ./launcher start app
x86_64 arch detected.

+ /usr/bin/docker run --shm-size=512m -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=4 -e UNICORN_SIDEKIQS=1 -e RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 -e RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 -e RUBY_GC_HEAP_INIT_SLOTS=400000 -e RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e LETSENCRYPT_DIR=/shared/letsencrypt -e DISCOURSE_FORCE_HTTPS=true -e LC_ALL=en_US.UTF-8 -e LANGUAGE=en_US.UTF-8 -e DISCOURSE_HOSTNAME=forum.example.com -e DISCOURSE_DEVELOPER_EMAILS=me@example.com,you@example.com -e DISCOURSE_SMTP_ADDRESS=forum.example.com -e DISCOURSE_SMTP_PORT=1025 -e DISCOURSE_SMTP_USER_NAME=user@example.com -e DISCOURSE_SMTP_PASSWORD=password -e DISCOURSE_SMTP_ENABLE_START_TLS=false -e DISCOURSE_SMTP_DOMAIN=forum.example.com -e DISCOURSE_NOTIFICATION_EMAIL=noreply@forum.example.com -e LETSENCRYPT_ACCOUNT_EMAIL=me@example.com -h ubuntu2210-app -e DOCKER_HOST_IP=172.17.0.1 --name app -t -p 80:80 -p 443:443 -v /var/discourse/shared/standalone:/shared -v /var/discourse/shared/standalone/log/var-log:/var/log --mac-address 02:2e:fc:5c:6a:03 local_discourse/app /sbin/boot
35a5142086549801564af18f8da32260984e953071008a3078a11717353df30c
root@ubuntu2210:/var/discourse# docker ps
CONTAINER ID   IMAGE                   COMMAND         CREATED              STATUS                   PORTS                                            NAMES
35a514208654   local_discourse/app     "/sbin/boot"    About a minute ago   Up About a minute        0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp         app
4efbc12fa25d   maildev/maildev:2.0.5   "bin/maildev"   9 minutes ago        Up 9 minutes (healthy)   0.0.0.0:1025->1025/tcp, 0.0.0.0:1080->1080/tcp   vagrant_maildev_1
stephane-klein commented 1 year ago

J'ai commencé à uploader mon playground dans https://github.com/stephane-klein/discourse-hosting-playground

stephane-klein commented 1 year ago

J'ai réussi à lancer et à accéder l'instance Discourse présente dans la VM, mais je ne reçois aucun mail.

Je vais essayer de corriger cela.

stephane-klein commented 1 year ago

J'ai réussi à lancer et à accéder l'instance Discourse présente dans la VM, mais je ne reçois aucun mail.

Je vais essayer de corriger cela.

Le hostname forum.example.com ne peut pas être résolu à l'intérieur du container discourse (app).

root@ubuntu2210-app:/var/www/discourse# ping forum.example.com
ping: forum.example.com: Name or service not known
stephane-klein commented 1 year ago

Je viens de découvrir la commande ./launcher start-cmd app :

root@ubuntu2210:/var/discourse# ./launcher start-cmd app
x86_64 arch detected.
+ true run --shm-size=512m -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=4 -e UNICORN_SIDEKIQS=1 -e RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 -e RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 -e RUBY_GC_HEAP_INIT_SLOTS=400000 -e RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e LC_ALL=en_US.UTF-8 -e LANGUAGE=en_US.UTF-8 -e DISCOURSE_HOSTNAME=forum.example.com -e DISCOURSE_DEVELOPER_EMAILS=me@example.com,you@example.com -e DISCOURSE_SMTP_ADDRESS=maildev -e DISCOURSE_SMTP_PORT=1025 -e DISCOURSE_SMTP_USER_NAME=user@example.com -e DISCOURSE_SMTP_PASSWORD=password -e DISCOURSE_SMTP_ENABLE_START_TLS=false -e DISCOURSE_SMTP_DOMAIN=forum.example.com -e DISCOURSE_NOTIFICATION_EMAIL=noreply@forum.example.com -h ubuntu2210-app -e DOCKER_HOST_IP=172.17.0.1 --name app -t -p 80:80 -v /var/discourse/shared/standalone:/shared -v /var/discourse/shared/standalone/log/var-log:/var/log --mac-address 02:2e:fc:5c:6a:03 local_discourse/app /sbin/boot

Je pense l'utiliser pour écrire un docker-compose.yml et l'utiliser pour lancer Discourse.
Cela me permettra sans doute de plus facilement traiter mon bug de liaison entre Discourse et maildev :thinking:.

stephane-klein commented 1 year ago

Je suis bien entré dans mon instance Discourse.

Je vais faire quelques commit pour améliorer le repository.

stephane-klein commented 1 year ago

Amélioration : https://github.com/stephane-klein/discourse-hosting-playground

stephane-klein commented 1 year ago

Maintenant que j'ai compris comment je peux créer une image Docker Discourse, https://github.com/stephane-klein/discourse-hosting-playground/blob/main/docker-compose.yml je pense que je peux simplifier mon playground.
Je pense que je n'ai plus besoin de Vagrant.

stephane-klein commented 1 year ago

Après avoir lu le script https://github.com/discourse/discourse_docker/blob/main/launcher je pense que je peux le lancer en local sans "polluer" ma workstation.

stephane-klein commented 1 year ago

Je vais essayer le build une image Docker Discourse qui contient uniquement l'application Discourse, sans Redis, Postgres…

stephane-klein commented 1 year ago

Je vais essayer le build une image Docker Discourse qui contient uniquement l'application Discourse, sans Redis, Postgres…

Basé sur https://github.com/discourse/discourse_docker/blob/main/samples/web_only.yml

stephane-klein commented 1 year ago

Je cherche comment activer la partie mailing list de Discourse.

stephane-klein commented 1 year ago
stephane-klein commented 1 year ago
stephane-klein commented 1 year ago
stephane-klein commented 1 year ago

https://meta.discourse.org/t/configure-direct-delivery-incoming-email-for-self-hosted-sites/49487 semble conseiller d'utiliser https://github.com/discourse/discourse_docker/blob/main/samples/mail-receiver.yml

stephane-klein commented 1 year ago

Thread intéressant au sujet de l'intérêt d'utiliser Discourse plutôt que simplement des mails ou une mailing list : Why use Discourse instead of a email mailing list?

stephane-klein commented 1 year ago

Je pensais avoir réussi à déployer une instance Discourse basé sur un simple fichier docker-compose.yml (exemple ici) mais je me suis rendu compte que cela ne fonctionne pas.

J'ai réussi à le faire fonctionner parce que ./launcher start app avait initialisé les dossiers /var/discourse/shared/standalone/. Sans cette initialisation, cela ne fonctionne pas. Je rencontre des problèmes de droits de dossiers , un fichier de config PostgreSQL manquant…

Je pense que je pourrais peut-être arriver à déployer Discourse via un fichier docker-compose.yml si j'arrive à builder une image Discourse web_only. Mais pour le moment je n'ai pas réussi à la builder, car elle depend de Postgres…

Je confirme que n'aime pas la pratique de build et de déploiement de Discourse, je préfère de loin le paradigme "12 factors" (#190 #189).

Je pense que si je veux exécuter https://github.com/stephane-klein/backlog/issues/198, je vais devoir faire le compromis d'utiliser le script ./launcher….