diff --git a/conf/nginx.conf b/conf/nginx.conf index e7aa11b..ec3d9d5 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,4 +1,21 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; + +location __PATH__/api/ { + + # Path to source + proxy_cache pipedapi; + proxy_pass http://127.0.0.1:__PORT__; + proxy_http_version 1.1; + proxy_set_header Connection "keep-alive"; +} + +location __PATH__/proxy/ { + + # Path to source + alias __INSTALL_DIR__/dist/; +} + + location __PATH__/ { # Path to source diff --git a/manifest.toml b/manifest.toml index eebdc45..dd614c2 100644 --- a/manifest.toml +++ b/manifest.toml @@ -31,6 +31,10 @@ ram.runtime = "50M" [install.domain] type = "domain" + [install.path] + type = "path" + default = "piped" + [install.init_main_permission] type = "group" default = "visitors" @@ -43,9 +47,26 @@ ram.runtime = "50M" sha256 = "64f56b0d0f02035ef42b561b617a793da2db96e02cb7a8131e2ac9e0c619101b" autoupdate.strategy = "latest_github_commit" + [resources.sources.api] + url = "https://github.com/TeamPiped/Piped-Backend/archive/c746794d7434d0cda99f8b586a431ef69e1fb7b5.tar.gz" + sha256 = "fdb53fbe599e7e91c0663f1b40f0ba49a967cdcd6048769d8ab840df73a80e0f" + autoupdate.strategy = "latest_github_commit" + + [resources.sources.proxy] + url = "https://github.com/TeamPiped/piped-proxy/archive/0098582abeda2512790ca9d10cf016377cc71855.tar.gz" + sha256 = "436c0189e744bcd2ebe0b926dc58f2d740b4531ca43e620f0e8ff697c5d816c3" + autoupdate.strategy = "latest_github_commit" + + [resources.sources.jdk] + url = "https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2%2B13/OpenJDK21U-jdk_x64_linux_hotspot_21.0.2_13.tar.gz" + sha256 = "454bebb2c9fe48d981341461ffb6bf1017c7b7c6e15c6b0c29b959194ba3aaa5" + [resources.system_user] [resources.install_dir] [resources.permissions] main.url = "/" + + [resources.database] + type = "postgresql" \ No newline at end of file diff --git a/scripts/install b/scripts/install index ffe5e0c..f6409cc 100644 --- a/scripts/install +++ b/scripts/install @@ -11,11 +11,18 @@ source /usr/share/yunohost/helpers #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=1 +ynh_script_progression --message="Installing dependencies..." --weight=3 ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_use_nodejs +ynh_setup_source --dest_dir="$install_dir/jdk" --source_id="jdk" + +export JAVA_HOME="$install_dir/jdk" + +ynh_exec_warn_less ynh_exec_as $app RUSTUP_HOME="$install_dir"/.rustup CARGO_HOME="$install_dir"/.cargo bash -c 'curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -q -y' +export PATH="$install_dir/jdk/bin:$install_dir/.cargo/bin:$PATH" + #================================================= # APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC) #================================================= @@ -25,24 +32,42 @@ ynh_script_progression --message="Setting up source files..." ynh_setup_source --dest_dir="$install_dir/build" +ynh_setup_source --dest_dir="$install_dir/build_api" --source_id="api" + +ynh_setup_source --dest_dir="$install_dir/build_proxy" --source_id="proxy" + chown -R $app:www-data "$install_dir" #================================================= # INSTALL APP #================================================= -ynh_script_progression --message="Building app..." --weight=5 +ynh_script_progression --message="Building UI..." --weight=5 pushd $install_dir/build - ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install pnpm - ynh_exec_as $app $ynh_node_load_PATH $ynh_npm exec -- pnpm install - ynh_exec_as $app $ynh_node_load_PATH $ynh_npm exec -- pnpm build - ./localizefonts.sh + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH corepack enable + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH corepack prepare pnpm@latest --activate + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH pnpm install + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_ENV=production pnpm build + ynh_exec_warn_less ynh_exec_as $app ./localizefonts.sh popd mv $install_dir/build/dist $install_dir chown -R $app:www-data "$install_dir/dist" chmod -R 755 "$install_dir/dist" -#ynh_secure_remove --file="$install_dir/build" + +ynh_script_progression --message="Building API..." --weight=5 + +pushd $install_dir/build_api + ynh_exec_warn_less ynh_exec_as $app ./gradlew shadowJar +popd + +mv $install_dir/build_api/build/libs/piped-1.0-all.jar $install_dir/piped.jar + +pushd $install_dir/build_proxy + ynh_exec_warn_less ynh_exec_as $app cargo build --release +popd + +mv $install_dir/build_proxy/target/release/piped-proxy $install_dir #================================================= # END OF SCRIPT