Commit graph

1604 commits

Author SHA1 Message Date
Rafael dos Santos Silva
6765ecc554
FIX: Config page size for Redis Jemalloc on ARM64 () 2024-03-01 17:14:57 -03:00
Rafael dos Santos Silva
62bdb930d9
FIX: Move arm to newer jemalloc () 2024-03-01 14:34:46 -03:00
Andrew Schleifer
64ae2b03b2 remove swapfile script
The instructions have, for quite some time now, pointed users at the
`discourse-setup` script. That will prompt the user to create a swapfile
if necessary and configure relevant sysctls.
2024-03-01 10:18:53 +08:00
Rafael dos Santos Silva
4d0e712b9e
FIX: Adapt jemalloc page size for pi5 bookworm PAGESIZE ()
Debian Bookwork on Pi 5 uses 64k pages, so we need to adapt the jemalloc.

This should be compatible with pi4 and older too.
2024-02-29 14:13:54 -03:00
Evgeni Golov
352d9dbe98 use DISCOURSE_BASE_URL in mail-receiver sample
while `DISCOURSE_MAIL_ENDPOINT` is still accepted by the mail-receiver code, the documentation prefers `DISCOURSE_BASE_URL` and so should this example

see deae52039f/README.md
2024-02-29 22:14:35 +08:00
Mwaniki Wairungu
0f4e63540d FEATURE: Add template for PostgreSQL 15
The new templates/postgres.15.template.yml file allows bootstrapping
new containers using PostgreSQL version 15, or upgrading an existing
container running on older PostgreSQL versions.

The default postgres template and base image shall be bumped in a
follow-up commit.
2024-02-29 22:09:16 +08:00
Alan Guo Xiang Tan
7cc301e9a9
PERF: Speed up building slim image by setting --jobs to number of cores ()
On a M3 Max macbook pro with 14 cores,

Before:

```
=> [25/44] RUN /tmp/install-imagemagick                                 150.6s
=> [27/44] RUN /tmp/install-jemalloc                                     54.9s
=> [31/44] RUN /tmp/install-redis                                        42.9s
```

After:

```
=> [25/44] RUN /tmp/install-imagemagick                                  44.4s
=> [27/44] RUN /tmp/install-jemalloc                                     13.7s
=> [31/44] RUN /tmp/install-redis                                        11.7s
```
2024-02-06 16:38:04 +08:00
Alan Guo Xiang Tan
a03cdcb257
PERF: Use -O2 gcc compilation flag for imagemagick ()
Why this change?

We have noticed that our compiled imagemagick binary is slower than the
distributed binaries in the same environment and started debugging why.
One thing I noticed is that distributed binaries usually include the
`-O2` gcc compilation flag. When applying it locally, I saw significant
speed up.

Without -O2 flag:

```
root@1d7277f72a4f:/# time convert -limit memory 10GiB -limit disk 10GiB -size $(seq 8000 8500 | shuf | head -n1)x9000 xc:"rgb($(shuf -i 0-255 -n1),$(shuf -i 0-255 -n1),$(shuf -i 0-255 -n1))" random_image.png

real	0m3.376s
user	0m6.355s
sys	0m0.410s
root@1d7277f72a4f:/# time identify -format "%Q" random_image.png
92
real	0m1.018s
user	0m0.883s
sys	0m0.135s
```

With -O2 flag:

```
root@0779afa71102:/# time convert -limit memory 10GiB -limit disk 10GiB -size $(seq 8000 8500 | shuf | head -n1)x9000 xc:"rgb($(shuf -i 0-255 -n1),$(shuf -i 0-255 -n1),$(shuf -i 0-255 -n1))" random_image.png

real	0m1.118s
user	0m1.555s
sys	0m1.680s
root@0779afa71102:/# time identify -format "%Q" random_image.png
92
real	0m0.330s
user	0m0.197s
sys	0m0.133s
```
2024-02-06 07:43:15 +08:00
Loïc Guitaut
1964d1737a FEATURE: Add early support for aarch64 in dev env
This patch adds some new steps to support the aarch64 architecture
on Linux.

