Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Jun 2023 21:21:36 GMT
From:      Ashish SHUKLA <ashish@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 25000d47a3a8 - main - devel/soft-serve: Update to 0.5.4
Message-ID:  <202306182121.35ILLas4085366@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by ashish:

URL: https://cgit.FreeBSD.org/ports/commit/?id=25000d47a3a80095f1b559447e8ff480653602cd

commit 25000d47a3a80095f1b559447e8ff480653602cd
Author:     Ashish SHUKLA <ashish@FreeBSD.org>
AuthorDate: 2023-06-18 16:37:48 +0000
Commit:     Ashish SHUKLA <ashish@FreeBSD.org>
CommitDate: 2023-06-18 21:21:19 +0000

    devel/soft-serve: Update to 0.5.4
    
    - Update rc.d script to include migrate target
    - Add an UPDATING note for upgrade
    - Add a pkg-message for upgrade
---
 UPDATING                              | 37 ++++++++++++++++++++++++++++
 devel/soft-serve/Makefile             |  6 +++--
 devel/soft-serve/distinfo             | 14 +++++------
 devel/soft-serve/files/pkg-message.in | 39 +++++++++++++++++++++++++++++
 devel/soft-serve/files/soft-serve.in  | 46 ++++++++++++++++++++++++++---------
 5 files changed, 121 insertions(+), 21 deletions(-)

diff --git a/UPDATING b/UPDATING
index dda87fb5202f..b8b56619cfd3 100644
--- a/UPDATING
+++ b/UPDATING
@@ -5,6 +5,43 @@ they are unavoidable.
 You should get into the habit of checking this file for changes each time
 you update your ports collection, before attempting any port upgrades.
 
+20230618
+  AFFECTS: users of devel/soft-serve
+  AUTHOR: ashish@FreeBSD.org
+
+  soft-serve no longer uses config repository for configuration. To migrate
+  configuration from 0.4.x to 0.5.x, please review the upgrade documentation at:
+
+      https://github.com/charmbracelet/soft-serve/releases/tag/v0.5.0
+
+  The migration process has been incorporated in rc.d script's migrate command,
+  and can be performed using following instructions:
+
+  0. Please make sure to backup repository data
+
+  1. Stop existing process:
+
+      # /usr/local/etc/rc.d/soft-serve stop
+
+  2. Run the rc.d script to migrate, e.g.
+
+      # /usr/local/etc/rc.d/soft-serve migrate
+      INFO Setting SSH listen address...
+      INFO Copying SSH host key...
+      INFO Reading config repository...
+      INFO Setting server settings...
+      INFO Copying repos...
+      INFO   Copying repo ports
+      INFO   Copying readme from "config" to ".soft-serve"
+      INFO Setting repos metadata & collabs...
+      INFO Creating users & collabs...
+      INFO Creating user "ashish"
+      INFO Writing config...
+      INFO Done!
+
+  Another variable is introduced in rc.d script, soft_serve_data_path,
+  indicating the path to data directory used by soft-serve.
+
 20230609:
   AFFECTS: users of security/sequoia
   AUTHOR: vishwin@FreeBSD.org
diff --git a/devel/soft-serve/Makefile b/devel/soft-serve/Makefile
index 078f8b4ef71c..36e05f378fa7 100644
--- a/devel/soft-serve/Makefile
+++ b/devel/soft-serve/Makefile
@@ -1,7 +1,6 @@
 PORTNAME=	soft-serve
 DISTVERSIONPREFIX=	v
-DISTVERSION=	0.4.7
-PORTREVISION=	1
+DISTVERSION=	0.5.4
 CATEGORIES=	devel
 
 MAINTAINER=	ashish@FreeBSD.org
@@ -19,16 +18,19 @@ GH_ACCOUNT=	charmbracelet
 GO_MODULE=	github.com/charmbracelet/soft-serve
 GO_TARGET=	./cmd/soft
 USE_RC_SUBR=	soft-serve
+SUB_FILES=	pkg-message
 SUB_LIST+=	CHOWN="${CHOWN}" \
 		CUT="${CUT}" \
 		DEFAULTHOST=0.0.0.0 \
 		DEFAULTKEY=.ssh/soft_serve_server_ed25519 \
 		DEFAULTPORT=23231 \
 		DEFAULTREPO=.repos \
+		DEFAULTDATA=data \
 		DIRNAME="${DIRNAME}" \
 		GITUSER="${USERS}" \
 		MKDIR="${MKDIR}" \
 		PW="${PW}" \
+		SU="${SU_CMD:[1]}" \
 		SETENV="${SETENV}"
 USERS=		git
 GROUPS=		git
