From de61bb6a3522287040108b6f64668ac9ab8478b6 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Thu, 24 Oct 2019 02:01:43 -0700 Subject: packager.io: update scripts (#5837) * Test new buildpack and distro * Try another buildpack version * Give another try * Try another one * Best effort --- .packager/.godir | 1 + .packager/Procfile | 1 + .packager/hooks/postinst | 24 ++++++++++++++++++++++++ .pkgr.yml | 14 +++++--------- go.mod | 2 ++ packager/.godir | 1 - packager/Procfile | 1 - packager/hooks/postinst | 24 ------------------------ 8 files changed, 33 insertions(+), 35 deletions(-) create mode 100644 .packager/.godir create mode 100644 .packager/Procfile create mode 100755 .packager/hooks/postinst delete mode 100644 packager/.godir delete mode 100644 packager/Procfile delete mode 100755 packager/hooks/postinst diff --git a/.packager/.godir b/.packager/.godir new file mode 100644 index 00000000..ba2906d0 --- /dev/null +++ b/.packager/.godir @@ -0,0 +1 @@ +main diff --git a/.packager/Procfile b/.packager/Procfile new file mode 100644 index 00000000..ee1a0f55 --- /dev/null +++ b/.packager/Procfile @@ -0,0 +1 @@ +web: ./gogs web -p ${PORT:=3000} diff --git a/.packager/hooks/postinst b/.packager/hooks/postinst new file mode 100755 index 00000000..efae87ad --- /dev/null +++ b/.packager/hooks/postinst @@ -0,0 +1,24 @@ +#!/bin/sh + +set -e + +APP_NAME="gogs" +CLI="${APP_NAME}" +APP_USER=$(${CLI} config:get APP_USER) +APP_GROUP=$(${CLI} config:get APP_GROUP) +APP_CONFIG="/etc/${APP_NAME}/conf/app.ini" + +mkdir -p $(dirname ${APP_CONFIG}) +chown "${APP_USER}"."${APP_GROUP}" $(dirname ${APP_CONFIG}) +[ -f ${APP_CONFIG} ] || ${CLI} run cp conf/app.ini ${APP_CONFIG} +${CLI} config:set USER="${APP_USER}" +sed -i "s|RUN_USER = git|RUN_USER = ${APP_USER}|" ${APP_CONFIG} +sed -i "s|RUN_MODE = dev|RUN_MODE = prod|" ${APP_CONFIG} + +${CLI} config:set GOGS_CUSTOM=/etc/${APP_NAME} + +# scale +${CLI} scale web=1 || true + +# restart the service +service gogs restart || true diff --git a/.pkgr.yml b/.pkgr.yml index 0e9fd93f..9a69a572 100644 --- a/.pkgr.yml +++ b/.pkgr.yml @@ -9,6 +9,8 @@ targets: <<: *debian debian-10: <<: *debian + debian-11: + <<: *debian ubuntu-14.04: <<: *debian ubuntu-16.04: @@ -18,7 +20,7 @@ targets: - mercurial ubuntu-18.04: <<: *debian - centos-6: &el + centos-7: build_dependencies: - pam-devel # required for go buildpack @@ -26,14 +28,8 @@ targets: dependencies: - pam - git - centos-7: - <<: *el before: - - mv packager/Procfile . + - mv .packager/Procfile . after: - mv bin/gogs gogs -after_install: ./packager/hooks/postinst -# Can be updated after CentOS 6 support is dropped, otherwise fails with -# `fatal: bad config file line 2 in /home/pkgr/.gitconfig` because of -# https://github.com/heroku/heroku-buildpack-go/blob/f96ebebfa7605fd3916521e42ab050c81c9b947a/lib/common.sh#L238 -buildpack: https://github.com/heroku/heroku-buildpack-go.git#v76 +after_install: ./.packager/hooks/postinst diff --git a/go.mod b/go.mod index 499de0b6..928da6cb 100644 --- a/go.mod +++ b/go.mod @@ -67,3 +67,5 @@ require ( xorm.io/core v0.7.2 xorm.io/xorm v0.8.0 ) + +// +heroku goVersion go1.13.3 diff --git a/packager/.godir b/packager/.godir deleted file mode 100644 index ba2906d0..00000000 --- a/packager/.godir +++ /dev/null @@ -1 +0,0 @@ -main diff --git a/packager/Procfile b/packager/Procfile deleted file mode 100644 index ee1a0f55..00000000 --- a/packager/Procfile +++ /dev/null @@ -1 +0,0 @@ -web: ./gogs web -p ${PORT:=3000} diff --git a/packager/hooks/postinst b/packager/hooks/postinst deleted file mode 100755 index 561080ef..00000000 --- a/packager/hooks/postinst +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -set -e - -APP_NAME="gogs" -CLI="${APP_NAME}" -APP_USER=$(${CLI} config:get APP_USER) -APP_GROUP=$(${CLI} config:get APP_GROUP) -APP_CONFIG="/etc/${APP_NAME}/conf/app.ini" - -mkdir -p $(dirname ${APP_CONFIG}) -chown ${APP_USER}.${APP_GROUP} $(dirname ${APP_CONFIG}) -[ -f ${APP_CONFIG} ] || ${CLI} run cp conf/app.ini ${APP_CONFIG} -${CLI} config:set USER=${APP_USER} -sed -i "s|RUN_USER = git|RUN_USER = ${APP_USER}|" ${APP_CONFIG} -sed -i "s|RUN_MODE = dev|RUN_MODE = prod|" ${APP_CONFIG} - -${CLI} config:set GOGS_CUSTOM=/etc/${APP_NAME} - -# scale -${CLI} scale web=1 || true - -# restart the service -service gogs restart || true -- cgit v1.2.3