1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ifconfig-io_ynh.git synced 2024-09-03 20:36:27 +02:00

Update: Integrate ynh_install_go

This commit is contained in:
Fabian Wilkens 2022-05-27 23:24:23 +02:00
parent 456a9f2c7e
commit cdd94a8b0a
No known key found for this signature in database
GPG key ID: 23DFA025BB4E9FAB
6 changed files with 24 additions and 5 deletions

View file

@ -10,6 +10,7 @@ Environment=PORT=__PORT__
Environment=HOSTNAME=__DOMAIN__ Environment=HOSTNAME=__DOMAIN__
Environment=GIN_MODE=release Environment=GIN_MODE=release
Environment=FORWARD_IP_HEADER=X-Forwarded-For Environment=FORWARD_IP_HEADER=X-Forwarded-For
Environment="__YNH_GO_LOAD_PATH__"
WorkingDirectory=__APP_PATH__/ WorkingDirectory=__APP_PATH__/
ExecStart=__APP_PATH__/ifconfig.io ExecStart=__APP_PATH__/ifconfig.io
StandardOutput=append:/var/log/__APP__/__APP__.log StandardOutput=append:/var/log/__APP__/__APP__.log

View file

@ -5,7 +5,9 @@
#================================================= #=================================================
# dependencies used by the app # dependencies used by the app
pkg_dependencies="golang" pkg_dependencies=""
GO_VERSION="1.18"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -7,6 +7,7 @@
#================================================= #=================================================
source _common.sh source _common.sh
source ynh_install_go
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -66,6 +67,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port
ynh_script_progression --message="Installing dependencies..." --weight=5 ynh_script_progression --message="Installing dependencies..." --weight=5
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_go --go_version=$GO_VERSION
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
@ -100,11 +102,15 @@ ynh_add_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Installing..." --weight=5 ynh_script_progression --message="Installing..." --weight=5
# Setup go environnement
ynh_use_go
export GOPATH="$final_path/go"
export GOCACHE="$final_path/go/.cache"
export GO111MODULE=on export GO111MODULE=on
pushd "$app_path" pushd "$app_path"
ynh_exec_warn_less go mod download ynh_exec_warn_less $ynh_go mod download
ynh_exec_warn_less go build ynh_exec_warn_less $ynh_go build -tags=jsoniter
popd popd
#================================================= #=================================================

View file

@ -7,6 +7,7 @@
#================================================= #=================================================
source _common.sh source _common.sh
source ynh_install_go
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -72,6 +73,7 @@ ynh_script_progression --message="Removing dependencies..." --weight=5
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_app_dependencies ynh_remove_app_dependencies
ynh_remove_go
#================================================= #=================================================
# CLOSE A PORT # CLOSE A PORT

View file

@ -8,6 +8,7 @@
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source ../settings/scripts/ynh_install_go
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -79,6 +80,7 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=5
# Define and install dependencies # Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_go --go_version=$GO_VERSION
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD

View file

@ -7,6 +7,7 @@
#================================================= #=================================================
source _common.sh source _common.sh
source ynh_install_go
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -100,17 +101,22 @@ ynh_add_nginx_config
ynh_script_progression --message="Upgrading dependencies..." --weight=5 ynh_script_progression --message="Upgrading dependencies..." --weight=5
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_go --go_version=$GO_VERSION
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#================================================= #=================================================
ynh_script_progression --message="Upgrading..." --weight=5 ynh_script_progression --message="Upgrading..." --weight=5
# Setup go environnement
ynh_use_go
export GOPATH="$final_path/go"
export GOCACHE="$final_path/go/.cache"
export GO111MODULE=on export GO111MODULE=on
pushd "$app_path" pushd "$app_path"
ynh_exec_warn_less go mod download ynh_exec_warn_less $ynh_go mod download
ynh_exec_warn_less go build ynh_exec_warn_less $ynh_go build -tags=jsoniter
popd popd
#================================================= #=================================================