diff --git a/devel/soft-serve/distinfo b/devel/soft-serve/distinfo
index c1313bf333a9..7bc18c7b1eac 100644
--- a/devel/soft-serve/distinfo
+++ b/devel/soft-serve/distinfo
@@ -1,7 +1,7 @@
-TIMESTAMP = 1680139619
-SHA256 (go/devel_soft-serve/charmbracelet-soft-serve-v0.4.7_GH0/v0.4.7.mod) = ef1fbfc5c6935a714359db87e5334032a3dc178ce33122ad8b81dd42fa31e594
-SIZE (go/devel_soft-serve/charmbracelet-soft-serve-v0.4.7_GH0/v0.4.7.mod) = 3393
-SHA256 (go/devel_soft-serve/charmbracelet-soft-serve-v0.4.7_GH0/v0.4.7.zip) = 3b31183de65758c7c2a1b1066449227039b2d238cd728d7f51d8b962a5e8f733
-SIZE (go/devel_soft-serve/charmbracelet-soft-serve-v0.4.7_GH0/v0.4.7.zip) = 98820
-SHA256 (go/devel_soft-serve/charmbracelet-soft-serve-v0.4.7_GH0/charmbracelet-soft-serve-v0.4.7_GH0.tar.gz) = d850f3560584a206bbe1d88ec2f92622743a216e6f1cde868a606acdcd4e1de9
-SIZE (go/devel_soft-serve/charmbracelet-soft-serve-v0.4.7_GH0/charmbracelet-soft-serve-v0.4.7_GH0.tar.gz) = 67151
+TIMESTAMP = 1687104983
+SHA256 (go/devel_soft-serve/charmbracelet-soft-serve-v0.5.4_GH0/v0.5.4.mod) = 4f88d2ffd3eefb6df2f5e48f6d37ae880811701fc42fcdc71f3563ddeec5c1b7
+SIZE (go/devel_soft-serve/charmbracelet-soft-serve-v0.5.4_GH0/v0.5.4.mod) = 3922
+SHA256 (go/devel_soft-serve/charmbracelet-soft-serve-v0.5.4_GH0/v0.5.4.zip) = cf4439453eaa997928f35007377caa57e8e755f0ac776050458b1b0d307019d2
+SIZE (go/devel_soft-serve/charmbracelet-soft-serve-v0.5.4_GH0/v0.5.4.zip) = 160514
+SHA256 (go/devel_soft-serve/charmbracelet-soft-serve-v0.5.4_GH0/charmbracelet-soft-serve-v0.5.4_GH0.tar.gz) = ac9365cfc171a09e68875503ad0518c7461f900d7267dbe92e3e686dcd985356
+SIZE (go/devel_soft-serve/charmbracelet-soft-serve-v0.5.4_GH0/charmbracelet-soft-serve-v0.5.4_GH0.tar.gz) = 103793
diff --git a/devel/soft-serve/files/pkg-message.in b/devel/soft-serve/files/pkg-message.in
new file mode 100644
index 000000000000..a3e7eb32a5e1
--- /dev/null
+++ b/devel/soft-serve/files/pkg-message.in
@@ -0,0 +1,39 @@
+[
+{ type: upgrade
+  maximum_version: 0.5.0
+  message: <<EOM
+  soft-serve no longer uses config repository for configuration. To migrate
+  configuration from 0.4.x to 0.5.x, please review the upgrade documentation at:
+
+      https://github.com/charmbracelet/soft-serve/releases/tag/v0.5.0
+
+  The migration process has been incorporated in rc.d script's migrate command,
+  and can be performed using following instructions:
+
+  0. Please make sure to backup repository data
+
+  1. Stop existing process:
+
+      # %%PREFIX%%/etc/rc.d/soft-serve stop
+
+  2. Run the rc.d script to migrate, e.g.
+
+      # %%PREFIX%%/etc/rc.d/soft-serve migrate
+      INFO Setting SSH listen address...
+      INFO Copying SSH host key...
+      INFO Reading config repository...
+      INFO Setting server settings...
+      INFO Copying repos...
+      INFO   Copying repo ports
+      INFO   Copying readme from "config" to ".soft-serve"
+      INFO Setting repos metadata & collabs...
+      INFO Creating users & collabs...
+      INFO Creating user "ashish"
+      INFO Writing config...
+      INFO Done!
+
+  Another variable is introduced in rc.d script, soft_serve_data_path,
+  indicating the path to data directory used by soft-serve.
+EOM
+}
+]
diff --git a/devel/soft-serve/files/soft-serve.in b/devel/soft-serve/files/soft-serve.in
index 573fff20502c..b67a1c10e8d7 100644
--- a/devel/soft-serve/files/soft-serve.in
+++ b/devel/soft-serve/files/soft-serve.in
@@ -18,8 +18,10 @@
 #                               Set to %%DEFAULTHOST%% by default.
 # soft_serve_key_path (path):	Path to host key.
 #                               Set to ~%%GITUSER%%/%%DEFAULTKEY%% by default.
