mirror of
https://github.com/YunoHost-Apps/archivebox_ynh.git
synced 2024-09-03 18:15:54 +02:00
parent
17702d5c0f
commit
98c5acab1c
9 changed files with 66 additions and 2283 deletions
42
.github/workflows/updater.sh
vendored
42
.github/workflows/updater.sh
vendored
|
@ -18,6 +18,7 @@ current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
|
||||||
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
|
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
|
||||||
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
|
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
|
||||||
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
|
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
|
||||||
|
assets="https://github.com/ArchiveBox/ArchiveBox/archive/refs/tags/$version.tar.gz"
|
||||||
|
|
||||||
# Later down the script, we assume the version has only digits and dots
|
# Later down the script, we assume the version has only digits and dots
|
||||||
# Sometimes the release name starts with a "v", so let's filter it out.
|
# Sometimes the release name starts with a "v", so let's filter it out.
|
||||||
|
@ -44,6 +45,47 @@ elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPDATE SOURCE FILES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Let's download source tarball
|
||||||
|
asset_url=$assets
|
||||||
|
|
||||||
|
echo "Handling asset at $asset_url"
|
||||||
|
|
||||||
|
src="app"
|
||||||
|
|
||||||
|
# Create the temporary directory
|
||||||
|
tempdir="$(mktemp -d)"
|
||||||
|
|
||||||
|
# Download sources and calculate checksum
|
||||||
|
filename=${asset_url##*/}
|
||||||
|
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
|
||||||
|
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
|
||||||
|
|
||||||
|
# Delete temporary directory
|
||||||
|
rm -rf $tempdir
|
||||||
|
|
||||||
|
# Get extension
|
||||||
|
if [[ $filename == *.tar.gz ]]; then
|
||||||
|
extension=tar.gz
|
||||||
|
else
|
||||||
|
extension=${filename##*.}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Rewrite source file
|
||||||
|
cat <<EOT > conf/$src.src
|
||||||
|
SOURCE_URL=$asset_url
|
||||||
|
SOURCE_SUM=$checksum
|
||||||
|
SOURCE_SUM_PRG=sha256sum
|
||||||
|
SOURCE_FORMAT=$extension
|
||||||
|
SOURCE_IN_SUBDIR=true
|
||||||
|
SOURCE_FILENAME=
|
||||||
|
SOURCE_EXTRACT=true
|
||||||
|
EOT
|
||||||
|
echo "... conf/$src.src updated"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPDATE STEPS
|
# SPECIFIC UPDATE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
7
conf/app.src
Normal file
7
conf/app.src
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
SOURCE_URL=https://github.com/ArchiveBox/ArchiveBox/archive/refs/tags/v0.6.2.tar.gz
|
||||||
|
SOURCE_SUM=53a6dd88d2a7c1510bccd172e7b89689a722acbdcc843d46d7f37efba8c7369d
|
||||||
|
SOURCE_SUM_PRG=sha256sum
|
||||||
|
SOURCE_FORMAT=tar.gz
|
||||||
|
SOURCE_IN_SUBDIR=true
|
||||||
|
SOURCE_FILENAME=
|
||||||
|
SOURCE_EXTRACT=true
|
|
@ -1,13 +1,7 @@
|
||||||
|
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||||
location __PATH__/ {
|
location __PATH__/ {
|
||||||
|
|
||||||
proxy_set_header Accept-Encoding "";
|
proxy_set_header Accept-Encoding "";
|
||||||
try_files $uri @proxy;
|
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
|
||||||
}
|
|
||||||
|
|
||||||
location @proxy {
|
|
||||||
proxy_pass http://127.0.0.1:__PORT__;
|
proxy_pass http://127.0.0.1:__PORT__;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
@ -16,4 +10,7 @@ location @proxy {
|
||||||
proxy_set_header X-Forwarded-Proto https;
|
proxy_set_header X-Forwarded-Proto https;
|
||||||
proxy_set_header Proxy "";
|
proxy_set_header Proxy "";
|
||||||
proxy_pass_header Server;
|
proxy_pass_header Server;
|
||||||
|
|
||||||
|
# Include SSOWAT user panel.
|
||||||
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
}
|
}
|
2252
conf/package-lock.json
generated
2252
conf/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
"name": "archivebox",
|
|
||||||
"version": "0.6.3",
|
|
||||||
"description": "ArchiveBox: The self-hosted internet archive",
|
|
||||||
"author": "Nick Sweeting <archivebox-npm@sweeting.me>",
|
|
||||||
"repository": "github:ArchiveBox/ArchiveBox",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@postlight/mercury-parser": "^2.2.0",
|
|
||||||
"readability-extractor": "git+https://github.com/ArchiveBox/readability-extractor.git",
|
|
||||||
"single-file": "git+https://github.com/gildas-lormeau/SingleFile.git"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
source __FINALPATH__/venv/bin/activate
|
|
||||||
__FINALPATH__/venv/bin/archivebox server __PORT__
|
|
|
@ -7,7 +7,8 @@ Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=__DATADIR__/
|
WorkingDirectory=__DATADIR__/
|
||||||
ExecStart=__FINALPATH__/start.sh
|
Environment="__YNH_NODE_LOAD_PATH__"
|
||||||
|
ExecStart=__FINALPATH__/venv/bin/archivebox server 127.0.0.1:__PORT__
|
||||||
StandardOutput=append:/var/log/__APP__/__APP__.log
|
StandardOutput=append:/var/log/__APP__/__APP__.log
|
||||||
StandardError=inherit
|
StandardError=inherit
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,8 @@ ynh_script_progression --message="Setting up source files..." --weight=1
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
|
tempdir="$(mktemp -d)"
|
||||||
|
ynh_setup_source --dest_dir="$tempdir"
|
||||||
mkdir -p $final_path
|
mkdir -p $final_path
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
|
@ -115,8 +117,6 @@ ynh_script_progression --message="Installing project via pip..." --weight=80
|
||||||
|
|
||||||
python3 -m venv "${final_path}/venv"
|
python3 -m venv "${final_path}/venv"
|
||||||
cp ../conf/requirements.txt "$final_path/requirements.txt"
|
cp ../conf/requirements.txt "$final_path/requirements.txt"
|
||||||
ynh_add_config --template="../conf/start.sh" --destination="$final_path/start.sh"
|
|
||||||
chmod 760 "$final_path/start.sh"
|
|
||||||
chown -R "$app" "$final_path"
|
chown -R "$app" "$final_path"
|
||||||
|
|
||||||
#run source in a 'sub shell'
|
#run source in a 'sub shell'
|
||||||
|
@ -136,8 +136,9 @@ archivebox_cmd="$final_path/venv/bin/archivebox"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing node dependencies..."
|
ynh_script_progression --message="Installing node dependencies..."
|
||||||
|
|
||||||
cp ../conf/package.json "$final_path/package.json"
|
cp -f $tempdir/package.json "$final_path/package.json"
|
||||||
cp ../conf/package-lock.json "$final_path/package-lock.json"
|
cp -f $tempdir/package-lock.json "$final_path/package-lock.json"
|
||||||
|
ynh_secure_remove --file="$tempdir"
|
||||||
pushd $final_path
|
pushd $final_path
|
||||||
ynh_use_nodejs
|
ynh_use_nodejs
|
||||||
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm ci
|
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm ci
|
||||||
|
|
|
@ -86,6 +86,8 @@ then
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
|
tempdir="$(mktemp -d)"
|
||||||
|
ynh_setup_source --dest_dir="$tempdir"
|
||||||
mkdir -p $final_path
|
mkdir -p $final_path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -144,8 +146,9 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading node dependencies..."
|
ynh_script_progression --message="Upgrading node dependencies..."
|
||||||
|
|
||||||
cp -f ../conf/package.json "$final_path/package.json"
|
cp -f $tempdir/package.json "$final_path/package.json"
|
||||||
cp -f ../conf/package-lock.json "$final_path/package-lock.json"
|
cp -f $tempdir/package-lock.json "$final_path/package-lock.json"
|
||||||
|
ynh_secure_remove --file="$tempdir"
|
||||||
pushd $final_path
|
pushd $final_path
|
||||||
ynh_use_nodejs
|
ynh_use_nodejs
|
||||||
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm ci
|
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm ci
|
||||||
|
|
Loading…
Add table
Reference in a new issue