From 611d336f947e2273fa6cdd58f38fd76918b79c9c Mon Sep 17 00:00:00 2001 From: Nutomic Date: Thu, 17 Mar 2022 16:28:35 +0000 Subject: [PATCH] Remove docker/prod unused files (fixes #2086) (#2133) --- docker/prod/deploy-federation-test.sh | 14 --- docker/prod/docker-compose.yml | 49 ----------- docker/prod/migrate-pictshare-to-pictrs.bash | 92 -------------------- docker/prod/deploy.sh => scripts/release.sh | 0 4 files changed, 155 deletions(-) delete mode 100755 docker/prod/deploy-federation-test.sh delete mode 100644 docker/prod/docker-compose.yml delete mode 100644 docker/prod/migrate-pictshare-to-pictrs.bash rename docker/prod/deploy.sh => scripts/release.sh (100%) diff --git a/docker/prod/deploy-federation-test.sh b/docker/prod/deploy-federation-test.sh deleted file mode 100755 index e9d9aef8..00000000 --- a/docker/prod/deploy-federation-test.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -set -e - -TAG="federation-test" - -sudo docker build ../../ --file Dockerfile -t "dessalines/lemmy:$TAG" -sudo docker save "dessalines/lemmy:$TAG" -o "$TAG.tar" -sudo chown "$(id -u):$(id -g)" "$TAG.tar" - -scp "$TAG.tar" enterprise.lemmy.ml: -rm "$TAG.tar" -ssh lemmy-test "cat $TAG.tar | docker load" -ssh lemmy-test "rm $TAG.tar" -ssh lemmy-test "cd /lemmy/enterprise.lemmy.ml && docker-compose up -d" \ No newline at end of file diff --git a/docker/prod/docker-compose.yml b/docker/prod/docker-compose.yml deleted file mode 100644 index 94c01492..00000000 --- a/docker/prod/docker-compose.yml +++ /dev/null @@ -1,49 +0,0 @@ -version: '2.2' - -services: - postgres: - image: postgres:12-alpine - environment: - - POSTGRES_USER=lemmy - - POSTGRES_PASSWORD=password - - POSTGRES_DB=lemmy - volumes: - - ./volumes/postgres:/var/lib/postgresql/data - restart: always - - lemmy: - image: dessalines/lemmy:0.16.1 - ports: - - "127.0.0.1:8536:8536" - - "127.0.0.1:6669:6669" - restart: always - environment: - - RUST_LOG="warn,lemmy_server=info,lemmy_api=info,lemmy_api_common=info,lemmy_api_crud=info,lemmy_apub=info,lemmy_db_schema=info,lemmy_db_views=info,lemmy_db_views_actor=info,lemmy_db_views_moderator=info,lemmy_routes=info,lemmy_utils=info,lemmy_websocket=info" - volumes: - - ./lemmy.hjson:/config/config.hjson - depends_on: - - postgres - - pictrs - - lemmy-ui: - image: dessalines/lemmy-ui:0.16.1 - ports: - - "127.0.0.1:1235:1234" - restart: always - environment: - - LEMMY_INTERNAL_HOST=lemmy:8536 - - LEMMY_EXTERNAL_HOST=localhost:8536 - - LEMMY_HTTPS=true - depends_on: - - lemmy - - pictrs: - image: asonix/pictrs:0.3.0-beta.12-r1 - ports: - - "127.0.0.1:8537:8080" - - "127.0.0.1:6670:6669" - user: 991:991 - volumes: - - ./volumes/pictrs:/mnt - restart: always - diff --git a/docker/prod/migrate-pictshare-to-pictrs.bash b/docker/prod/migrate-pictshare-to-pictrs.bash deleted file mode 100644 index 667183a0..00000000 --- a/docker/prod/migrate-pictshare-to-pictrs.bash +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/bash -set -e - -if [[ $(id -u) != 0 ]]; then - echo "This migration needs to be run as root" - exit -fi - -if [[ ! -f docker-compose.yml ]]; then - echo "No docker-compose.yml found in current directory. Is this the right folder?" - exit -fi - -if ! which jq > /dev/null; then - echo "jq must be installed to run this migration. On ubuntu systems, try 'sudo apt-get install jq'" - exit -fi - -# Fixing pictrs permissions -mkdir -p volumes/pictrs -sudo chown -R 991:991 volumes/pictrs - -echo "Restarting docker-compose, making sure that pictrs is started and pictshare is removed" -docker-compose up -d --remove-orphans - -if [[ -z $(docker-compose ps | grep pictrs) ]]; then - echo "Pict-rs is not running, make sure you update Lemmy first" - exit -fi - -# echo "Stopping Lemmy so that users dont upload new images during the migration" -# docker-compose stop lemmy - -CRASHED_ON=() - -pushd volumes/pictshare/ -echo "Importing pictshare images to pict-rs..." -IMAGE_NAMES=* -for image in $IMAGE_NAMES; do - IMAGE_PATH="$(pwd)/$image/$image" - if [[ ! -f $IMAGE_PATH ]]; then - continue - fi - res=$(curl -s -F "images[]=@$IMAGE_PATH" http://127.0.0.1:8537/import | jq .msg) - if [ "${res}" == "" ]; then - echo -n "C" >&2 - echo "" - CRASHED_ON+=("${IMAGE_PATH}") - echo "Failed to import $IMAGE_PATH with no error message" - echo " assuming crash, sleeping" - sleep 10 - continue - fi - if [ "${res}" != "\"ok\"" ]; then - echo -n "F" >&2 - echo "" - echo "Failed to import $IMAGE_PATH" - echo " Reason: ${res}" - else - echo -n "." >&2 - fi -done - -for image in ${CRASHED_ON[@]}; do - echo "Retrying ${image}" - res=$(curl -s -F "images[]=@$IMAGE_PATH" http://127.0.0.1:8537/import | jq .msg) - if [ "${res}" != "\"ok\"" ]; then - echo -n "F" >&2 - echo "" - echo "Failed to upload ${image} on 2nd attempt" - echo " Reason: ${res}" - else - echo -n "." >&2 - fi -done - -echo "Fixing permissions on pictshare folder" -find . -type d -exec chmod 755 {} \; -find . -type f -exec chmod 644 {} \; - -popd - -echo "Rewrite image links in Lemmy database" -docker-compose exec -u postgres postgres psql -U lemmy -c "UPDATE user_ SET avatar = REPLACE(avatar, 'pictshare', 'pictrs/image') WHERE avatar is not null;" -docker-compose exec -u postgres postgres psql -U lemmy -c "UPDATE post SET url = REPLACE(url, 'pictshare', 'pictrs/image') WHERE url is not null;" - -echo "Moving pictshare data folder to pictshare_backup" -mv volumes/pictshare volumes/pictshare_backup - -echo "Migration done, starting Lemmy again" -echo "If everything went well, you can delete ./volumes/pictshare_backup/" -docker-compose start lemmy diff --git a/docker/prod/deploy.sh b/scripts/release.sh similarity index 100% rename from docker/prod/deploy.sh rename to scripts/release.sh -- 2.44.1