Skip to content

Commit bd542ff

Browse files
committed
Update nginx config and docker files to use Debian Bookworm with Ruby 3.1
Nginx proxy needed update on buffer size to avoid error about "upstream sent too big header".
1 parent f1675d2 commit bd542ff

File tree

6 files changed

+75
-40
lines changed

6 files changed

+75
-40
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@
2323
/uploads
2424
/vendor/ruby
2525
/vendor/bundle
26+
/coverage

db/schema.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
t.index ["user_id"], name: "index_nodes_on_user_id"
206206
end
207207

208-
create_table "oauth_access_grants", id: :integer, charset: "utf8mb3", force: :cascade do |t|
208+
create_table "oauth_access_grants", id: :integer, charset: "utf8", force: :cascade do |t|
209209
t.integer "resource_owner_id", null: false
210210
t.integer "application_id", null: false
211211
t.string "token", null: false
@@ -219,7 +219,7 @@
219219
t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true
220220
end
221221

222-
create_table "oauth_access_tokens", id: :integer, charset: "utf8mb3", force: :cascade do |t|
222+
create_table "oauth_access_tokens", id: :integer, charset: "utf8", force: :cascade do |t|
223223
t.integer "resource_owner_id"
224224
t.integer "application_id", null: false
225225
t.string "token", null: false
@@ -234,7 +234,7 @@
234234
t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true
235235
end
236236

237-
create_table "oauth_applications", id: :integer, charset: "utf8mb3", force: :cascade do |t|
237+
create_table "oauth_applications", id: :integer, charset: "utf8", force: :cascade do |t|
238238
t.string "name", null: false
239239
t.string "uid", null: false
240240
t.string "secret", null: false
Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,39 @@
1-
FROM ruby:2-slim-buster
1+
FROM ruby:3-slim-bookworm
22

3-
LABEL maintainer="[email protected]"
4-
LABEL version="1.0"
5-
LABEL description="Run LinuxFr board service for LinuxFr.org Ruby on Rails website"
3+
LABEL org.opencontainers.image.title="LinuxFr.org boards"
4+
LABEL org.opencontainers.image.description="Push notifications for chat rooms of LinuxFr"
5+
LABEL org.opencontainers.image.source="https://github.com/linuxfrorg/board-sse-linuxfr.org"
6+
LABEL org.opencontainers.image.url="https://github.com/linuxfrorg/linuxfr.org/blob/master/Container.md"
7+
LABEL org.opencontainers.image.licenses="AGPL-3.0-only"
8+
LABEL org.opencontainers.image.version="ruby3-bookworm"
9+
LABEL org.opencontainers.image.authors="Adrien Dorsaz <[email protected]>"
610

7-
WORKDIR /linuxfr-board
11+
ARG UID=1200
812

9-
# Install dependencies
1013
RUN apt-get update \
14+
# Install dependencies \
1115
&& apt-get install -y --no-install-recommends \
12-
build-essential ruby ruby-dev \
16+
build-essential git ruby ruby-dev \
1317
&& apt-get clean
1418

19+
USER ${UID}
20+
WORKDIR /linuxfr-board
21+
ENV HOME=/linuxfr-board
22+
1523
# Install board-linuxfr
16-
RUN gem install board-linuxfr -v '~> 0.1.3'
24+
# RUN gem install board-linuxfr -v '~> 0.1.4'
25+
26+
# Temporary build board-linuxfr from sources
27+
RUN git clone https://github.com/linuxfrorg/board-sse-linuxfr.org.git --branch ruby3 \
28+
&& cd board-sse-linuxfr.org \
29+
&& gem build board-linuxfr.gemspec \
30+
&& gem install ./board-linuxfr-*.gem
1731

18-
RUN apt purge --autoremove -y build-essential ruby-dev
32+
# Clean development dependencies
33+
USER 0
34+
RUN apt purge --autoremove -y build-essential git ruby-dev
1935

36+
USER ${UID}
2037
EXPOSE 9000
2138

2239
CMD ["board-linuxfr"]

deployment/linuxfr-img/Dockerfile

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,34 @@
11
FROM debian:bullseye-slim as build
22

3-
LABEL maintainer="[email protected]"
4-
LABEL version="2.0"
5-
LABEL description="Run LinuxFr image caching service for LinuxFr.org"
3+
LABEL org.opencontainers.image.title="LinuxFr.org image caching service"
4+
LABEL org.opencontainers.image.description="Store external images into a cache to not flood external website"
5+
LABEL org.opencontainers.image.source="https://github.com/linuxfrorg/img-LinuxFr.org"
6+
LABEL org.opencontainers.image.url="https://github.com/linuxfrorg/linuxfr.org/blob/master/Container.md"
7+
LABEL org.opencontainers.image.licenses="AGPL-3.0-only"
8+
LABEL org.opencontainers.image.version="rails7-bullseye"
9+
LABEL org.opencontainers.image.authors="Adrien Dorsaz <[email protected]>"
610

7-
ENV GOPATH=/linuxfr-img
8-
WORKDIR /linuxfr-img
11+
ARG UID=1200
912

