mirror of
https://github.com/YunoHost-Apps/lemmy_ynh.git
synced 2024-09-03 19:36:09 +02:00
from docker
instead of building
This commit is contained in:
parent
376384c341
commit
c441200623
11 changed files with 97 additions and 112 deletions
7
conf/docker-image-extract.src
Normal file
7
conf/docker-image-extract.src
Normal file
|
@ -0,0 +1,7 @@
|
|||
SOURCE_URL=https://codeload.github.com/jjlin/docker-image-extract/tar.gz/a9e455e44bbbfba897bf3342d9661b182cee67a9
|
||||
SOURCE_SUM=9eb0c734e83a3fd7102fc7209af4977024ec467fbc819782491af47295675f67
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
SOURCE_EXTRACT=true
|
|
@ -1,7 +0,0 @@
|
|||
SOURCE_URL=https://github.com/itteco/iframely/archive/refs/tags/v1.6.0.tar.gz
|
||||
SOURCE_SUM=8130267e17e4484a2cdd028cdffb619f430b9cd19b3614b5d1de2d05304d03f8
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
SOURCE_EXTRACT=true
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/ImageMagick/ImageMagick/archive/refs/tags/7.0.11-14.tar.gz
|
||||
SOURCE_SUM=dfa5aa3f7f289f12c2f9ee6c7c19b02ae857b4eec02f40298f60f5c11048a016
|
||||
SOURCE_URL=https://github.com/ImageMagick/ImageMagick/archive/refs/tags/7.0.10-62.tar.gz
|
||||
SOURCE_SUM=84442158aea070095efa832cfe868fd99d6befdf609444f0c9e9f1b4f25480cd
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
SOURCE_URL=https://github.com/LemmyNet/lemmy-ui/archive/refs/tags/0.11.2.tar.gz
|
||||
SOURCE_SUM=645954b3726803b0ba6b756a2b4f4099e2de29e59cadd828bebd592b29149611
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
SOURCE_EXTRACT=true
|
|
@ -7,8 +7,8 @@ Type=simple
|
|||
User=__APP__
|
||||
Group=__APP__
|
||||
Environment="LEMMY_CONFIG_LOCATION=__FINALPATH__/config/config.hjson"
|
||||
WorkingDirectory=__FINALPATH__/lemmy_server/
|
||||
ExecStart=__FINALPATH__/lemmy_server/lemmy_server
|
||||
WorkingDirectory=__FINALPATH__/lemmy/
|
||||
ExecStart=__FINALPATH__/lemmy/lemmy
|
||||
StandardOutput=append:/var/log/__APP__/__APP__.log
|
||||
StandardError=inherit
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
SOURCE_URL=https://github.com/LemmyNet/lemmy/archive/refs/tags/0.11.0.tar.gz
|
||||
SOURCE_SUM=8c93268d5cb7b30c9c25e2fdeef83153d95b7b79ad0b0a6f354d89e72a0ec641
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
SOURCE_EXTRACT=true
|
|
@ -5,10 +5,23 @@
|
|||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="postgresql postgresql-contrib espeak bash-completion ffmpeg clang pkg-config libgexiv2-dev libgexiv2-2 libssl-dev libc6-dev libpq-dev libavutil-dev libavformat-dev libavfilter-dev libavdevice-dev libavresample-dev libjpeg-turbo-progs libpng-dev"
|
||||
lemmy_dependencies="postgresql postgresql-contrib"
|
||||
lemmyui_dependencies="espeak"
|
||||
iframely_dependencies="musl-dev"
|
||||
pictrs_dependencies="bash-completion ffmpeg clang pkg-config libgexiv2-dev libgexiv2-2"
|
||||
imagemagick_dependencies=""
|
||||
|
||||
pkg_dependencies="$lemmy_dependencies $lemmyui_dependencies $iframely_dependencies $pictrs_dependencies $imagemagick_dependencies"
|
||||
# libssl-dev libc6-dev libpq-dev libavutil-dev libavformat-dev libavfilter-dev libavdevice-dev libavresample-dev libjpeg-turbo-progs libpng-dev
|
||||
|
||||
NODEJS_VERSION=12
|
||||
|
||||
LEMMY_VERSION=0.11.0
|
||||
|
||||
LEMMYUI_VERSION=0.11.0
|
||||
|
||||
PICTRS_VERSION=v0.2.6-r1
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -81,7 +81,7 @@ ynh_script_progression --message="Installing dependencies..."
|
|||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||
ynh_use_nodejs
|
||||
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
ln -s /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
|
@ -111,11 +111,11 @@ ynh_script_progression --message="Setting up source files..."
|
|||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path/build-lemmy/" --source_id="lemmy"
|
||||
ynh_setup_source --dest_dir="$final_path/lemmy-ui/" --source_id="lemmy-ui"
|
||||
ynh_setup_source --dest_dir="$final_path/lemmy-ui/lemmy-translations/" --source_id="lemmy-translations"
|
||||
ynh_setup_source --dest_dir="$final_path/iframely/" --source_id="iframely"
|
||||
ynh_setup_source --dest_dir="$final_path/build-lemmy/" --source_id="docker-image-extract"
|
||||
ynh_setup_source --dest_dir="$final_path/build-pict-rs/" --source_id="pict-rs"
|
||||
ynh_setup_source --dest_dir="$final_path/build-lemmy-ui/" --source_id="docker-image-extract"
|
||||
ynh_setup_source --dest_dir="$final_path/lemmy-ui/lemmy-translations/" --source_id="lemmy-translations"
|
||||
ynh_setup_source --dest_dir="$final_path/build-iframely/" --source_id="docker-image-extract"
|
||||
ynh_setup_source --dest_dir="$final_path/build-imagemagick/" --source_id="imagemagick"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
|
@ -151,56 +151,55 @@ chown -R $app:$app "$datadir"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Making install..."
|
||||
|
||||
# Install ImageMagick
|
||||
pushd "$final_path/build-imagemagick/"
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
ldconfig /usr/local/lib
|
||||
# Install lemmy
|
||||
pushd $final_path/build-lemmy
|
||||
./docker-image-extract dessalines/lemmy:$LEMMY_VERSION
|
||||
popd
|
||||
mkdir -p "$final_path/lemmy/"
|
||||
mv -f "$final_path/build-lemmy/output/app/lemmy" "$final_path/lemmy/lemmy"
|
||||
ynh_secure_remove --file="$final_path/build-lemmy"
|
||||
|
||||
# Install rustup with the toolchain needed by lemmy
|
||||
# Install rustup with the toolchain needed by pict-rs
|
||||
pushd "$final_path"
|
||||
sudo -u "$app" RUSTUP_HOME="$final_path"/.rustup CARGO_HOME="$final_path"/.cargo bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain nightly'
|
||||
popd
|
||||
|
||||
export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin"
|
||||
|
||||
# Compile lemmy
|
||||
pushd $final_path/build-lemmy
|
||||
ynh_exec_warn_less sudo -u "$app" env PATH="$PATH" cargo build --release
|
||||
popd
|
||||
|
||||
# Compile pict-rs
|
||||
# Install pict-rs
|
||||
pushd $final_path/build-pict-rs
|
||||
ynh_exec_warn_less sudo -u "$app" env PATH="$PATH" cargo build --release
|
||||
popd
|
||||
|
||||
# Install lemmy
|
||||
mkdir -p "$final_path/lemmy_server/"
|
||||
cp -af "$final_path/build-lemmy/target/release/lemmy_server" "$final_path/lemmy_server/lemmy_server"
|
||||
|
||||
# Install pict-rs
|
||||
mkdir -p "$final_path/pict-rs/"
|
||||
cp -af "$final_path/build-pict-rs/target/release/pict-rs" "$final_path/pict-rs/pict-rs"
|
||||
|
||||
# Remove build files and rustup
|
||||
ynh_secure_remove --file="$final_path/build-lemmy"
|
||||
mv -f "$final_path/build-pict-rs/target/release/pict-rs" "$final_path/pict-rs/pict-rs"
|
||||
ynh_secure_remove --file="$final_path/build-pict-rs"
|
||||
ynh_secure_remove --file="$final_path/build-imagemagick"
|
||||
ynh_secure_remove --file="$final_path/.cargo"
|
||||
ynh_secure_remove --file="$final_path/.rustup"
|
||||
|
||||
# Compile lemmy-ui
|
||||
pushd $final_path/lemmy-ui
|
||||
ynh_exec_warn_less sudo -u "$app" env PATH="$PATH" yarn install --pure-lockfile
|
||||
ynh_exec_warn_less sudo -u "$app" env PATH="$PATH" yarn build:prod
|
||||
# Install lemmy-ui
|
||||
pushd $final_path/build-lemmy-ui
|
||||
./docker-image-extract dessalines/lemmy-ui:$LEMMYUI_VERSION
|
||||
popd
|
||||
mkdir -p "$final_path/lemmy-ui/"
|
||||
rsync -a "$final_path/build-lemmy-ui/output/app/" "$final_path/lemmy-ui/"
|
||||
ynh_secure_remove --file="$final_path/build-lemmy-ui"
|
||||
|
||||
# Compile iframely
|
||||
pushd $final_path/iframely
|
||||
ynh_exec_warn_less sudo -u "$app" env PATH="$PATH" $ynh_npm install
|
||||
# Install iframely
|
||||
pushd $final_path/build-iframely
|
||||
./docker-image-extract dogbin/iframely:latest
|
||||
popd
|
||||
mkdir -p "$final_path/iframely/"
|
||||
rsync -a "$final_path/build-iframely/output/iframely/" "$final_path/iframely/"
|
||||
ynh_secure_remove --file="$final_path/build-iframely"
|
||||
|
||||
# Install ImageMagick
|
||||
pushd "$final_path/build-imagemagick/"
|
||||
./configure --with-modules
|
||||
make
|
||||
make install
|
||||
ldconfig /usr/local/lib
|
||||
popd
|
||||
ynh_secure_remove --file="$final_path/build-imagemagick"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
|
|
|
@ -92,6 +92,7 @@ ynh_script_progression --message="Removing dependencies..."
|
|||
# Remove metapackage and its dependencies
|
||||
ynh_remove_nodejs
|
||||
ynh_remove_app_dependencies
|
||||
rm /lib/libc.musl-x86_64.so.1
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
|
|
|
@ -97,7 +97,6 @@ ynh_script_progression --message="Reinstalling dependencies..."
|
|||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||
ynh_use_nodejs
|
||||
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
|
||||
#=================================================
|
||||
# BUILDING IMAGEMAGICK
|
||||
|
@ -108,12 +107,11 @@ ynh_setup_source --dest_dir="$final_path/build-imagemagick/" --source_id="imagem
|
|||
|
||||
# Install ImageMagick
|
||||
pushd "$final_path/build-imagemagick/"
|
||||
./configure
|
||||
./configure --with-modules
|
||||
make
|
||||
make install
|
||||
ldconfig /usr/local/lib
|
||||
popd
|
||||
|
||||
ynh_secure_remove --file="$final_path/build-imagemagick"
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -106,12 +106,11 @@ then
|
|||
ynh_script_progression --message="Upgrading source files..."
|
||||
|
||||
# Download, check integrity, uncompress the source of lemmy from app.src to his build directory
|
||||
ynh_setup_source --dest_dir="$final_path/build-lemmy/" --source_id="lemmy"
|
||||
ynh_setup_source --dest_dir="$final_path/lemmy-ui/" --source_id="lemmy-ui"
|
||||
ynh_setup_source --dest_dir="$final_path/lemmy-ui/lemmy-translations/" --source_id="lemmy-translations"
|
||||
|
||||
ynh_setup_source --dest_dir="$final_path/iframely/" --source_id="iframely"
|
||||
ynh_setup_source --dest_dir="$final_path/build-lemmy/" --source_id="docker-image-extract"
|
||||
ynh_setup_source --dest_dir="$final_path/build-pict-rs/" --source_id="pict-rs"
|
||||
ynh_setup_source --dest_dir="$final_path/build-lemmy-ui/" --source_id="docker-image-extract"
|
||||
ynh_setup_source --dest_dir="$final_path/lemmy-ui/lemmy-translations/" --source_id="lemmy-translations"
|
||||
ynh_setup_source --dest_dir="$final_path/build-iframely/" --source_id="docker-image-extract"
|
||||
ynh_setup_source --dest_dir="$final_path/build-imagemagick/" --source_id="imagemagick"
|
||||
fi
|
||||
|
||||
|
@ -135,7 +134,6 @@ ynh_script_progression --message="Upgrading dependencies..."
|
|||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||
ynh_use_nodejs
|
||||
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
|
@ -146,65 +144,55 @@ ynh_script_progression --message="Making upgrade..."
|
|||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
# Install ImageMagick
|
||||
pushd "$final_path/build-imagemagick/"
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
ldconfig /usr/local/lib
|
||||
# Install lemmy
|
||||
pushd $final_path/build-lemmy
|
||||
./docker-image-extract dessalines/lemmy:$LEMMY_VERSION
|
||||
popd
|
||||
mkdir -p "$final_path/lemmy/"
|
||||
mv -f "$final_path/build-lemmy/output/app/lemmy" "$final_path/lemmy/lemmy"
|
||||
ynh_secure_remove --file="$final_path/build-lemmy"
|
||||
|
||||
# Install rustup with the toolchain needed by lemmy
|
||||
# Install rustup with the toolchain needed by pict-rs
|
||||
pushd "$final_path"
|
||||
sudo -u "$app" RUSTUP_HOME="$final_path"/.rustup CARGO_HOME="$final_path"/.cargo bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain nightly'
|
||||
popd
|
||||
|
||||
export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin"
|
||||
|
||||
# Compile lemmy
|
||||
pushd $final_path/build-lemmy
|
||||
ynh_exec_warn_less sudo -u "$app" env PATH="$PATH" cargo build --release
|
||||
popd
|
||||
|
||||
# Compile pict-rs
|
||||
# Install pict-rs
|
||||
pushd $final_path/build-pict-rs
|
||||
ynh_exec_warn_less sudo -u "$app" env PATH="$PATH" cargo build --release
|
||||
popd
|
||||
|
||||
# Remove old generated files before copying the new ones
|
||||
ynh_secure_remove --file="$final_path/lemmy/.fingerprint"
|
||||
ynh_secure_remove --file="$final_path/lemmy/build"
|
||||
ynh_secure_remove --file="$final_path/lemmy/deps"
|
||||
ynh_secure_remove --file="$final_path/lemmy/examples"
|
||||
ynh_secure_remove --file="$final_path/lemmy/incremental"
|
||||
ynh_secure_remove --file="$final_path/lemmy/.cargo-lock"
|
||||
ynh_secure_remove --file="$final_path/lemmy/lemmy.d"
|
||||
|
||||
# Install lemmy
|
||||
mkdir -p "$final_path/lemmy_server/"
|
||||
cp -af "$final_path/build-lemmy/target/release/lemmy_server" "$final_path/lemmy_server/lemmy_server"
|
||||
|
||||
# Install pict-rs
|
||||
mkdir -p "$final_path/pict-rs/"
|
||||
cp -af "$final_path/build-pict-rs/target/release/pict-rs" "$final_path/pict-rs/pict-rs"
|
||||
|
||||
# Remove build files and rustup
|
||||
ynh_secure_remove --file="$final_path/build-lemmy"
|
||||
mv -f "$final_path/build-pict-rs/target/release/pict-rs" "$final_path/pict-rs/pict-rs"
|
||||
ynh_secure_remove --file="$final_path/build-pict-rs"
|
||||
ynh_secure_remove --file="$final_path/build-imagemagick"
|
||||
ynh_secure_remove --file="$final_path/.cargo"
|
||||
ynh_secure_remove --file="$final_path/.rustup"
|
||||
|
||||
# Compile lemmy-ui
|
||||
pushd $final_path/lemmy-ui
|
||||
ynh_exec_warn_less sudo -u "$app" env PATH="$PATH" yarn install --pure-lockfile
|
||||
ynh_exec_warn_less sudo -u "$app" env PATH="$PATH" yarn build:prod
|
||||
# Install lemmy-ui
|
||||
pushd $final_path/build-lemmy-ui
|
||||
./docker-image-extract dessalines/lemmy-ui:$LEMMYUI_VERSION
|
||||
popd
|
||||
mkdir -p "$final_path/lemmy-ui/"
|
||||
rsync -a "$final_path/build-lemmy-ui/output/app/" "$final_path/lemmy-ui/"
|
||||
ynh_secure_remove --file="$final_path/build-lemmy-ui"
|
||||
|
||||
# Compile iframely
|
||||
pushd $final_path/iframely
|
||||
ynh_exec_warn_less sudo -u "$app" env PATH="$PATH" $ynh_npm install
|
||||
# Install iframely
|
||||
pushd $final_path/build-iframely
|
||||
./docker-image-extract dogbin/iframely:latest
|
||||
popd
|
||||
mkdir -p "$final_path/iframely/"
|
||||
rsync -a "$final_path/build-iframely/output/iframely/" "$final_path/iframely/"
|
||||
ynh_secure_remove --file="$final_path/build-iframely"
|
||||
|
||||
# Install ImageMagick
|
||||
pushd "$final_path/build-imagemagick/"
|
||||
./configure --with-modules
|
||||
make
|
||||
make install
|
||||
ldconfig /usr/local/lib
|
||||
popd
|
||||
ynh_secure_remove --file="$final_path/build-imagemagick"
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
|
@ -221,7 +209,7 @@ chown -R $app:$app "/var/log/$app"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..."
|
||||
|
||||
mkdir -p "$final_path/lemmy_server/"
|
||||
mkdir -p "$final_path/lemmy/"
|
||||
ynh_add_config --template="../conf/lemmy.hjson" --destination="$final_path/config/config.hjson"
|
||||
|
||||
chmod 400 "$final_path/config/config.hjson"
|
||||
|
|
Loading…
Reference in a new issue