From 9e33a71efa37945e683bd659054fe35d8df1574d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Fri, 8 Mar 2019 19:16:55 +0900 Subject: [PATCH 1/4] Bump pkg-config from 1.3.4 to 1.3.5 (#10218) Bumps [pkg-config](https://github.com/ruby-gnome2/pkg-config) from 1.3.4 to 1.3.5. - [Release notes](https://github.com/ruby-gnome2/pkg-config/releases) - [Changelog](https://github.com/ruby-gnome2/pkg-config/blob/master/NEWS) - [Commits](https://github.com/ruby-gnome2/pkg-config/compare/1.3.4...1.3.5) Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index fcfe3d4d17e..b33482d4e14 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -400,7 +400,7 @@ GEM pg (1.1.4) pghero (2.2.0) activerecord - pkg-config (1.3.4) + pkg-config (1.3.5) powerpack (0.1.2) premailer (1.11.1) addressable From 42e733681aef45c9e6224aed288e4c845782c173 Mon Sep 17 00:00:00 2001 From: Sascha Date: Fri, 8 Mar 2019 14:36:28 +0100 Subject: [PATCH 2/4] config: add DB_SSLMODE for managed/remote PG (#10210) * config: add DB_SSLMODE for managed/remote PG * streaming: set PG sslmode, defaults to prefer --- config/database.yml | 2 ++ streaming/index.js | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/config/database.yml b/config/database.yml index 82e560515c8..c10bff6b2e6 100644 --- a/config/database.yml +++ b/config/database.yml @@ -3,6 +3,7 @@ default: &default pool: <%= ENV["DB_POOL"] || ENV['MAX_THREADS'] || 5 %> timeout: 5000 encoding: unicode + sslmode: <%= ENV['DB_SSLMODE'] || "prefer" %> development: <<: *default @@ -31,3 +32,4 @@ production: host: <%= ENV['DB_HOST'] || 'localhost' %> port: <%= ENV['DB_PORT'] || 5432 %> prepared_statements: <%= ENV['PREPARED_STATEMENTS'] || 'true' %> + diff --git a/streaming/index.js b/streaming/index.js index b4d09d0ad2c..21a1d47ef23 100644 --- a/streaming/index.js +++ b/streaming/index.js @@ -89,6 +89,9 @@ const startWorker = (workerId) => { host: process.env.DB_HOST || pg.defaults.host, port: process.env.DB_PORT || pg.defaults.port, max: 10, + ssl: { + sslmode: process.env.DB_SSLMODE || 'prefer', + }, }, production: { @@ -98,6 +101,9 @@ const startWorker = (workerId) => { host: process.env.DB_HOST || 'localhost', port: process.env.DB_PORT || 5432, max: 10, + ssl: { + sslmode: process.env.DB_SSLMODE || 'prefer', + }, }, }; From d36fcb54c408536f15de1346f70b4a8c78e9cb34 Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Fri, 8 Mar 2019 09:12:48 -0600 Subject: [PATCH 3/4] Re-organize Dockerfile to improve incremental builds. (#10212) - Always run apt update before any other apt command. (This fixes incremental builds failing if a remote package is updated.) - Only copy dependency lists before installing dependencies. (This means editing code doesn't force all dependencies to be re-downloaded.) - Delete cache in the same layer that it is created. (Otherwise, deleting cache *increases* the size of the image on non-squashed builds.) - Move the installation of some static dependencies to *before* Mastodon code is imported to Docker. --- Dockerfile | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1263efc9347..6373172fcba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,8 @@ RUN echo "Etc/UTC" > /etc/localtime && \ # Install jemalloc ENV JE_VER="5.1.0" -RUN apt -y install autoconf && \ +RUN apt update && \ + apt -y install autoconf && \ cd ~ && \ wget https://github.com/jemalloc/jemalloc/archive/$JE_VER.tar.gz && \ tar xf $JE_VER.tar.gz && \ @@ -33,7 +34,8 @@ RUN apt -y install autoconf && \ ENV RUBY_VER="2.6.1" ENV CPPFLAGS="-I/opt/jemalloc/include" ENV LDFLAGS="-L/opt/jemalloc/lib/" -RUN apt -y install build-essential \ +RUN apt update && \ + apt -y install build-essential \ bison libyaml-dev libgdbm-dev libreadline-dev \ libncurses5-dev libffi-dev zlib1g-dev libssl-dev && \ cd ~ && \ @@ -51,13 +53,14 @@ RUN apt -y install build-essential \ ENV PATH="${PATH}:/opt/ruby/bin:/opt/node/bin" RUN npm install -g yarn && \ - gem install bundler + gem install bundler && \ + apt update && \ + apt -y install git libicu-dev libidn11-dev \ + libpq-dev libprotobuf-dev protobuf-compiler -COPY . /opt/mastodon +COPY Gemfile* package.json yarn.lock /opt/mastodon/ -RUN apt -y install git libicu-dev libidn11-dev \ - libpq-dev libprotobuf-dev protobuf-compiler && \ - cd /opt/mastodon && \ +RUN cd /opt/mastodon && \ bundle install -j$(nproc) --deployment --without development test && \ yarn install --pure-lockfile @@ -83,9 +86,6 @@ RUN apt update && \ useradd -m -u $UID -g $GID -d /opt/mastodon mastodon && \ echo "mastodon:`head /dev/urandom | tr -dc A-Za-z0-9 | head -c 24 | mkpasswd -s -m sha-256`" | chpasswd -# Copy over masto source from building and set permissions -COPY --from=build-dep --chown=mastodon:mastodon /opt/mastodon /opt/mastodon - # Install masto runtime deps RUN apt -y --no-install-recommends install \ libssl1.1 libpq5 imagemagick ffmpeg \ @@ -93,11 +93,9 @@ RUN apt -y --no-install-recommends install \ file ca-certificates tzdata libreadline7 && \ apt -y install gcc && \ ln -s /opt/mastodon /mastodon && \ - gem install bundler - -# Clean up more dirs -RUN rm -rf /var/cache && \ - rm -rf /var/apt + gem install bundler && \ + rm -rf /var/cache && \ + rm -rf /var/lib/apt # Add tini ENV TINI_VERSION="0.18.0" @@ -106,6 +104,10 @@ ADD https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini /tin RUN echo "$TINI_SUM tini" | sha256sum -c - RUN chmod +x /tini +# Copy over masto source, and dependencies from building, and set permissions +COPY --chown=mastodon:mastodon . /opt/mastodon +COPY --from=build-dep --chown=mastodon:mastodon /opt/mastodon /opt/mastodon + # Run masto services in prod mode ENV RAILS_ENV="production" ENV NODE_ENV="production" From 3f4a6d44fe8366dc4d71501dc2d799d641af4687 Mon Sep 17 00:00:00 2001 From: ThibG Date: Fri, 8 Mar 2019 19:59:08 +0100 Subject: [PATCH 4/4] Fix setting up fields of a previously suspended account (#10222) Fix #10177 for real --- app/models/account.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/account.rb b/app/models/account.rb index b1abd8f0d81..b81c641820e 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -266,6 +266,7 @@ class Account < ApplicationRecord return if fields.size >= DEFAULT_FIELDS_SIZE tmp = self[:fields] || [] + tmp = [] if tmp.is_a?(Hash) (DEFAULT_FIELDS_SIZE - tmp.size).times do tmp << { name: '', value: '' }