Skip to content

Commit d686de4

Browse files
committed
chore: update deployment scripts
1 parent 269f6e2 commit d686de4

File tree

6 files changed

+30
-29
lines changed

6 files changed

+30
-29
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414
with:
15-
fetch-depth: 0 # Get tags to allow build script to get build version
15+
fetch-depth: 0 # Get tags to allow build script to get build version
1616

1717
- name: Set up Go
1818
uses: actions/setup-go@v5
@@ -37,7 +37,8 @@ jobs:
3737
with:
3838
draft: true
3939
files: |
40-
target/scanoss-hfh-api-linux-amd64
41-
target/scanoss-hfh-api-linux-arm64
42-
scanoss-hfh-api_linux-amd64_${{ github.ref_name }}-1.tgz
43-
scanoss-hfh-api_linux-arm64_${{ github.ref_name }}-1.tgz
40+
target/scanoss-folder-hashing-api-linux-amd64
41+
target/scanoss-folder-hashing-api-linux-arm64
42+
scanoss-folder-hashing-api_linux-amd64_${{ github.ref_name }}-1.tgz
43+
scanoss-folder-hashing-api_linux-arm64_${{ github.ref_name }}-1.tgz
44+

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,11 @@ release: docker_package_all ## Build and package everything for release
233233
package_amd: version ## Build & Package an AMD 64 binary
234234
@echo "Building AMD binary $(VERSION) and placing into scripts..."
235235
go generate ./cmd/server/main.go
236-
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-w -s" -o ./scripts/scanoss-hfh-api ./cmd/server/main.go
236+
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-w -s" -o ./scripts/scanoss-folder-hashing-api ./cmd/server/main.go
237237
bash ./package-scripts.sh linux-amd64 $(VERSION)
238238

239239
package_arm: version ## Build & Package an ARM 64 binary
240240
@echo "Building ARM binary $(VERSION) and placing into scripts..."
241241
go generate ./cmd/server/main.go
242-
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="-w -s" -o ./scripts/scanoss-hfh-api ./cmd/server/main.go
242+
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="-w -s" -o ./scripts/scanoss-folder-hashing-api ./cmd/server/main.go
243243
bash ./package-scripts.sh linux-arm64 $(VERSION)

package-scripts.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export COPYFILE_DISABLE=true # Required if packaging on OSX
4141
platform=$1
4242
version=$2
4343
build=1
44-
prefix_name="scanoss-hfh-api"
44+
prefix_name="scanoss-folder-hashing-api"
4545
tar_name="${prefix_name}_${platform}_${version}-${build}.tgz"
4646
# Get a unique archive name
4747
while [ -f "$tar_name" ] ; do

scripts/env-setup.sh

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
##########################################
44
#
55
# This script will copy all the required files into the correct locations on the server
6-
# Config goes into: /usr/local/etc/scanoss/hfh
7-
# Logs go into: /var/log/scanoss/hfh
6+
# Config goes into: /usr/local/etc/scanoss/folder-hashing-api
7+
# Logs go into: /var/log/scanoss/folder-hashing-api
88
# Service definition goes into: /etc/systemd/system
99
# Binary & startup go into: /usr/local/bin
1010
#
1111
################################################################
1212