An updated version of Rust is needed to compile the `selenium-manager`
binary as it’s not shipped with the `selenium-webdriver` gem yet.
In the same vein, Google doesn’t ship an aarch64 version of Chrome yet,
so it doesn’t make sense to install even Chromium in the image. We have
to rely on Firefox to run the system specs.
2024-01-30 10:23:57 +01:00
Chris Rendle-Short
fcce137604 Bump default base image to discourse/base:2.0.20231218-0429 2023-12-19 11:24:35 +11:00
Chris Rendle-Short
529267f1ec
SECURITY: Bump Nginx to 1.25.3 ()
The updated version contains mitigations against CVE-2023-44487 (HTTP/2 rapid reset attack).

Upstream changelog: https://nginx.org/en/CHANGES
2023-12-18 15:18:44 +11:00
Andrew Schleifer
d0d787a14c Bump default base image to discourse/base:2.0.20231214-0023 2023-12-17 17:50:34 +08:00
Jeff Wong
dfcbcf9ac5
DEV: add plugin_compatibility hook () 2023-12-06 13:08:48 -08:00
Michael Brown
1f33e0ad55
FIX: Y/n prompt should treat "no value" as yes 2023-12-01 18:25:13 -05:00
Alan Guo Xiang Tan
e06026b97c
FIX: Install plugin gems in discourse/discourse_test image ()
Why this change?

In
dec68d780c,
the `plugin:install_all_gems` Rake task was made a noop because the Rake
task itself was flawed and running a Rake task will actually activate
all plugins which installs the required gems in the process. However,
plugins are not automatically activated in the test environment which
this image operates in. As such, we need to set `LOAD_PLUGINS=1` to when
running the `plugin:install_all_gems` Rake task.
2023-11-23 18:12:37 +08:00
Jeff Wong
13dc0c7b6f
DEV: Parameterize offline page repository ()
allow for a custom offline page repository
2023-11-09 15:08:35 -08:00
Jeff Wong
f02a2365b3
add env for migrate, precompile and create db on boot () 2023-11-07 18:10:32 -08:00
Jeff Wong
b009a3cb76
FEATURE: add offline page template ()
* FEATURE: add offline page template
2023-11-01 22:07:05 -07:00
Jeff Wong
1160cf57bc
Bump base image for pups update () 2023-10-23 13:08:42 -07:00
Jeff Wong
78bb83b72a
Bump default base image to 2.0.20231023-1613 ()
Updates latest version of pups, allowing --tags and --skip-tags arguments
2023-10-23 11:35:30 -07:00
Alan Guo Xiang Tan
c29cba70fc
DEV: Fix broken ARM64 build ()
Why this change?

The `docker tag discourse/base:aarch64-slim localhost:5000/discourse/base:aarch64-slim
` command broked in 0c93b2207d because
there is no `aarch64-slim` image being built. Instead, the `ruby
auto_build.rb base_slime_64` command builds an image with the
`discourse/base:build_slim_arm64` tag.

What does this change do?

This change removes the tagging command because it is pointless for us
to tag it.
2023-10-17 16:08:49 +08:00
Alan Guo Xiang Tan
0c93b2207d
DEV: Remove use of --squash flag and switch to buildx ()
Why this change?

In CI, we are seeing the following warning message:

```
WARNING: experimental flag squash is removed with BuildKit. You should squash inside build using a multi-stage Dockerfile for efficiency.
```

Basically, the `--squash` flag has not been working for quite some time
and is redundant.

What does this change do?

* This change removes the use of the `--squash` flag.

* This change uses the `buildx` tool in `auto_build.rb` as we prepare to
  build images for multiple platforms.