10-
# Build linuxfr-img
1113
RUN apt-get update \
1214
&& apt-get install -y --no-install-recommends \
1315
golang git ca-certificates \
14-
&& apt-get clean \
15-
&& go get -u github.com/linuxfrorg/img-LinuxFr.org
16+
&& apt-get clean
17+
18+
USER ${UID}
19+
ENV GOPATH=/linuxfr-img
20+
ENV HOME=/linuxfr-img
21+
WORKDIR /linuxfr-img
22+
23+
# Build linuxfr-img
24+
RUN go get -u github.com/linuxfrorg/img-LinuxFr.org
1625

1726
FROM debian:bullseye-slim as deploy
1827

28+
USER ${UID}
1929
WORKDIR /linuxfr-img
2030

21-
COPY --from=build /linuxfr-img/bin/img-LinuxFr.org .
31+
COPY --from=build --chown=${UID}:0 --chmod=770 /linuxfr-img/bin/img-LinuxFr.org .
2232

2333
EXPOSE 8000
2434

deployment/linuxfr.org/Dockerfile

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,49 @@
1-
FROM debian:stretch-slim
1+
FROM debian:bookworm-slim
22

3-
LABEL maintainer="[email protected]"
4-
LABEL version="1.0"
5-
LABEL description="Run LinuxFr.org Ruby on Rails website"
3+
LABEL org.opencontainers.image.title="LinuxFr.org website"
4+
LABEL org.opencontainers.image.description="Run LinuxFr.org Ruby on Rails website"
5+
LABEL org.opencontainers.image.source="https://github.com/linuxfrorg/linuxfr.org"
6+
LABEL org.opencontainers.image.url="https://github.com/linuxfrorg/linuxfr.org/blob/master/Docker.md"
7+
LABEL org.opencontainers.image.licenses="AGPL-3.0-only"
8+
LABEL org.opencontainers.image.version="rails7-bookworm"
9+
LABEL org.opencontainers.image.authors="Adrien Dorsaz <[email protected]>"
610

7-
WORKDIR /linuxfr.org
11+
ARG UID=1200
812

913
# Install system dependencies
10-
# Debian Stretch has been archived so we replace the sources with the archived ones
11-
RUN echo 'deb http://archive.debian.org/debian stretch main' > '/etc/apt/sources.list' \
12-
&& echo 'deb http://archive.debian.org/debian stretch-proposed-updates main' >> '/etc/apt/sources.list' \
13-
&& echo 'deb http://archive.debian.org/debian stretch-backports main' >> '/etc/apt/sources.list.d/linuxfr.list' \
14-
&& apt-get update \
14+
RUN apt-get update \
1515
&& apt-get install -y --no-install-recommends --allow-downgrades \
16-
mysql-client libmysql++-dev git \
17-
build-essential openssl libreadline-dev curl libcurl4-openssl-dev zlib1g=1:1.2.8.dfsg-5 \
16+
mariadb-client libmariadb++-dev git \
17+
build-essential openssl libreadline-dev curl libcurl4-openssl-dev zlib1g \
1818
zlib1g-dev libssl-dev libxml2-dev libxslt-dev autoconf libgmp-dev libyaml-dev \
1919
ncurses-dev bison automake libtool imagemagick libc6-dev hunspell \
2020
hunspell-fr-comprehensive ruby ruby-dev ruby-rack \
21-
&& gem install bundler -v 1.17.3 \
21+
nodejs npm \
22+
&& gem install bundler -v 2.4.20 \
2223
&& apt-get clean
2324

24-
RUN mkdir /home/linuxfr.org
25-
ENV HOME /home/linuxfr.org
25+
USER ${UID}
26+
ENV HOME=/linuxfr.org
27+
WORKDIR /linuxfr.org
2628

2729
# Install external dependencies
28-
COPY Gemfile* ./
30+
COPY --chown=${UID}:0 --chmod=770 Gemfile* ./
2931

3032
RUN bundle config set path 'vendor/bundle' \
3133
&& bundle config set deployment 'true' \
3234
&& bundle install
3335

3436
# Configure the application
35-
COPY deployment/linuxfr.org/database.yml config/database.yml
36-
COPY config/secrets.yml.sample config/secrets.yml
37+
COPY --chown=${UID}:0 --chmod=770 deployment/linuxfr.org/database.yml config/database.yml
38+
COPY --chown=${UID}:0 --chmod=770 config/secrets.yml.sample config/secrets.yml
3739

3840
# Bundle source code
39-
COPY . /linuxfr.org
41+
COPY --chown=${UID}:0 --chmod=770 . /linuxfr.org
4042

4143
EXPOSE 3000
4244

45+
# Workaround for EACCESS error while running assets.rb
46+
USER 0
47+
4348
CMD ["bin/rails", "server", "--binding", "0.0.0.0"]
4449

deployment/nginx/templates/dlfp.conf.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ server {
2929
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
3030
proxy_set_header Host $http_host;
3131
proxy_redirect off;
32+
proxy_buffers 8 16k;
33+
proxy_buffer_size 32k;
3234
proxy_pass http://linuxfr.org:3000;
3335
}
3436
}

0 commit comments

Comments
 (0)