mirror of
https://github.com/YunoHost-Apps/crabfit_ynh.git
synced 2024-09-03 18:16:21 +02:00
Fix front-back interaction by giving up on path prefixes
This commit is contained in:
parent
d63e20d294
commit
fe98e625ef
4 changed files with 14 additions and 11 deletions
|
@ -1,2 +1,2 @@
|
||||||
FRONTEND_URL=https://__DOMAIN__/__PATH__
|
FRONTEND_URL=https://__DOMAIN__/
|
||||||
DATABASE_URL=postgres://__DB_USER__:__DB_PWD__@localhost:5432/__DB_NAME__
|
DATABASE_URL=postgres://__DB_USER__:__DB_PWD__@localhost:5432/__DB_NAME__
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
NEXT_PUBLIC_API_URL=https://__DOMAIN__/__PATH__/api
|
NEXT_PUBLIC_API_URL=https://__DOMAIN__/api/
|
||||||
NEXT_TELEMETRY_DISABLED=1
|
NEXT_TELEMETRY_DISABLED=1
|
||||||
NODE_ENV=production
|
NODE_ENV=production
|
||||||
NODE_TLS_REJECT_UNAUTHORIZED='0'
|
NODE_TLS_REJECT_UNAUTHORIZED='0'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||||
location __PATH__/ {
|
location / {
|
||||||
|
|
||||||
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-Forwarded-Ssl on;
|
proxy_set_header X-Forwarded-Ssl on;
|
||||||
|
@ -14,9 +14,9 @@ location __PATH__/ {
|
||||||
# include conf.d/yunohost_panel.conf.inc;
|
# include conf.d/yunohost_panel.conf.inc;
|
||||||
}
|
}
|
||||||
|
|
||||||
location __PATH__/api {
|
location /api/ {
|
||||||
|
|
||||||
proxy_pass http://127.0.0.1:__PORT_API__;
|
proxy_pass http://127.0.0.1:__PORT_API__/;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
|
|
||||||
proxy_set_header X-Forwarded-Ssl on;
|
proxy_set_header X-Forwarded-Ssl on;
|
||||||
|
|
|
@ -67,7 +67,7 @@ pushd $install_dir/api
|
||||||
# The API port is currently hard-coded instead of being in a .env
|
# The API port is currently hard-coded instead of being in a .env
|
||||||
# TODO: MR to the upstream
|
# TODO: MR to the upstream
|
||||||
# In the meantime, lets do some sed!
|
# In the meantime, lets do some sed!
|
||||||
sed "s/3000/$port_api/g" src/main.rs
|
sed -i "s/3000/$port_api/g" src/main.rs
|
||||||
|
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh
|
||||||
ynh_exec_warn_less ynh_exec_as "$app" \
|
ynh_exec_warn_less ynh_exec_as "$app" \
|
||||||
|
@ -81,8 +81,6 @@ pushd $install_dir/api
|
||||||
$install_dir/api/.cargo/bin/cargo build --release --features sql-adaptor
|
$install_dir/api/.cargo/bin/cargo build --release --features sql-adaptor
|
||||||
|
|
||||||
# Remove build files and rustup
|
# Remove build files and rustup
|
||||||
# cp -af "$install_dir/api/target/release/crabfit-api" "$install_dir/api/api"
|
|
||||||
# ynh_secure_remove --file="$final_path/build"
|
|
||||||
ynh_secure_remove --file="$install_dir/api/.cargo"
|
ynh_secure_remove --file="$install_dir/api/.cargo"
|
||||||
ynh_secure_remove --file="$install_dir/api/.rustup"
|
ynh_secure_remove --file="$install_dir/api/.rustup"
|
||||||
popd
|
popd
|
||||||
|
@ -92,7 +90,12 @@ popd
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Building crabfit frontend..." --weight=1
|
ynh_script_progression --message="Building crabfit frontend..." --weight=1
|
||||||
pushd $install_dir/frontend
|
pushd $install_dir/frontend
|
||||||
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" $nodejs_path/corepack enable
|
# Paths are currently absolute, which breaks having a /api/ path prefix
|
||||||
|
# TODO: MR to the upstream
|
||||||
|
sed -i "s/\/event/event/g" $install_dir/frontend/src/config/api.ts
|
||||||
|
sed -i "s/\/stats/stats/g" $install_dir/frontend/src/config/api.ts
|
||||||
|
|
||||||
|
ynh_exec_warn_less env "$ynh_node_load_PATH" $nodejs_path/corepack enable
|
||||||
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" $nodejs_path/yarn install --production --frozen-lockfile
|
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" $nodejs_path/yarn install --production --frozen-lockfile
|
||||||
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" $ynh_npm run build
|
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" $ynh_npm run build
|
||||||
popd
|
popd
|
||||||
|
|
Loading…
Reference in a new issue