1313
show_help() {
1414
echo "$0 [-h|--help] [-f|--force] [environment]"
15-
echo " Setup and copy the required files into place on a server to run the SCANOSS HFH API"
15+
echo " Setup and copy the required files into place on a server to run the SCANOSS Folder Hashing API"
1616
echo " [environment] allows the optional specification of a suffix to allow multiple services"
1717
echo " -f | --force Run without interactive prompts (skip questions, skip SQLite setup, do not overwrite config)"
1818
exit 1
@@ -40,11 +40,11 @@ done
4040

4141
ENVIRONMENT="${ENVIRONMENT:-$DEFAULT_ENV}"
4242
export BASE_C_PATH=/usr/local/etc/scanoss
43-
export CONFIG_DIR="${BASE_C_PATH}/hfh"
43+
export CONFIG_DIR="${BASE_C_PATH}/folder-hashing-api"
4444
export LOG_DIR=/var/log/scanoss
45-
export L_PATH="${LOG_DIR}/hfh"
45+
export L_PATH="${LOG_DIR}/folder-hashing-api"
4646
export DB_PATH_BASE=/var/lib/scanoss
47-
export SQLITE_PATH="${DB_PATH_BASE}/db/sqlite/hfh"
47+
export SQLITE_PATH="${DB_PATH_BASE}/db/sqlite/folder-hashing-api"
4848
export SQLITE_DB_NAME=base.sqlite
4949
export TARGET_SQLITE_DB_NAME=db.sqlite
5050
export CONF_DOWNLOAD_URL="https://raw.githubusercontent.com/scanoss/hfh/refs/heads/main/config/app-config-prod.json"
@@ -63,18 +63,18 @@ if [ "$EUID" -ne 0 ] ; then
6363
fi
6464

6565
if [ "$FORCE" = false ]; then
66-
read -p "Install SCANOSS HFH API $ENVIRONMENT (y/n) [n]? " -n 1 -r
66+
read -p "Install SCANOSS Folder Hashing API $ENVIRONMENT (y/n) [n]? " -n 1 -r
6767
echo
6868
if [[ ! $REPLY =~ ^[Yy]$ ]] ; then
6969
echo "Stopping."
7070
exit 1
7171
fi
7272
else
73-
echo "[FORCE] Auto-accept installation of SCANOSS HFH API $ENVIRONMENT"
73+
echo "[FORCE] Auto-accept installation of SCANOSS Folder Hashing API $ENVIRONMENT"
7474
fi
7575

7676
# Setup all the required folders and ownership
77-
echo "Setting up HFH API system folders..."
77+
echo "Setting up Folder Hashing API system folders..."
7878
mkdir -p "$CONFIG_DIR" || { echo "Error: Problem creating $CONFIG_DIR"; exit 1; }
7979
mkdir -p "$L_PATH" || { echo "Error: Problem creating $L_PATH"; exit 1; }
8080

@@ -84,11 +84,11 @@ if [ "$RUNTIME_USER" != "root" ] ; then
8484
fi
8585

8686
# Setup the service on the system
87-
SC_SERVICE_FILE="scanoss-hfh-api.service"
88-
SC_SERVICE_NAME="scanoss-hfh-api"
87+
SC_SERVICE_FILE="scanoss-folder-hashing-api.service"
88+
SC_SERVICE_NAME="scanoss-folder-hashing-api"
8989
if [ -n "$ENVIRONMENT" ] ; then
90-
SC_SERVICE_FILE="scanoss-hfh-api-${ENVIRONMENT}.service"
91-
SC_SERVICE_NAME="scanoss-hfh-api-${ENVIRONMENT}"
90+
SC_SERVICE_FILE="scanoss-folder-hashing-api-${ENVIRONMENT}.service"
91+
SC_SERVICE_NAME="scanoss-folder-hashing-api-${ENVIRONMENT}"
9292
fi
9393

9494
service_stopped=""
@@ -102,7 +102,7 @@ echo "Copying service startup config..."
102102
if [ -f "$SC_SERVICE_FILE" ] ; then
103103
cp "$SC_SERVICE_FILE" /etc/systemd/system || { echo "Error: service copy failed"; exit 1; }
104104
fi
105-
cp scanoss-hfh-api.sh /usr/local/bin || { echo "Error: startup script copy failed"; exit 1; }
105+
cp scanoss-folder-hashing-api.sh /usr/local/bin || { echo "Error: startup script copy failed"; exit 1; }
106106

107107
####################################################
108108
# SEARCH CONFIG FILE #
@@ -198,7 +198,7 @@ find "$DB_PATH_BASE" -type d -exec chmod 0750 "{}" \;
198198
find "$DB_PATH_BASE" -type f -exec chmod 0640 "{}" \;
199199

200200
# Copy the binaries if requested
201-
BINARY=scanoss-hfh-api
201+
BINARY=scanoss-folder-hashing-api
202202
if [ -f $BINARY ] ; then
203203
echo "Copying app binary to /usr/local/bin ..."
204204
cp $BINARY /usr/local/bin || { echo "Error copying $BINARY"; exit 1; }
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[Unit]
2-
Description=SCANOSS HFH API Service
2+
Description=SCANOSS Folder Hashing API Service
33
After=network.target
44
StartLimitIntervalSec=0
55

@@ -8,7 +8,7 @@ Type=simple
88
Restart=always
99
RestartSec=5
1010
User=scanoss
11-
ExecStart=/usr/local/bin/scanoss-hfh-api.sh
11+
ExecStart=/usr/local/bin/scanoss-folder-hashing-api.sh
1212

1313
[Install]
1414
WantedBy=multi-user.target

scripts/scanoss-hfh-api.sh renamed to scripts/scanoss-folder-hashing-api.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
################################################################
1010
DEFAULT_ENV="prod"
1111
ENVIRONMENT="${1:-$DEFAULT_ENV}"
12-
LOGFILE=/var/log/scanoss/hfh/scanoss-hfh-${ENVIRONMENT}.log
13-
CONF_FILE=/usr/local/etc/scanoss/hfh/app-config-${ENVIRONMENT}.json
12+
LOGFILE=/var/log/scanoss/folder-hashing-api/scanoss-folder-hashing-api-${ENVIRONMENT}.log
13+
CONF_FILE=/usr/local/etc/scanoss/folder-hashing-api/app-config-${ENVIRONMENT}.json
1414
# Rotate log
1515
if [ -f "$LOGFILE" ] ; then
1616
echo "rotating logfile..."
@@ -22,6 +22,6 @@ fi
2222
echo > "$LOGFILE"
2323

2424
#start API
25-
echo "Starting SCANOSS HFH API"
25+
echo "Starting SCANOSS Folder Hashing API"
2626

27-
exec /usr/local/bin/scanoss-hfh-api --json-config "$CONF_FILE" > "$LOGFILE" 2>&1
27+
exec /usr/local/bin/scanoss-folder-hashing-api --json-config "$CONF_FILE" > "$LOGFILE" 2>&1

0 commit comments

Comments
 (0)