2023-10-16 10:41:05 +08:00
BigEd
246f03b461
fixup count of physical cores in discourse-setup ()
See also PR  for branch master
2023-10-09 15:47:25 +02:00
Andrew Schleifer
fed879dff5 Bump default base image to discourse/base:2.0.20231004-0028 2023-10-04 15:53:20 +08:00
Alan Guo Xiang Tan
bd472449d8
DEV: Configure bundle jobs to 4 ()
This ensures that we be default runs bundle install with at least 4
jobs.
2023-09-15 09:49:13 +08:00
Alan Guo Xiang Tan
c557b9af73
DEV: Install bundler version used by Discourse as a default. ()
Why this change?

Previously we were running `gem install bundler` to install bundler but
this would install the latest bundler version instead of the bundler
version being used by Discourse. As a result, we end up having to
install bundler over and over again when using the image most of the
time.
2023-09-14 08:38:47 +08:00
Daniel Waterworth
1d43194992
DEV: Switch test container to use exec instead of shell entrypoint ()
This allows command line arguments to be passed.
2023-09-11 11:24:21 -05:00
Martin Brennan
2fe72f123b
DEV: Add minio install to test image ()
Relies on  to be merged first;
the minio_runner gem can self-install minio, but it's better to just bake the binaries
into the test image. Just uses the script/install_minio.rb script to use the gem to
install required binaries.

We are adding minio to the core project to run system tests for S3 uploads
using minio as a mock S3 store.
2023-08-30 10:47:32 +10:00
Leonardo Mosquera
5651ff1c0e
Bump default base image to discourse/base:2.0.20230825-1850 () 2023-08-28 15:12:24 -03:00
Leonardo Mosquera
bc1383a622
Install latest Postgres client version besides the one for PG_MAJOR ()
Before, if a remote server is upgraded to a newer PG version, it wouldn't be able to be backed up from inside the application, since `pg_dump` would be a lower version, resulting in this:

```
pg_dump: error: server version: 15.3; pg_dump version: 13.11 (Debian 13.11-1.pgdg110+1)
pg_dump: error: aborting because of server version mismatch
```

With this change, `postgresql-${PG_MAJOR}` pulls in `postgresql-client` for the server version, AND `postgresql-client` metapackage pulls in the latest version available in the upstream Apt repository.