-# soft_serve_repo_path (path):	Path to repositories root.
+# soft_serve_repo_path (path):	Path to repositories root (old)
 #                               Set to ~%%GITUSER%%/%%DEFAULTREPO%% by default.
+# soft_serve_data_path (path):	Path to repositories data.
+#                               Set to ~%%GITUSER%%/%%DEFAULTDATA%% by default.
 # soft_serve_initial_admin_key (ssh public key): SSH public key for initial
 #                                                access to repositories (required)
 
@@ -36,6 +38,7 @@ load_rc_config $name
 : ${soft_serve_host:="%%DEFAULTHOST%%"}
 : ${soft_serve_key_path:="%%DEFAULTKEY%%"}
 : ${soft_serve_repo_path:="%%DEFAULTREPO%%"}
+: ${soft_serve_data_path:="%%DEFAULTDATA%%"}
 : ${soft_serve_initial_admin_key:=""}
 
 command="%%PREFIX%%/bin/soft-serve"
@@ -44,7 +47,27 @@ githome="$(%%PW%% user show -n ${soft_serve_user} | %%CUT%% -d: -f9)"
 
 pidfile="/var/run/${name}.pid"
 
+extra_commands="migrate"
 start_cmd="${name}_start"
+migrate_cmd="${name}_migrate"
+
+soft_serve_migrate() {
+	if echo ${soft_serve_key_path} | grep -q ^/; then
+		SOFT_SERVE_KEY_PATH=${soft_serve_key_path}
+	else
+		SOFT_SERVE_KEY_PATH=$githome/${soft_serve_key_path}
+	fi
+	if echo ${soft_serve_repo_path} | grep -q ^/; then
+		SOFT_SERVE_REPO_PATH=${soft_serve_repo_path}
+	else
+		SOFT_SERVE_REPO_PATH=$githome/${soft_serve_repo_path}
+	fi
+	%%SU%% -l ${soft_serve_user} -c "\
+		%%SETENV%% \
+		\"SOFT_SERVE_KEY_PATH=${SOFT_SERVE_KEY_PATH}\" \
+		\"SOFT_SERVE_REPO_PATH=${SOFT_SERVE_REPO_PATH}\" \
+		$command migrate-config"
+}
 
 soft_serve_start() {
         if [ -z "${soft_serve_initial_admin_key}" ]; then
@@ -68,23 +91,22 @@ soft_serve_start() {
 	  fi
 	fi
 
-	if [ "${soft_serve_repo_path}" = "%%DEFAULTREPO%%" ]; then
-	  soft_serve_repo_path=${githome}/${soft_serve_repo_path}
-	  if ! [ -d $(%%DIRNAME%% $soft_serve_repo_path) ]; then
-	    echo Creating repositories directory...
-	    %%MKDIR%% $soft_serve_repo_path
-	    %%CHOWN%% $soft_serve_user $soft_serve_repo_path
+	if [ "${soft_serve_data_path}" = "%%DEFAULTDATA%%" ]; then
+	  soft_serve_data_path=${githome}/${soft_serve_data_path}
+	  if ! [ -d $soft_serve_data_path ]; then
+	    echo Creating data directory...
+	    %%MKDIR%% $soft_serve_data_path
+	    %%CHOWN%% $soft_serve_user $soft_serve_data_path
 	  fi
 	fi
 
 	/usr/sbin/daemon -f \
 		-u ${soft_serve_user} -p ${pidfile} \
 		%%SETENV%% -i \
-		"SOFT_SERVE_PORT=${soft_serve_port}" \
-		"SOFT_SERVE_HOST=${soft_serve_host}" \
-		"SOFT_SERVE_KEY_PATH=${soft_serve_key_path}" \
-		"SOFT_SERVE_REPO_PATH=${soft_serve_repo_path}" \
-		"SOFT_SERVE_INITIAL_ADMIN_KEY=${soft_serve_initial_admin_key}" \
+		"SOFT_SERVE_SSH_PUBLIC_URL=ssh://${soft_serve_host}:${soft_serve_port}" \
+		"SOFT_SERVE_SSH_KEY_PATH=${soft_serve_key_path}" \
+		"SOFT_SERVE_DATA_PATH=${soft_serve_data_path}" \
+		"SOFT_SERVE_INITIAL_ADMIN_KEYS=${soft_serve_initial_admin_key}" \
 		"PATH=%%LOCALBASE%%/bin:${PATH}" \
 		"USER=${soft_serve_user}" \
 		$command serve



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202306182121.35ILLas4085366>