From 63f3849872b9e5670c591d5c916ea733f463c4c0 Mon Sep 17 00:00:00 2001 From: chimiana Date: Sat, 17 Dec 2022 00:25:46 +0000 Subject: [PATCH 1/5] Changed filenames and .gitignore to allow a working docker-compose next to the example provided --- .gitignore | 3 +++ dev/{docker-compose.yml => docker-compose.yml.example} | 7 +++++++ 2 files changed, 10 insertions(+) rename dev/{docker-compose.yml => docker-compose.yml.example} (86%) diff --git a/.gitignore b/.gitignore index d511fa5adb..ff2b4f8cbd 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,9 @@ coverage !/.config/example.yml !/.config/docker_example.env +#docker dev config +/dev/docker-compose.yml + # misskey /build built diff --git a/dev/docker-compose.yml b/dev/docker-compose.yml.example similarity index 86% rename from dev/docker-compose.yml rename to dev/docker-compose.yml.example index 25c2e9ea9d..5125a7b72b 100644 --- a/dev/docker-compose.yml +++ b/dev/docker-compose.yml.example @@ -4,6 +4,7 @@ services: web: image: docker.io/thatonecalculator/calckey build: .. + container_name: calckey_web restart: always depends_on: - db @@ -13,12 +14,14 @@ services: - "3000:3000" networks: - network +# - web volumes: - ../files:/calckey/files - ../.config:/calckey/.config:ro redis: restart: always + container_name: calckey_redis image: docker.io/redis:7.0-alpine networks: - network @@ -27,6 +30,7 @@ services: db: restart: always + container_name: calckey_db image: docker.io/postgres:12.2-alpine networks: - network @@ -48,3 +52,6 @@ services: networks: network: +# web: +# external: +# name: web From 134a7af41105f679614daea0dd014d85988dde23 Mon Sep 17 00:00:00 2001 From: chimiana Date: Sat, 17 Dec 2022 00:31:39 +0000 Subject: [PATCH 2/5] Changes to server admin docker-compose.yml to support having both a dev and a production docker-compose running off the same configs --- docker-compose.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 41ec491ab7..f51cf1b9a9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,7 @@ version: "3" services: web: image: docker.io/thatonecalculator/calckey + container_name: calckey_web restart: unless-stopped depends_on: - db @@ -17,11 +18,12 @@ services: NODE_ENV: production volumes: - ./files:/calckey/files - - ./config:/calckey/.config:ro + - ./.config:/calckey/.config:ro redis: restart: unless-stopped image: docker.io/redis:7.0-alpine + container_name: calckey_redis networks: - calcnet volumes: @@ -30,6 +32,7 @@ services: db: restart: unless-stopped image: docker.io/postgres:12.2-alpine + container_name: calckey_db networks: - calcnet env_file: From 464a38cc70e6755ce7676784119b65b696ecc23f Mon Sep 17 00:00:00 2001 From: chimiana Date: Sat, 17 Dec 2022 00:35:21 +0000 Subject: [PATCH 3/5] update example.yml with container names specified in docker-compose, to support running either a dev or production containers off the same configs --- .config/example.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.config/example.yml b/.config/example.yml index 29f4a62290..2aabbe4b71 100644 --- a/.config/example.yml +++ b/.config/example.yml @@ -34,7 +34,7 @@ port: 3000 #───┘ PostgreSQL configuration └──────────────────────────────── db: - host: localhost + host: calckey_db port: 5432 # Database name @@ -55,7 +55,7 @@ db: #───┘ Redis configuration └───────────────────────────────────── redis: - host: localhost + host: calckey_redis port: 6379 #family: 0 # 0=Both, 4=IPv4, 6=IPv6 #pass: example-pass @@ -66,7 +66,7 @@ redis: #───┘ Elasticsearch configuration └───────────────────────────── #elasticsearch: -# host: localhost +# host: calckey_es # port: 9200 # ssl: false # user: From 3e9076045c5129deb8445ba9b48eba5f056a6ca3 Mon Sep 17 00:00:00 2001 From: chimiana Date: Sat, 17 Dec 2022 02:26:19 +0000 Subject: [PATCH 4/5] Fix for #9194, converts webp to png instead of jpg, preserving transparency --- packages/backend/src/services/drive/add-file.ts | 4 +++- packages/client/src/scripts/upload.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/services/drive/add-file.ts b/packages/backend/src/services/drive/add-file.ts index a790fd5104..47b19e23ab 100644 --- a/packages/backend/src/services/drive/add-file.ts +++ b/packages/backend/src/services/drive/add-file.ts @@ -217,8 +217,10 @@ export async function generateAlts(path: string, type: string, generateWeb: bool logger.info('creating web image'); try { - if (['image/jpeg', 'image/webp'].includes(type)) { + if (['image/jpeg'].includes(type)) { webpublic = await convertSharpToJpeg(img, 2048, 2048); + } else if (['image/webp'].includes(type)) { + webpublic = await convertSharpToPng(img, 2048, 2048); } else if (['image/png'].includes(type)) { webpublic = await convertSharpToPng(img, 2048, 2048); } else if (['image/svg+xml'].includes(type)) { diff --git a/packages/client/src/scripts/upload.ts b/packages/client/src/scripts/upload.ts index 714c98d6a8..b1562f4a6a 100644 --- a/packages/client/src/scripts/upload.ts +++ b/packages/client/src/scripts/upload.ts @@ -18,7 +18,7 @@ export const uploads = ref([]); const compressTypeMap = { 'image/jpeg': { quality: 0.85, mimeType: 'image/jpeg' }, - 'image/webp': { quality: 0.85, mimeType: 'image/jpeg' }, + 'image/webp': { quality: 0.85, mimeType: 'image/png' }, 'image/svg+xml': { quality: 1, mimeType: 'image/png' }, } as const; From 206223efd3c9a1756e7c3c28b0bfdbf502c7c7e6 Mon Sep 17 00:00:00 2001 From: chimiana Date: Sat, 17 Dec 2022 06:58:33 +0000 Subject: [PATCH 5/5] roll back changes to example.yml --- .config/example.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.config/example.yml b/.config/example.yml index 2aabbe4b71..29f4a62290 100644 --- a/.config/example.yml +++ b/.config/example.yml @@ -34,7 +34,7 @@ port: 3000 #───┘ PostgreSQL configuration └──────────────────────────────── db: - host: calckey_db + host: localhost port: 5432 # Database name @@ -55,7 +55,7 @@ db: #───┘ Redis configuration └───────────────────────────────────── redis: - host: calckey_redis + host: localhost port: 6379 #family: 0 # 0=Both, 4=IPv4, 6=IPv6 #pass: example-pass @@ -66,7 +66,7 @@ redis: #───┘ Elasticsearch configuration └───────────────────────────── #elasticsearch: -# host: calckey_es +# host: localhost # port: 9200 # ssl: false # user: