Commit Graph

1589 Commits

Author SHA1 Message Date
Jeff Wong 13dc0c7b6f
DEV: Parameterize offline page repository (#754)
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 (#753) 2023-11-07 18:10:32 -08:00
Jeff Wong b009a3cb76
FEATURE: add offline page template (#752)
* FEATURE: add offline page template
2023-11-01 22:07:05 -07:00
Jeff Wong 1160cf57bc
Bump base image for pups update (#749) 2023-10-23 13:08:42 -07:00
Jeff Wong 78bb83b72a
Bump default base image to 2.0.20231023-1613 (#748)
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 (#745)
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 (#743)
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 (#739)
See also PR #702 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 (#736)
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. (#735)
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 (#734)
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 (#726)
Relies on discourse/discourse#22975 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 (#731) 2023-08-28 15:12:24 -03:00
Leonardo Mosquera bc1383a622
Install latest Postgres client version besides the one for PG_MAJOR (#729)
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 (#730)
it's much more CI-friendly
2023-08-25 11:21:54 +02:00
Sam 0c9284ec51
FEATURE: add ripgrep to the base image (#728)
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 (#725)
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 (#724) 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 (#722)
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 (#718)
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 (#716)
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 (#684) 2023-05-31 21:32:19 -03:00
Jarek Radosz 7eaf87ad99
DEV: Remove `RUBY_GLOBAL_METHOD_CACHE_SIZE` (#711)
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 (#715) 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 (#708)
`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 (#709)
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
Alan Guo Xiang Tan 3d317b7f58 Bump default base image to run Ruby 3.2.2 as default
Ruby 3.2.2 was released with a two security fixes. While the security
fixes have been assessed to have low impact on Discourse, we still want
to get the upgrade in as a preventive measure.
2023-04-10 09:07:00 +08:00
Michael Brown 7a7c47eefa
Add template to enable an IPv6 listener
By default nginx in the container only listens for IPv4 connections. Some users
want to enable direct IPv6 connectivity to the container either via forwarding
or NAT. This provides an easy method to allow that.
2023-04-04 13:36:41 -04:00
David Taylor 4f610e7b5c
Remove stable-specific image (#700)
This was only introduced as a temporary solution for Discourse 2.8, which is now EOL
2023-04-04 10:05:11 +01:00
Rafael dos Santos Silva 0539d9cb84
Bum to latest Ruby (#699) 2023-03-31 11:50:12 -03:00
Blake Erickson 3d3b7c8584
DEV: Ubuntu installs do not like bullseye-backports (#698)
Check for Ubuntu 22.04 and 22.10 versions before trying to use
`bullseye-backports` otherwise they throw this error.

```
E: The value 'bullseye-backports' is invalid for APT::Default-Release as
such a release is not available in the sources failed
```
2023-03-26 07:12:01 -06:00
Gerhard Schlager 5aad43b1d6
FIX: Rebuild was broken when an older image with shallow clone was used (#696)
This adds the original special handling for shallow clones back. It can be removed once everyone uses images with partial clones.
2023-03-13 21:55:19 +01:00
Gerhard Schlager 01f80524b8
Bump base image to support partial clone (#695) 2023-03-13 15:31:22 +01:00
Gerhard Schlager 53bbacc882
DEV: Create partial clone of discourse repository (#691)
A treeless clone is nearly as small as a shallow clone, but it contains the full history which makes it possible to easily checkout tags and commits and allows all features of docker_manager to work correctly.

See https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/ for more information on treeless clones.

Also this change makes it possible to correctly pull the main branch which didn't work before.
2023-03-13 10:58:46 +01:00
Gerhard Schlager 98fa6d771d
DEV: Remove deprecation warnings from bundler (#690) 2023-03-13 10:55:44 +01:00
Gerhard Schlager be563a4df5
FIX: Compiling oxipng didn't work on aarch64 (#694)
This uses the new sparse-registry feature from Rust 1.68 which lowers the memory usage. This avoids that cargo is killed due to an OOM issue (exit code 137) during "Updating crates.io index".
2023-03-13 10:55:15 +01:00
Derek J. Lambert 6c2c026ad3
Compile oxipng from source (#688)
* Download and compile oxipng from source
* Move oxipng install step after rust since it uses cargo
2023-03-09 13:04:11 +11:00
Rafael dos Santos Silva 4810f76dcc
Bump base image for Ruby 3.2 (#682) 2023-02-24 11:39:14 -03:00
Andrew Schleifer 69c82fa112 Bump default base image to discourse/base:2.0.20230217-0055 2023-02-20 11:50:18 +08:00
Rafael dos Santos Silva f68a5cb34d
DEV: Bump Ruby to 3.2.1 (#650)
* DEV: Bump Ruby to 3.2.0

* Add libffi-dev

* Ruby 3.2.1
2023-02-17 20:04:22 -03:00
Jarek Radosz 67690fe645
DEV: Remove `Press any key` from arm64 path (#675) 2023-02-16 12:07:09 +01:00