From 26e6a23636f51f1998bfc9323ef9459c853474ba Mon Sep 17 00:00:00 2001 From: Tarrien Date: Mon, 7 Aug 2023 10:35:45 -0400 Subject: [PATCH] Final save before migration --- .env.production.migration | 47 +++++++ .env.production.old | 48 +++++++ .../flavours/glitch/utils/resize_image.js | 2 +- ca-certificate.crt | 129 ++++++++++++++++++ config/locales/en.yml | 4 +- .../20180812173710_copy_status_stats.rb | 2 +- .../20181116173541_copy_account_stats.rb | 2 +- lib/mastodon/cli/statuses.rb | 2 +- streaming/index.js | 7 +- 9 files changed, 236 insertions(+), 7 deletions(-) create mode 100644 .env.production.migration create mode 100644 .env.production.old create mode 100644 ca-certificate.crt diff --git a/.env.production.migration b/.env.production.migration new file mode 100644 index 000000000..d3f69eb95 --- /dev/null +++ b/.env.production.migration @@ -0,0 +1,47 @@ +# Generated with mastodon:setup on 2022-11-15 15:48:19 UTC + +LOCAL_DOMAIN=wobbl.xyz +SECRET_KEY_BASE=c83da357f00bdffa6701aa01e6c9bc116c6ef9279df7dcf1d8c38d23c819ac9de81302113b1e2c10ecdb927b15f06001cb75a90c8cfe7b9b98be95b1dd5188ba +OTP_SECRET=792df590b3e0796e6ba6703e516efe83c839d5d4be3769bfa043b0e91d155ffb74f0e2d536db5c92142aaccddbf66b1c26c34d77be418a015e3f2463a6e22320 +VAPID_PRIVATE_KEY=WY5iQamqojTy6wbgrafpzqc8I98TLA-ICd3jJlPqmVg= +VAPID_PUBLIC_KEY=BH4EG4Ptt-__2lG7J8r7E10KDREzkSQWlqWjk12ZypX7_-z4STFDKqhLEnW_k73tSZY9DIBpePgD2oE6WfV52tU= +DB_HOST=wobbl-db-do-user-12896033-0.b.db.ondigitalocean.com +DB_PORT=25061 +DB_NAME=mastodon_production +DB_USER=doadmin +DB_PASS=AVNS_PRyTPQxHtb2b0hVU6k9 +PREPARED_STATEMENTS=false +REDIS_HOST=localhost +REDIS_PORT=6379 +SMTP_SERVER=smtppro.zoho.com +SMTP_PORT=465 +SMTP_LOGIN=drew@gyro-tech.net +SMTP_PASSWORD=xBb11buC51Uw +SMTP_AUTH_METHOD=plain +SMTP_OPENSSL_VERIFY_MODE=none +SMTP_FROM_ADDRESS=Mastodon +SMTP_SSL=true +S3_ALIAS_HOST=media.wobbl.xyz +S3_ENABLED=true +S3_BUCKET=wobblstore +AWS_ACCESS_KEY_ID=DO00CAHETF4R6VJUL2CY +AWS_SECRET_ACCESS_KEY=2TdKYVE2Q7tl4gl5kNHAN9hedJ/4IOWSTciIKshviR0 +S3_PROTOCOL=https +S3_REGION=us-east-1 +S3_HOSTNAME=wobblstore.nyc3.digitaloceanspaces.com +S3_ENDPOINT=https://nyc3.digitaloceanspaces.com +ES_ENABLED=true +ES_HOST=localhost +ES_PORT=9200 +DEEPL_API_KEY="eb039661-3635-bf38-6d92-19a2a15c0795:fx" +DEEPL_PLAN=free +STATSD_ADDR=localhost:9125 +MAX_TOOT_CHARS=1500 + + +# Scaling work +WEB_CONCURRENCY=5 +MAX_THREADS=5 +DB_POOL=18 + +MAX_IMAGE_SIZE=16777216 diff --git a/.env.production.old b/.env.production.old new file mode 100644 index 000000000..5467cc654 --- /dev/null +++ b/.env.production.old @@ -0,0 +1,48 @@ +# Generated with mastodon:setup on 2022-11-15 15:48:19 UTC + +LOCAL_DOMAIN=wobbl.xyz +SECRET_KEY_BASE=c83da357f00bdffa6701aa01e6c9bc116c6ef9279df7dcf1d8c38d23c819ac9de81302113b1e2c10ecdb927b15f06001cb75a90c8cfe7b9b98be95b1dd5188ba +OTP_SECRET=792df590b3e0796e6ba6703e516efe83c839d5d4be3769bfa043b0e91d155ffb74f0e2d536db5c92142aaccddbf66b1c26c34d77be418a015e3f2463a6e22320 +VAPID_PRIVATE_KEY=WY5iQamqojTy6wbgrafpzqc8I98TLA-ICd3jJlPqmVg= +VAPID_PUBLIC_KEY=BH4EG4Ptt-__2lG7J8r7E10KDREzkSQWlqWjk12ZypX7_-z4STFDKqhLEnW_k73tSZY9DIBpePgD2oE6WfV52tU= +DB_HOST=/var/run/postgresql +DB_PORT=5432 +DB_NAME=mastodon_production +DB_USER=mastodon +DB_PASS=bDyxK8nLdCgm +#PREPARED_STATEMENTS=false +REDIS_HOST=localhost +REDIS_PORT=6379 +SMTP_SERVER=smtppro.zoho.com +SMTP_PORT=465 +SMTP_LOGIN=drew@gyro-tech.net +SMTP_PASSWORD=xBb11buC51Uw +SMTP_AUTH_METHOD=plain +SMTP_OPENSSL_VERIFY_MODE=none +SMTP_FROM_ADDRESS=Mastodon +SMTP_SSL=true +S3_ALIAS_HOST=media.wobbl.xyz +S3_ENABLED=true +S3_BUCKET=wobblstore +AWS_ACCESS_KEY_ID=DO00CAHETF4R6VJUL2CY +AWS_SECRET_ACCESS_KEY=2TdKYVE2Q7tl4gl5kNHAN9hedJ/4IOWSTciIKshviR0 +S3_PROTOCOL=https +S3_REGION=us-east-1 +S3_HOSTNAME=wobblstore.nyc3.digitaloceanspaces.com +S3_ENDPOINT=https://nyc3.digitaloceanspaces.com +ES_ENABLED=true +ES_HOST=localhost +ES_PORT=9200 +DEEPL_API_KEY="eb039661-3635-bf38-6d92-19a2a15c0795:fx" +DEEPL_PLAN=free +STATSD_ADDR=localhost:9125 +MAX_TOOT_CHARS=1500 + + +# Scaling work +WEB_CoNCURRENCY=5 +MAX_THREADS=5 +DB_POOL=25 + +# Image Size +MAX_IMAGE_SIZE=16777216 diff --git a/app/javascript/flavours/glitch/utils/resize_image.js b/app/javascript/flavours/glitch/utils/resize_image.js index e3d4e6a35..22058738d 100644 --- a/app/javascript/flavours/glitch/utils/resize_image.js +++ b/app/javascript/flavours/glitch/utils/resize_image.js @@ -1,6 +1,6 @@ import EXIF from 'exif-js'; -const MAX_IMAGE_PIXELS = 2073600; // 1920x1080px +const MAX_IMAGE_PIXELS = 8294400; // 3840x2160px const _browser_quirks = {}; diff --git a/ca-certificate.crt b/ca-certificate.crt new file mode 100644 index 000000000..8db27498b --- /dev/null +++ b/ca-certificate.crt @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + +GYRO-NAS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+
+ + diff --git a/config/locales/en.yml b/config/locales/en.yml index 91b085a94..4813b10e4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1165,9 +1165,9 @@ en: title: Security verification failed '429': Too many requests '500': - content: We're sorry, but something went wrong on our end. You can check the status of Wobbl and its companion systems at our status page - https://status.tarrien.net/status/wobbl . + content: We're sorry, but something went wrong on our end. You can check the status of Wobbl and its companion systems at our status page - https://status.wobbl.xyz. title: This page is not correct - '503': The page could not be served due to a temporary server failure. You can check the status of Wobbl and its companion systems at our status page - https://status.tarrien.net/status/wobbl. + '503': The page could not be served due to a temporary server failure. You can check the status of Wobbl and its companion systems at our status page - https://status.wobbl.xyz. noscript_html: To use the Mastodon web application, please enable JavaScript. Alternatively, try one of the native apps for Mastodon for your platform. existing_username_validator: not_found: could not find a local user with that username diff --git a/db/migrate/20180812173710_copy_status_stats.rb b/db/migrate/20180812173710_copy_status_stats.rb index 20baeeca6..52ab43b76 100644 --- a/db/migrate/20180812173710_copy_status_stats.rb +++ b/db/migrate/20180812173710_copy_status_stats.rb @@ -45,7 +45,7 @@ class CopyStatusStats < ActiveRecord::Migration[5.2] # We cannot use bulk INSERT or overarching transactions here because of possible # uniqueness violations that we need to skip over Status.unscoped.select('id, reblogs_count, favourites_count, created_at, updated_at').find_each do |status| - params = [[nil, status.id], [nil, status.reblogs_count], [nil, status.favourites_count], [nil, status.created_at], [nil, status.updated_at]] + params = [status.id, status.reblogs_count, status.favourites_count, status.created_at, status.updated_at] exec_insert('INSERT INTO status_stats (status_id, reblogs_count, favourites_count, created_at, updated_at) VALUES ($1, $2, $3, $4, $5)', nil, params) rescue ActiveRecord::RecordNotUnique next diff --git a/db/migrate/20181116173541_copy_account_stats.rb b/db/migrate/20181116173541_copy_account_stats.rb index 88dc0c1fe..30d07764e 100644 --- a/db/migrate/20181116173541_copy_account_stats.rb +++ b/db/migrate/20181116173541_copy_account_stats.rb @@ -45,7 +45,7 @@ class CopyAccountStats < ActiveRecord::Migration[5.2] # We cannot use bulk INSERT or overarching transactions here because of possible # uniqueness violations that we need to skip over Account.unscoped.select('id, statuses_count, following_count, followers_count, created_at, updated_at').find_each do |account| - params = [[nil, account.id], [nil, account[:statuses_count]], [nil, account[:following_count]], [nil, account[:followers_count]], [nil, account.created_at], [nil, account.updated_at]] + params = [account.id, account[:statuses_count], account[:following_count], account[:followers_count], account.created_at, account.updated_at] exec_insert('INSERT INTO account_stats (account_id, statuses_count, following_count, followers_count, created_at, updated_at) VALUES ($1, $2, $3, $4, $5, $6)', nil, params) rescue ActiveRecord::RecordNotUnique next diff --git a/lib/mastodon/cli/statuses.rb b/lib/mastodon/cli/statuses.rb index bd5b04707..0d6018a2b 100644 --- a/lib/mastodon/cli/statuses.rb +++ b/lib/mastodon/cli/statuses.rb @@ -61,7 +61,7 @@ module Mastodon::CLI # Skip accounts followed by local accounts clean_followed_sql = 'AND NOT EXISTS (SELECT 1 FROM follows WHERE statuses.account_id = follows.target_account_id)' unless options[:clean_followed] - ActiveRecord::Base.connection.exec_insert(<<-SQL.squish, 'SQL', [[nil, max_id]]) + ActiveRecord::Base.connection.exec_insert(<<-SQL.squish, 'SQL', [max_id]) INSERT INTO statuses_to_be_deleted (id) SELECT statuses.id FROM statuses WHERE deleted_at IS NULL AND NOT local AND uri IS NOT NULL AND (id < $1) AND NOT EXISTS (SELECT 1 FROM statuses AS statuses1 WHERE statuses.id = statuses1.in_reply_to_id) diff --git a/streaming/index.js b/streaming/index.js index 89cb3549d..78014ff63 100644 --- a/streaming/index.js +++ b/streaming/index.js @@ -105,6 +105,11 @@ const pgConfigFromEnv = (env) => { }, }; + if (!!process.env.DB_SSLMODE && process.env.DB_SSLMODE !== 'disable') { + pgConfigs.development.ssl = true; + pgConfigs.production.ssl = {ca: fs.readFileSync("ca-certificate.crt") }; + } + let baseConfig; if (env.DATABASE_URL) { @@ -122,7 +127,7 @@ const pgConfigFromEnv = (env) => { baseConfig.ssl = { rejectUnauthorized: false }; break; default: - baseConfig.ssl = {}; + baseConfig.ssl = { rejectUnauthorized: false }; break; } }