discourse_docker.git
10 months agoAdd new Nginx config to base image (#918)
Bianca Nenciu [Wed, 22 Jan 2025 18:13:17 +0000 (20:13 +0200)]
Add new Nginx config to base image (#918)

This commit moves the Nginx config from discourse/discourse repository
and updates it with several 'include' statements that serve as extension
outlets.

This change was made to place the config closer to where it is used and
implements an alternative to the "find & replace" hacks.

It is unused at this moment, but all templates and samples will be
updated in a future commit.

10 months agoDEV: Correct manifest name for images with PG 15 installed (#919)
Alan Guo Xiang Tan [Tue, 21 Jan 2025 08:01:07 +0000 (16:01 +0800)]
DEV: Correct manifest name for images with PG 15 installed (#919)

Follow-up to ab957b2f64b8252e18a657e2e5abe0cff087b38a

10 months agoBuild images with PG 15 installed (#917)
Alan Guo Xiang Tan [Tue, 21 Jan 2025 01:59:32 +0000 (09:59 +0800)]
Build images with PG 15 installed (#917)

This commit updates the build workflow to build and push an extra base Docker
image with PG 15 installed. The tag is not meant to be permanent and is
just meant to help us update our postgres templates to support PG 15
within the same commit.

The tag will be removed once our `discourse/base:release` ships with PG
15 by default.

10 months agoDEV: Remove invalid comment (#916)
Alan Guo Xiang Tan [Thu, 16 Jan 2025 00:48:16 +0000 (08:48 +0800)]
DEV: Remove invalid comment (#916)

This script is used by the build workflow which invalidates the comment

10 months agoDEV: Remove unused docker images (#915)
Jarek Radosz [Wed, 15 Jan 2025 23:52:39 +0000 (00:52 +0100)]
DEV: Remove unused docker images (#915)

1. `monitor` uses a 9 year old base image
2. `discourse_fast_switch` uses a 6 year old base image and references ruby 2.4 and 2.5
3. `discourse_bench` uses an 8 year old base image and references postgres 9.5

10 months agoDEV: Minor cleanup of the workflow (#914)
Jarek Radosz [Wed, 15 Jan 2025 20:46:02 +0000 (21:46 +0100)]
DEV: Minor cleanup of the workflow (#914)

10 months agoSeparate nginx build step (#908)
Jeff Wong [Tue, 14 Jan 2025 21:29:19 +0000 (13:29 -0800)]
Separate nginx build step (#908)

* Revert "Revert "Move nginx installation into another build step (#897)" (#899)"

This reverts commit 0e767585d634f0442438ecd1250804b0572dad1c.

* add nginx runtime dependencies

10 months agoRevert "Add nginx config file and support for outlets (#871)" (#912)
David Taylor [Tue, 14 Jan 2025 16:44:52 +0000 (16:44 +0000)]
Revert "Add nginx config file and support for outlets (#871)" (#912)

This reverts commit 01cbf07622c45106109e6339c8a65e957b6fed5d.

10 months agoAdd nginx config file and support for outlets (#871)
Bianca Nenciu [Tue, 14 Jan 2025 15:56:45 +0000 (17:56 +0200)]
Add nginx config file and support for outlets (#871)

The nginx config file used to be copied from the discourse/discourse
repository, but it has been now moved in this project, closer to the
place where it is used.

The config has several 'include' statements that implement support for
outlets that templates can then use to extend the default configuration
for various features. This is an alternative to the "find & replace"
hacks.

10 months agoBump default base image to discourse/base:2.0.20250114-0014
Jarek Radosz [Tue, 14 Jan 2025 13:56:33 +0000 (14:56 +0100)]
Bump default base image to discourse/base:2.0.20250114-0014

10 months agoFEATURE: Update node to version 22.x (#910)
Jarek Radosz [Mon, 13 Jan 2025 13:01:08 +0000 (14:01 +0100)]
FEATURE: Update node to version 22.x (#910)

10 months agoDEV: Periodic bump of launcher (#906)
Alan Guo Xiang Tan [Tue, 7 Jan 2025 06:18:56 +0000 (14:18 +0800)]
DEV: Periodic bump of launcher (#906)

10 months agoBump Redis to 7.0.15 (#907)
Alan Guo Xiang Tan [Tue, 7 Jan 2025 05:46:53 +0000 (13:46 +0800)]
Bump Redis to 7.0.15 (#907)

Pulls in bug and security fixes since 7.0.7

11 months agoClean up firefox tar file in `discourse/discourse_test` image (#904)
Alan Guo Xiang Tan [Fri, 27 Dec 2024 04:51:33 +0000 (12:51 +0800)]
Clean up firefox tar file in `discourse/discourse_test` image (#904)

11 months agoRemove `git reset --hard` command in web template to reduce layer size (#903)
Alan Guo Xiang Tan [Mon, 23 Dec 2024 08:52:19 +0000 (16:52 +0800)]
Remove `git reset --hard` command in web template to reduce layer size (#903)

I noticed that use running `git reset --hard` results in ~133MB being
added to the final layer generated by `launcher bootstrap`. However, I
can not figure out why we would need to run `git reset --hard` at all.

Even if there is a reason to run `git reset --hard`, it should not be
the default. If someone for whatever reason needs to run `git reset
--hard`, they should do so using the `before_code` hook.

To replicate the problem, one can run the following steps:

1. In the `discourse_docker` repository, create a file named `containers/test.yml` with the following contents:

```
base_image: discourse/base:2.0.20241223-0016

run:
  - exec: sudo -H -E -u discourse bash -c "cd /var/www/discourse && git reset --hard"
```

2. Run `./launcher bootstrap test`
3. Run `docker history local_discourse/test` and see that the new layer created by `./launcher bootstrap` is roughly 133MB.

```
IMAGE          CREATED         CREATED BY                                      SIZE      COMMENT
012471f3c5e4   2 minutes ago   /bin/bash -c /usr/local/bin/pups --stdin        133MB
```

11 months agoRun `npmp prune` and `bundle clean` to clean up unused files (#902)
Alan Guo Xiang Tan [Mon, 23 Dec 2024 08:38:59 +0000 (16:38 +0800)]
Run `npmp prune` and `bundle clean` to clean up unused files (#902)

pnpm packages and bundle gems can add significant size to the Docker
image. Ensure that we clean up those unused files to ensure we don't
add extra diskspace to the final layer when bootstrapping.

11 months agoRevert "FIX: Set the Host header in the nginx.conf upstream block"
Michael Brown [Thu, 19 Dec 2024 20:49:36 +0000 (15:49 -0500)]
Revert "FIX: Set the Host header in the nginx.conf upstream block"

This reverts commit d8a363b60e92fff3ba2338daa6cdb1b04bff3680.

Support for this was removed in nginx - I was unintentionally testing on an old version

11 months agoFIX: Set the Host header in the nginx.conf upstream block
Michael Brown [Thu, 19 Dec 2024 19:53:04 +0000 (14:53 -0500)]
FIX: Set the Host header in the nginx.conf upstream block

Using e.g. `proxy_pass http://discourse` resets the Host header on the upstream
request to `discourse`.

This would break multisites, so we don't want that; the most effetive way to
ensure it's set properly is to `set_header` in the upstream block.

11 months agoRevert "Move nginx installation into another build step (#897)" (#899)
Alan Guo Xiang Tan [Thu, 19 Dec 2024 02:19:13 +0000 (10:19 +0800)]
Revert "Move nginx installation into another build step (#897)" (#899)

This reverts commit d9633894300a55ab2bc3d35a4b986a11d4bc1fa6.

This broke certain assumptions like the `/etc/nginx` directory
exists.

11 months agoPrint docker history summary in build actions (#898)
Alan Guo Xiang Tan [Wed, 18 Dec 2024 01:09:50 +0000 (09:09 +0800)]
Print docker history summary in build actions (#898)

It is useful to know what the size of each layer is after the image has
been built.

11 months agoMove nginx installation into another build step (#897)
Alan Guo Xiang Tan [Tue, 17 Dec 2024 23:07:26 +0000 (07:07 +0800)]
Move nginx installation into another build step (#897)

Avoids polluting the main image with nginx's build dependencies

11 months agoRemove updating of rubygems (#896)
Alan Guo Xiang Tan [Tue, 17 Dec 2024 06:54:12 +0000 (14:54 +0800)]
Remove updating of rubygems (#896)

This adds an additional layer of 20mb for no reason. We don't need to be
running the latest version of rubygems all the time.

Even if we need to update rubygems, it should be updated in https://github.com/discourse/docker-ruby

11 months agoOnly parse a single line from lscpu to get the Cpu(s) count. Avoid localization....
Gullumluvl [Tue, 17 Dec 2024 06:02:21 +0000 (07:02 +0100)]
Only parse a single line from lscpu to get the Cpu(s) count. Avoid localization. (#879)

11 months agoImagemagick enable delegate build and disabled using shared libraries (#889)
Jeff Wong [Tue, 17 Dec 2024 05:28:54 +0000 (21:28 -0800)]
Imagemagick enable delegate build and disabled using shared libraries (#889)

compiles to a single portable binary

Create a base builder package with compile time dependencies. Create an
imagemagick_builder to build imagemagick.

The base builder can be extended for other builders.

Add imagemagick runtime dependencies to discourse_dependencies image
avoid -dev libs

Statically compile as much as possible with --disable-shared and
--enable-delegate-build flags.
References:
https://stackoverflow.com/questions/47031789/imagemagick-100-static-build-for-linux
https://www.imagemagick.org/discourse-server/viewtopic.php?t=14259

Add fonts-urw-base35 for NimbusSans-Regular, needed for letter avatar generation

Copy over the resulting magick bin, as well as etc and share files from the
compilation. etc is needed for magick to run, share is not, but contains
translations for errors which Discourse tests are dependent on reading from.

Create symlinks for other magick tooling - imagemagick creates symlink tool
names that Discourse uses. These *could* be dropped if Discourse decided to use
`magick {toolname}` rather than `{toolname}`.

Add nginx compile dependency - building nginx still needs libfreetype6
This was implicitly installed previously. Removing the imagemagick build from
base broke the next nginx build. Add this dependency back in. This dependency
can be removed once we build nginx separately as well.

11 months agoDEV: Bump rust version to 1.82.0 (#894)
Alan Guo Xiang Tan [Mon, 16 Dec 2024 23:57:38 +0000 (07:57 +0800)]
DEV: Bump rust version to 1.82.0 (#894)

This is to resolve an error we are seeing in our arm64 dev builds

```
24 49.46 error: package `apple-xar v0.20.0` cannot be built because it requires rustc 1.81 or newer, while the currently active rustc version is 1.75.0
24 49.46 Either upgrade to rustc 1.81 or newer, or use
```

11 months agoDEV: Periodic bump of launcher base image (#893)
Alan Guo Xiang Tan [Tue, 10 Dec 2024 02:39:20 +0000 (10:39 +0800)]
DEV: Periodic bump of launcher base image (#893)

Pulls in various fixes and updates

11 months agoInstall `postgresql-client-${PG_MAJOR}` instead of `postgresql-client` (#892)
Alan Guo Xiang Tan [Tue, 3 Dec 2024 02:51:15 +0000 (10:51 +0800)]
Install `postgresql-client-${PG_MAJOR}` instead of `postgresql-client` (#892)

This ensures that the client tools we installed are compatible with the
version of the Postgres cluster.

12 months agoMove source for launcher2 to its own repository. (#890)
Jeff Wong [Tue, 19 Nov 2024 04:37:27 +0000 (20:37 -0800)]
Move source for launcher2 to its own repository. (#890)

12 months agojemalloc build with install_lib_shared libraries (#888)
Jeff Wong [Wed, 13 Nov 2024 01:54:29 +0000 (17:54 -0800)]
jemalloc build with install_lib_shared libraries (#888)

Only output shared lib libraries, we should not need static libraries

12 months agoBump Ruby to 3.3.6 (#885)
Alan Guo Xiang Tan [Wed, 13 Nov 2024 00:49:34 +0000 (08:49 +0800)]
Bump Ruby to 3.3.6 (#885)

This is a routine update that includes minor bug fixes.

See https://www.ruby-lang.org/en/news/2024/11/05/ruby-3-3-6-released/

12 months agoFEATURE: print out compressed image sizes for amd64 (#887)
Jeff Wong [Mon, 11 Nov 2024 07:10:49 +0000 (23:10 -0800)]
FEATURE: print out compressed image sizes for amd64 (#887)

print out compressed image sizes for amd64 in a build step for PRs. Allows for PRs to be automatically reviewed for space efficiency

12 months agoDEV: slim image by dropping building jhead from source, and dropping optipng (#884)
Jeff Wong [Fri, 8 Nov 2024 03:41:21 +0000 (19:41 -0800)]
DEV: slim image by dropping building jhead from source, and dropping optipng (#884)

jhead from apt pulls in a ton of packages, and optipng isn't used. Reduces compressed image size by 8MB.

main: 648.38MB
compiling jhead + dropping optipng: 640.14MB

12 months agoDEV: Remove cache mounts from image/base Dockerfile (#883)
Alan Guo Xiang Tan [Thu, 7 Nov 2024 23:27:55 +0000 (07:27 +0800)]
DEV: Remove cache mounts from image/base Dockerfile (#883)

There are no substantial benefits from using cache mounts here so we
are dropping those mounts.

12 months agoDEV: slim image, drop unused packages and use cache mounts (#880)
Jeff Wong [Mon, 4 Nov 2024 18:49:58 +0000 (10:49 -0800)]
DEV: slim image, drop unused packages and use cache mounts (#880)

* DEV: slim image, drop unused packages and use cache mounts

apt using caches for /var/cache/apt, /var/cache/debconf, and var/lib/apt.

Drop autoconf and build-essential from installs, in favor of selective cmake,
g++, pkg-config, and patch packages.

drop apt-get -y upgrade in dockerfile. We should inherit upgrades from base
images. No need to apt-mark hold initscripts now that we're not running `upgrade`

Remove calls to vim as we no longer install vim here. Remove comment for
slimming locales as we have now done so.

merge all apt layers, minimizing amount of --mount arguments in dockerfile

13 months agoFix Warnung: the "listen ... http2" directive is deprecated (#873)
Tealk [Wed, 16 Oct 2024 02:17:43 +0000 (04:17 +0200)]
Fix Warnung: the "listen ... http2" directive is deprecated (#873)

* Fix Warnung: the "listen ... http2" directive is deprecated

Signed-off-by: Tealk <tealk@anzah.email>
* Update templates/web.ssl.template.yml

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
* add on to http2

---------

Signed-off-by: Tealk <tealk@anzah.email>
Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
13 months agoDEV: generate only en_us locales (#855)
Jeff Wong [Tue, 15 Oct 2024 06:19:13 +0000 (15:19 +0900)]
DEV: generate only en_us locales (#855)

install locales-all installs 245MB
Generating common and en_us locales installs 22MB

update locales for postgres templates

`locale-gen $LANG` doesn't seem to actually do anything without updates to
`/etc/locale.gen`. Update the scripts to uncomment $LANG before running `update-locale`.

13 months agoDEV: force disable precompile on configure (#876)
Jeff Wong [Mon, 30 Sep 2024 12:46:23 +0000 (05:46 -0700)]
DEV: force disable precompile on configure (#876)

Configure option does a precompile, which should forcefully disable
`PRECOMPILE_ON_BOOT` to prevent unnecessary precompile on boot when
`PRECOMPILE_ON_BOOT` env is set in templates.

14 months agoFix the broken build (#870)
Alan Guo Xiang Tan [Mon, 9 Sep 2024 12:47:50 +0000 (20:47 +0800)]
Fix the broken build (#870)

Follow-up to b47bd562cc03961f3208d09c7e00cbbe40b94092

`Error response from daemon: No such image:
discourse/base:2.0.20240909-1149-arm6`

14 months agoRelease `discourse/base` images for `discourse/discourse` stable branch (#864)
Alan Guo Xiang Tan [Mon, 9 Sep 2024 11:49:14 +0000 (19:49 +0800)]
Release `discourse/base` images for `discourse/discourse` stable branch (#864)

This commit updates our `build` workflow to push the following manifests
which can be used to run Discourse against the stable branch.

1. discourse/base:2.0.$TIMESTAMP-stable
2. discourse/base:release-stable

Co-authored-by: David Taylor <david@taylorhq.com>
14 months agoImprove node_modules cleanup logic for stable branch (#869)
David Taylor [Mon, 9 Sep 2024 10:13:18 +0000 (11:13 +0100)]
Improve node_modules cleanup logic for stable branch (#869)

- makes decision based on current state of directory, instead of `$version`
- cleans up the correct directories
- only cleans up the contents. This is important if node_modules directores are mounted volumes (e.g. in devcontainer)

14 months agoDEV: export default base image (#868)
Jeff Wong [Mon, 9 Sep 2024 06:11:55 +0000 (23:11 -0700)]
DEV: export default base image (#868)

allows default base image to be more portable.

14 months agoAdded support of Linux on Mac with ARM processors (#631)
cheungtitus [Mon, 9 Sep 2024 02:09:20 +0000 (10:09 +0800)]
Added support of Linux on Mac with ARM processors (#631)

Co-authored-by: TItus Cheung <cheungtitus@kenrui-group.com>
14 months agoUpdate Discourse installation support in China (pnpm) (#867)
Jeremy [Fri, 6 Sep 2024 16:10:52 +0000 (00:10 +0800)]
Update Discourse installation support in China (pnpm) (#867)

This commit updates 2 things.
1. Updates the yarn hook to replace the npm mirror before `pnpm install`.
2. Removes the `yarn.lock` patch as pnpm is now used.

After applying these modifications, I successfully installed Discourse on the Tencent Cloud China server. No more network problems.

14 months agoSuppress pnpm upgrade notices in logs (#866)
David Taylor [Fri, 6 Sep 2024 09:28:15 +0000 (10:28 +0100)]
Suppress pnpm upgrade notices in logs (#866)

14 months agoClean up nginx folder after installation. (#865)
Alan Guo Xiang Tan [Fri, 6 Sep 2024 07:09:59 +0000 (15:09 +0800)]
Clean up nginx folder after installation. (#865)

14 months agoDEV: update golang versions (#863)
Jeff Wong [Thu, 5 Sep 2024 00:08:17 +0000 (17:08 -0700)]
DEV: update golang versions (#863)

update golang versions and bump dependencies

14 months agoFEATURE: add an option for custom namespaces (#862)
Jeff Wong [Wed, 4 Sep 2024 13:42:02 +0000 (06:42 -0700)]
FEATURE: add an option for custom namespaces (#862)

Add an option to select a targeted namespace, env var DISCOURSE_NAMESPACE

Configure:
Add `source-tag` to select which tag to configure from.
Rename old `tag` option to `target-tag` to differentiate from `source-tag` option

Migrate:
Add `tag` to select which tag to migrate with

14 months agoReduce min docker version to 20.10.0 (#861)
Alan Guo Xiang Tan [Wed, 4 Sep 2024 03:35:26 +0000 (11:35 +0800)]
Reduce min docker version to 20.10.0 (#861)

Follow up to 31931deae8fc05b4d4c0ab8489596179f4ae3421

Docker 20.10.0 works for now so be less aggressive in forcing people to
upgrade.

14 months agoDEV: Bump minimal Docker version to 24.0.7 (#860)
Alan Guo Xiang Tan [Wed, 4 Sep 2024 02:47:58 +0000 (10:47 +0800)]
DEV: Bump minimal Docker version to 24.0.7 (#860)

When running the newer Debian bookworm based images, we are seeing
`(ThreadError) can't create Thread: Operation not permitted` errors when
trying to spawn a thread in Ruby.

A similar issue was reported in https://github.com/docker-library/ruby/issues/429#issuecomment-1708908819
and the fix here is to upgrade Docker. Either way, we should probably
update because Docker 17 has been EOF for many many years.

14 months agoadd tmp directory to gitignore (#859)
Jeff Wong [Tue, 3 Sep 2024 04:12:34 +0000 (21:12 -0700)]
add tmp directory to gitignore (#859)

14 months agoFEATURE: add autocomplete (#857)
Jeff Wong [Tue, 3 Sep 2024 01:54:14 +0000 (18:54 -0700)]
FEATURE: add autocomplete (#857)

14 months agoFEATURE: add runtime features (#849)
Jeff Wong [Mon, 2 Sep 2024 22:09:38 +0000 (15:09 -0700)]
FEATURE: add runtime features (#849)

adds commands for: start, run, stop, cleanup, destroy, logs, enter, restart, rebuild -- carrying over existing run commands from launcher1.

Rebuild will also do its best to minimize downtime with the following steps:

* Detect if Discourse is running as a single container or external DB
* Detect if db:migrate is configured to run on container boot
* Build initial container (keeping existing one online)
* Exit running containers if it's a single container (otherwise keeps existing online)
* Run migrations
  * Defer migrations if db:migrate is configured to run on container boot
  * Run migrations with SKIP_POST_DEPLOYMENT_MIGRATIONS=1 if it's a 2 container setup
  * Otherwise, run all migrations
* Destroy the old container (finally stopping the current, if it's still up here)
* Start the new container
* Run post-deploy migrations
  * Run migrations with SKIP_POST_DEPLOYMENT_MIGRATIONS=0 if it's a 2 container setup

14 months agoDEV: install redis data folder if none exists (#804)
Jeff Wong [Mon, 2 Sep 2024 20:19:43 +0000 (13:19 -0700)]
DEV: install redis data folder if none exists (#804)

14 months agoMake compatible with pnpm (#854)
David Taylor [Mon, 2 Sep 2024 19:55:57 +0000 (20:55 +0100)]
Make compatible with pnpm (#854)

Switches behavior based on the presence of `yarn.lock`

See https://github.com/discourse/discourse/pull/28671

14 months agoSwitch to `discourse/ruby:3.3.4-bookworm-slim` (#853)
Alan Guo Xiang Tan [Mon, 2 Sep 2024 03:49:43 +0000 (11:49 +0800)]
Switch to `discourse/ruby:3.3.4-bookworm-slim` (#853)

14 months agoDEV: remove bundle cache (#852)
Jeff Wong [Sat, 31 Aug 2024 01:05:34 +0000 (18:05 -0700)]
DEV: remove bundle cache (#852)

On the current image this removes ~78MB from the layer

Uncompressed image sizes:
before: 3.3GB
after: 3.23GB

14 months agoRemove use of `discourse/base:aarch64` in launcher2 (#851)
Alan Guo Xiang Tan [Fri, 30 Aug 2024 02:03:17 +0000 (10:03 +0800)]
Remove use of `discourse/base:aarch64` in launcher2 (#851)

Since fc61b8a850e0a7f8c1ef0852a13d735121b4d862, we started shipping
manifests for the `discourse/base` images so we don't have to
specifically pull the tag for arm64.

14 months agoDrop `mac-os` tests for launcher_go (#850)
Alan Guo Xiang Tan [Fri, 30 Aug 2024 00:39:27 +0000 (08:39 +0800)]
Drop `mac-os` tests for launcher_go (#850)

The runners cost 10 times more and there are no macOS specific tests
which we are running.

14 months agoFEATURE: Add workflow for `launcher_go` (#848)
Jeff Wong [Thu, 29 Aug 2024 07:59:12 +0000 (00:59 -0700)]
FEATURE: Add workflow for `launcher_go` (#848)

14 months agoFEATURE: add migrate and bootstrap commands (#842)
Jeff Wong [Thu, 29 Aug 2024 03:01:28 +0000 (20:01 -0700)]
FEATURE: add migrate and bootstrap commands (#842)

Adds command for migrate only. Adds batch commands for bootstrap (build+migrate+configure)

14 months agoDEV: remove oxipng archive in layer (#846)
Jeff Wong [Thu, 29 Aug 2024 02:34:24 +0000 (19:34 -0700)]
DEV: remove oxipng archive in layer (#846)

* DEV: remove oxipng archive in layer

Saves ~52MB for the layer

* DEV: Remove nginx archives

Remove another 1.2MB from image

14 months agoDEV: Improve assertions of `cli_build_test.go` (#844)
Alan Guo Xiang Tan [Wed, 28 Aug 2024 17:02:49 +0000 (01:02 +0800)]
DEV: Improve assertions of `cli_build_test.go` (#844)

This commit improves the assertions by testing against the entire
command string and env so that we can be sure of the full command we are
running.

15 months agoIncrease timeout for scheduled build job (#845)
David Taylor [Wed, 28 Aug 2024 09:19:59 +0000 (10:19 +0100)]
Increase timeout for scheduled build job (#845)

Now that base & dev images are built in the same job, we need a little more time

15 months agoDEV: Minor readability improvements to launcher2 (#843)
Alan Guo Xiang Tan [Wed, 28 Aug 2024 06:20:17 +0000 (14:20 +0800)]
DEV: Minor readability improvements to launcher2 (#843)

15 months agoFEATURE: add configure command (#841)
Jeff Wong [Wed, 28 Aug 2024 05:13:39 +0000 (22:13 -0700)]
FEATURE: add configure command (#841)

Add 'configure' command - If run after the "build" command, this is equivalent to today's 'bootstrap' command.

Note that unlike build command, a docker run+commit pattern needs to be used here as this requires a running database + mounted volumes.

15 months ago[WIP] Launcher2 (#791)
Jeff Wong [Mon, 26 Aug 2024 19:36:41 +0000 (12:36 -0700)]
[WIP] Launcher2 (#791)

Partial merge of Launcher2's CLI

* FEATURE: merge launcher2 - build command

merge launcher2, only build commands

15 months agoFix timeout for arm64 builds not correctly set (#839)
Alan Guo Xiang Tan [Mon, 26 Aug 2024 07:05:20 +0000 (15:05 +0800)]
Fix timeout for arm64 builds not correctly set (#839)

15 months agoBase image in launcher (#838)
Alan Guo Xiang Tan [Mon, 26 Aug 2024 05:22:33 +0000 (13:22 +0800)]
Base image in launcher (#838)

This pulls in the Nginx 1.26.1 update, Ruby 3.3.4 update and Debian
bookworm update.

15 months agoDEV: Introduce arm64 dev image and multi-arch manifests (#829)
David Taylor [Mon, 26 Aug 2024 05:10:28 +0000 (06:10 +0100)]
DEV: Introduce arm64 dev image and multi-arch manifests (#829)

- Combines dev image build into the `base` job
- Calculates a single timestamp for all builds
- Pushes timestamped per-arch images to Dockerhub for base, base-slim and dev images
- If both arch build jobs are successful, multiarch manifests are generated & pushed

15 months agoUpdate GitHub actions runners to ubuntu-22.04 (#837)
David Taylor [Thu, 22 Aug 2024 10:09:50 +0000 (11:09 +0100)]
Update GitHub actions runners to ubuntu-22.04 (#837)

15 months agoBump Ruby to 3.3.4 (#836)
Alan Guo Xiang Tan [Thu, 22 Aug 2024 04:25:15 +0000 (12:25 +0800)]
Bump Ruby to 3.3.4 (#836)

Ruby 3.3.4 has fixes for some regressions in 3.3.3. I don't think it
affects us but still good to upgrade.

15 months agoSwitch to debian:bookworm-slim image (#831)
Alan Guo Xiang Tan [Thu, 22 Aug 2024 02:57:56 +0000 (10:57 +0800)]
Switch to debian:bookworm-slim image (#831)

Debian Bullseye is EOL.

15 months agoEnsure uid, gid for postgres, redis and discourse stays consistent (#835)
Alan Guo Xiang Tan [Thu, 22 Aug 2024 02:57:29 +0000 (10:57 +0800)]
Ensure uid, gid for postgres, redis and discourse stays consistent (#835)

When updating to `debian/base:bookworm` from `debian/base:bullseye`, we
noticed that the uid of the `postgres` and `redis` user changed leading
to permission issues when trying to access directories of mounted volumn
which was previously created with the old uid. The change is because the
`_apt` user is assigned a uid of `42` in Debian bookworm instead of `100`
in Debian bullseye. As a result, the `postgres` user created by the `postgres`
package is automatically assigned a uid of `100` in Debian bookworm instead of `101` in Debian
bullseye.

This commit updates the `slim.Dockefile` to manually add the `postgres`
user and group assigning it a gid of `104` and uid of `101`. The `redis`
user and group is assigned a uid of `103` and a gid of `106`. The
`discourse` user and group is assigned a uid of `1000` and gid of
`1000`.

15 months agoWarmup yarn and bundle caches in dev image (#832)
David Taylor [Tue, 20 Aug 2024 13:51:32 +0000 (14:51 +0100)]
Warmup yarn and bundle caches in dev image (#832)

Uses a multi-stage build with bind mount to avoid adding the discourse repo itself to the layers

15 months agodev: add user-installed gems to PATH (#833)
David Taylor [Tue, 20 Aug 2024 13:51:14 +0000 (14:51 +0100)]
dev: add user-installed gems to PATH (#833)

This is important for usability of things like discourse_theme, and editor tooling (e.g. ruby-lsp)

15 months agoUse flaky-test-retry system (#834)
David Taylor [Tue, 20 Aug 2024 12:44:25 +0000 (13:44 +0100)]
Use flaky-test-retry system (#834)

We use this on the main core repository, so it makes sense to use it here as well. It should reduce the overall flakiness of the discourse_docker build.

15 months agoDEV: Simplify discourse_dev postgres setup (#830)
David Taylor [Mon, 19 Aug 2024 15:44:23 +0000 (16:44 +0100)]
DEV: Simplify discourse_dev postgres setup (#830)

- Remove manual database creation, and instead promote discourse user to postgres SUPERUSER. This means that `db:drop` and `db:create` commands can be run in the dev image, just like in other local development environments. As well as simplifying things, it fixes turbo_rspec, which was previously impossible in the docker dev environment (because `discourse` didn't have permissions to create the parallel databases)

- Stop pre-migrating test database in dev image. It adds additional build time & image size, and doesn't actually help because core's `bin/docker/boot_dev` script overwrites the container's postgres directory with a volume mount

15 months agoUpgrade nginx to 1.26.1 since it is the new stable version (#827)
Alan Guo Xiang Tan [Mon, 19 Aug 2024 01:19:54 +0000 (09:19 +0800)]
Upgrade nginx to 1.26.1 since it is the new stable version (#827)

Since 1.26.x has been marked stable, 1.25.x is automatically EOL as
nginx only maintains one mainline version and one stable version.

15 months agoFix verification of ports (#818)
Pablo Ganuza Vidal [Sun, 18 Aug 2024 22:39:29 +0000 (00:39 +0200)]
Fix verification of ports (#818)

nc needs -p to publish verification code correctly, at least in Debian 12

15 months agoFIX: Broken config and variable handling in setup script (#693)
Derek J. Lambert [Sun, 18 Aug 2024 22:35:56 +0000 (17:35 -0500)]
FIX: Broken config and variable handling in setup script (#693)

* FIX: Variable isn't being set

* DEV: Goodbye tabs, they're probably feeling lonely anyway

* FIX: Variable is never used. No need for command substitution

* FIX: The likelihood of knowing the PID for the script before execution is exceptionally low

15 months agobash tab completion for launcher + discourse-setup (#676)
Jay Pfaffman [Sun, 18 Aug 2024 22:31:55 +0000 (15:31 -0700)]
bash tab completion for launcher + discourse-setup (#676)

add tab completion for launcher and discourse-setup.

For launcher, offers command (e.g., rebuild, start) and then offers yml files from containers directory. After that switches (e.g., --run-image) are offered. (Will not offer switches except in final position, sorry.)

discourse-setup offers switches (e.g., --two-container).

discourse-docter has no command line arguments.

15 months agoDEV: allow multiple configure runs (#828)
Jeff Wong [Mon, 12 Aug 2024 14:43:26 +0000 (07:43 -0700)]
DEV: allow multiple configure runs (#828)

when we have already run an initial setup, fall back to just checking for
socket, rather than outright failing if the init script has already been run.

This allows 'configure' steps to be re-run in standalone cases.

eg: `launcher2 configure app && launcher2 configure app`

current version: fails as it's missing the install_postgres file
with PR: checks for psql socket, and builds.

doing something like `launcher2 start app && launcher2 configure app` would also
print out a more correct error message, "postgres already running stop container"

15 months agoUpdate pgvector to 0.7 (#825)
Rafael dos Santos Silva [Fri, 9 Aug 2024 14:16:38 +0000 (11:16 -0300)]
Update pgvector to 0.7 (#825)

* Update pgvector to 0.7

* escape

* drop version

15 months agoRevert "Switch to Chrome for Testing and drop support for Chromium (#824)" (#826)
Alan Guo Xiang Tan [Fri, 9 Aug 2024 03:05:25 +0000 (11:05 +0800)]
Revert "Switch to Chrome for Testing and drop support for Chromium (#824)" (#826)

This reverts commit bdfcc8ad23d9c8a6754de083e9930caa8837d106.

Broke the test build

15 months agoSwitch to Chrome for Testing and drop support for Chromium (#824)
Alan Guo Xiang Tan [Fri, 9 Aug 2024 01:55:50 +0000 (09:55 +0800)]
Switch to Chrome for Testing and drop support for Chromium (#824)

We started installing Chromium because there is no linux ARM support
for Chrome yet. However, trying to run tests on Chromium seems to be
extra challenging. For example, upgrading to Debian 12 causes our
Javascript tests to fail on Chromium but not on Chrome.

Chrome for Testing was built specifically for web app testing so let's
follow Google's recommendation.

15 months agoBuild `discourse/base` and `discourse/discourse_test` image for bookworm (#823)
Alan Guo Xiang Tan [Thu, 8 Aug 2024 08:29:53 +0000 (16:29 +0800)]
Build `discourse/base` and `discourse/discourse_test` image for bookworm (#823)

We need to upgrade to bookworm because bullseye is EOL. This commit when merged into branch will push the following images to Docker hub:

1. `discourse/base:slim-bookworm`
2. `discourse/base:release-bookworm`
3. `discourse/discourse_test:slim-bookworm`
4. `discourse/discourse_test:slim-browsers-bookworm`
5. `discourse/discourse_test:release-bookworm`

15 months agoFIX: Remove `bundle config jobs` (#821)
Alan Guo Xiang Tan [Thu, 8 Aug 2024 03:23:54 +0000 (11:23 +0800)]
FIX: Remove `bundle config jobs` (#821)

This fixes a regression introduced in
bbefa1e5f387bcad0fac79fea00b39f15f6dee4e. Basically, we cannot configure
the default bundle jobs when building the image because the number of
cores used to build the image can be different from the number of cores
on the machine running the image.

15 months agoIncrease `yarn` network-timeout from 30s to 60s (#820)
David Taylor [Wed, 7 Aug 2024 13:13:50 +0000 (14:13 +0100)]
Increase `yarn` network-timeout from 30s to 60s (#820)

A number of people have reported hitting yarn timeouts on low-spec DO droplets, which causes the build to fail. This should provide a little more leeway

15 months agoFIX: Use `sharedscripts` in `/etc/logrotate.d/rails` (#819)
Alan Guo Xiang Tan [Wed, 31 Jul 2024 04:04:14 +0000 (12:04 +0800)]
FIX: Use `sharedscripts` in `/etc/logrotate.d/rails` (#819)

This commit adds `sharedscripts` which will ensure that our `postrotate`
script is only ran once even if multiple log files in the `/shared/log/rails/`
are rotated. If `sharedscripts` is not specified, we are sending `sv 1
unicorn` once per log file rotated and this has resulted in weird
behaviours like our Sidekiq process hanging indefinitely.

Note the following from the manpage for logrotate:

```
sharedscripts
Normally, prerotate and postrotate scripts are run for each log which is rotated and the absolute path to the log file is passed as first argument to the script. That means a single script may be run multiple times for log file entries which match multiple files (such as the /var/log/news/* example). If sharedscripts is specified, the scripts are only run once, no matter how many logs match the wildcarded pattern, and whole pattern is passed to them.
```

15 months agoDEV: Updated vanilla.template.yml (#817)
Juan David Martínez Cubillos [Tue, 30 Jul 2024 15:11:11 +0000 (17:11 +0200)]
DEV: Updated vanilla.template.yml (#817)

* DEV: Updated vanilla.template.yml

* updated vanilla.template.yml to make the migration process more straight forward

* removed branch pull

* implemented suggested changes

* added suggested chantes

* added before_code hook to set remote fork

* updated with suggested changes

16 months agoDEV: Remove useless lines from `web.template.yml` (#816)
Alan Guo Xiang Tan [Wed, 10 Jul 2024 23:28:47 +0000 (07:28 +0800)]
DEV: Remove useless lines from `web.template.yml` (#816)

The lines are not necessary because those config has already been set in
when we are building the image.

16 months agoBump timeout for arm64 scheduled builds to 60 mins. (#815)
Alan Guo Xiang Tan [Wed, 10 Jul 2024 02:46:30 +0000 (10:46 +0800)]
Bump timeout for arm64 scheduled builds to 60 mins. (#815)

We are hitting timeouts at 45mins.

16 months agoBump base image used by launcher to pull in Ruby 3.3.3 (#813)
Alan Guo Xiang Tan [Tue, 9 Jul 2024 02:06:19 +0000 (10:06 +0800)]
Bump base image used by launcher to pull in Ruby 3.3.3 (#813)

16 months agoDEV: update to use IM7 syntax magick in validation command (#814)
Kelv [Mon, 8 Jul 2024 09:34:01 +0000 (17:34 +0800)]
DEV: update to use IM7 syntax magick in validation command (#814)

17 months agoDEV: Add poppler-utils for PDF -> text handling (#812)
Rafael dos Santos Silva [Tue, 25 Jun 2024 14:41:23 +0000 (11:41 -0300)]
DEV: Add poppler-utils for PDF -> text handling (#812)

17 months agoDEV: Allow ImageMagick to handle PDFs. (#811)
Rafael dos Santos Silva [Mon, 24 Jun 2024 16:24:15 +0000 (13:24 -0300)]
DEV: Allow ImageMagick to handle PDFs. (#811)

17 months agoDEV: Bump Ruby to 3.3.3 (#807)
Alan Guo Xiang Tan [Fri, 14 Jun 2024 00:19:55 +0000 (08:19 +0800)]
DEV: Bump Ruby to 3.3.3 (#807)

Pulls in some bugfixes which may or may not be affecting us.

17 months agoFEATURE: Bump base image used by launcher to pull in Ruby 3.3.x take 2 (#805)
Alan Guo Xiang Tan [Mon, 3 Jun 2024 02:33:29 +0000 (10:33 +0800)]
FEATURE: Bump base image used by launcher to pull in Ruby 3.3.x take 2 (#805)

First attempt in 01ce8cf8f935bf8aeb3d96a7b124ba33a612c07d was reverted
because our new base image was not compatible with the stable branch of
discourse/discourse.

17 months agoBump Ruby to 3.3.2 (#806)
Alan Guo Xiang Tan [Thu, 30 May 2024 22:31:15 +0000 (06:31 +0800)]
Bump Ruby to 3.3.2 (#806)

Pulls in lots of bug fixes: https://github.com/ruby/ruby/releases/tag/v3_3_2

18 months agoRevert "FEATURE: Bump base image used by launcher to pull in Ruby 3.3.1 (#802)" ...
David Taylor [Mon, 20 May 2024 11:10:53 +0000 (12:10 +0100)]
Revert "FEATURE: Bump base image used by launcher to pull in Ruby 3.3.1 (#802)" (#803)

This reverts commit 01ce8cf8f935bf8aeb3d96a7b124ba33a612c07d.

We are investigating incompatibilities with Discourse stable.