This guarantees there will be a `pg_dump` for the latest version available, so a remote server freshly upgraded to that latest version will always be able to be backed up from inside the application (since [`pg_wrapper`](https://github.com/credativ/postgresql-common/blob/master/pg_wrapper#L110) chooses the latest locally available version for remote connections).

* Bump Postgres client version ahead of Postgres server version bump
* Fall back to PG_MAJOR if client env var is undefined
* Use postgresql-client metapackage instead for latest client version
2023-08-25 15:30:28 -03:00
Jarek Radosz
97ebba2902
DEV: Use plain buildkit output ()
it's much more CI-friendly
2023-08-25 11:21:54 +02:00
Sam
0c9284ec51
FEATURE: add ripgrep to the base image ()
ripgrep is going to be used by discourse-ai to extract context from files
on the local disk.

This does increase the size of the image by 1.7MB or so, but heavily simplifies
deployment

Alternative mechanisms exists such as packing the binary in a gem but we
would pay more at install time delays.
2023-08-24 15:33:55 -03:00
David Taylor
313f86feff
Move RAILS_ENV to release image; build discourse_dev from slim ()
Unfortunately there is no way to 'unset' an ENV in a Dockerfile. We were working around this by setting `RAILS_ENV` to an empty string in the discourse_dev dockerfile, but that didn't work in every situation.

The discourse_dev image doesn't rely on anything in the 'release' layer of the base image. In fact, it deletes the entire contents of `/var/www/*`.

This commit resolves the situation by:

- Moving the `RAILS_ENV=production` line to the 'release' layer of the base image
- Updating the discourse_dev image to be based on the 'slim' base image
2023-07-26 12:18:10 +01:00
Rafael dos Santos Silva
aa9d0a11ed
Enable pgvector in postgres template () 2023-07-13 15:34:12 -03:00
Andrew Schleifer
58eada7864 Bump default base image to discourse/base:2.0.20230711-0100 2023-07-11 14:23:06 +08:00
David Taylor
4fe3ef7338
FIX: Cleanup node_modules when using non-default branch ()
Yarn seems to have issues 'downgrading' our set of packages from tests-passed (which are pre-installed in the base image) to the versions on the stable branch.

In the medium term we intend to switch to the pnpm package manager, which shouldn't have this issue. In the meantime, we can work around the problem by deleting the pre-installed node_modules and installing from scratch.

https://meta.discourse.org/t/270491
2023-07-04 14:39:54 +01:00
Andrew Schleifer
984d5495ed Bump default base image to discourse/base:2.0.20230703-0055 2023-07-03 17:55:26 +08:00
Andrew Schleifer
54a7cc8892 bump acme.sh to 3.0.6 2023-06-14 20:00:09 +08:00
David Taylor
4d25331df4
PERF: Uninstall rust toolkit once ruby is built ()
This tooling adds significant size to our docker image. We only need rust tooling while installing ruby/oxipng, and can clean it up immediately afterwards to avoid it persisting in the image
2023-06-09 13:40:27 +01:00
David Taylor
e9fc91ada7
Skip attempting maxminddb:get during build ()
Fetching the maxmind database requires a license key, which we do not include during our base image build. This rake task has been failing with an error for some time

```
MaxMind IP database updates require a license
```

Following 0330f51d75, the task now hard-fails and breaks the build.
2023-06-06 10:37:15 +01:00
Rafael dos Santos Silva
84c754b1bd
FEATURE: Install pgvector for PostgreSQL () 2023-05-31 21:32:19 -03:00
Jarek Radosz
7eaf87ad99
DEV: Remove RUBY_GLOBAL_METHOD_CACHE_SIZE ()
It doesn't do anything since ruby 3.0.0.preview1. It was removed in https://github.com/ruby/ruby/pull/2888
2023-05-09 11:57:55 +02:00
David Taylor
225c3d0389
Bump default base image to 2.0.20230502-0058 () 2023-05-02 15:55:16 +01:00
Alan Guo Xiang Tan
c90e6de793 DEV: Introduce `enable-ruby-yjit template
This adds the `RUBY_YJIT_ENABLE` environment variable which would enable
Ruby 3.2's YJIT. See
https://github.com/ruby/ruby/blob/master/doc/yjit/yjit.md for more
information about YJIT.
2023-05-01 10:32:34 +07:00
Saj Goonatilleke
04d4ef6957 templates: abort on fetch error 2023-04-27 19:29:23 +10:00
David Taylor
9f7a969dc8
DEV: Install all yarn dependencies ()
`devDependencies` is often used for things like ember-cli build tooling. Until now we have been moving those things to `dependencies` in our `package.json`, but it makes more sense for us to conform to the industry norms.
2023-04-24 11:33:34 +01:00
Andrew Schleifer
c4ff0d122e Bump default base image to discourse/base:2.0.20230420-0104 2023-04-24 10:21:50 +08:00
Rafael dos Santos Silva
d54cc57f5f
DEV: Wait up to 10 minutes for safe PG stop ()
Over the years we had LOTS of cases of PostgreSQL instances that weren't stopped properly. This gives PG more time to handle it's shutdown cleanly on the worst case, but will still shutdown fast in normal cases.
2023-04-19 17:02:28 -03:00
Gerhard Schlager
82bec846a1 FEATURE: Store the version parameter as custom value in git config
This is particularly useful when the version is pointing to a git tag like `beta`, otherwise we won't be able to reliably detect the tracked version at runtime.
2023-04-19 15:53:10 +02:00
Gerhard Schlager
b8f7fdee0b FIX: Rebuild fails when tracked version switches from branch to tag
We are replacing the `beta` branch with a tag of the same name. Rebuilding a container will fail when a user tracks the `beta` version and the base image was built at a time where `beta` was still a branch. This resolves that by pruning tags and branches and forcing an update of tags during the rebuild.
2023-04-19 15:53:10 +02:00