This commit is contained in:
@@ -2,6 +2,14 @@
|
||||
|
||||
A simple object storage system that stores files with metadata and provides a REST API for access.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
To install the latest version of simple-object-server, run:
|
||||
```bash
|
||||
curl https://getbin.xyz/simple-object-server-install:latest | bash
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- Store files with metadata (label:tag pairs and custom fields)
|
||||
|
36
install.sh
Normal file
36
install.sh
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Get script directory
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
|
||||
|
||||
PROJECT="simple-object-server"
|
||||
|
||||
# Set target directory - use ~/.local/bin by default, /usr/local/bin if root
|
||||
if [ "$(id -u)" = "0" ]; then
|
||||
TARGET_DIR="/usr/local/bin"
|
||||
else
|
||||
TARGET_DIR="${HOME}/.local/bin"
|
||||
# Create ~/.local/bin if it doesn't exist
|
||||
mkdir -p "${TARGET_DIR}"
|
||||
fi
|
||||
|
||||
if ! command -v wget >/dev/null 2>&1; then
|
||||
echo "wget is not installed. Please install wget and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ARCH=$(uname -m)
|
||||
if [ "${ARCH}" = "x86_64" ]; then
|
||||
ARCH="amd64"
|
||||
elif [ "${ARCH}" = "aarch64" ]; then
|
||||
ARCH="arm64"
|
||||
else
|
||||
echo "Unsupported architecture: ${ARCH}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
wget https://getbin.xyz/simple-object-server:${ARCH} -O "${TARGET_DIR}/simple-object-server"
|
||||
chmod +x "${TARGET_DIR}/simple-object-server"
|
||||
|
33
publish.sh
33
publish.sh
@@ -7,7 +7,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
echo "Publishing simple-object-server to gitea.jde.nz/public/simple-object-server:latest"
|
||||
|
||||
PROJECT="simple-object-server"
|
||||
|
||||
[[ -n $SOS_WRITE_TOKEN ]] || die "SOS_WRITE_TOKEN not specified"
|
||||
|
||||
# FUNCTIONS
|
||||
function title() {
|
||||
@@ -28,9 +28,12 @@ function die() {
|
||||
}
|
||||
|
||||
# Create buildx builder if it doesn't exist
|
||||
docker buildx create --name ${PROJECT}-multiarch --use \
|
||||
--driver-opt env.BUILDKIT_MAX_PARALLELISM=4 \
|
||||
2>/dev/null || docker buildx use ${PROJECT}-multiarch
|
||||
if ! docker buildx ls | grep -q "${PROJECT}-multiarch"; then
|
||||
docker buildx create --name ${PROJECT}-multiarch --use \
|
||||
--driver-opt env.BUILDKIT_MAX_PARALLELISM=4
|
||||
else
|
||||
docker buildx use ${PROJECT}-multiarch
|
||||
fi
|
||||
|
||||
function build() {
|
||||
local PLATFORM="$1"
|
||||
@@ -47,6 +50,8 @@ function build() {
|
||||
--build-arg CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \
|
||||
--output "${SCRIPT_DIR}/output/${OSARCH}" \
|
||||
--platform "${PLATFORM}" \
|
||||
--cache-from type=local,src=/tmp/.buildx-cache \
|
||||
--cache-to type=local,dest=/tmp/.buildx-cache,mode=max \
|
||||
"${SCRIPT_DIR}"
|
||||
|
||||
mv "${SCRIPT_DIR}/output/${OSARCH}/${PROJECT}" "${SCRIPT_DIR}/output/${PROJECT}-${OSARCH}"
|
||||
@@ -57,9 +62,25 @@ CMAKE_BUILD_TYPE="Release"
|
||||
|
||||
rm -rf "${SCRIPT_DIR}/output"
|
||||
mkdir -p "${SCRIPT_DIR}/output"
|
||||
mkdir -p /tmp/.buildx-cache
|
||||
|
||||
build "linux/amd64"
|
||||
build "linux/arm64"
|
||||
# Temporarily disabled - Windows cross-compilation needs different approach
|
||||
# build "windows/amd64"
|
||||
|
||||
[ -f "${SCRIPT_DIR}/output/${PROJECT}-linux-amd64" ] || die "${PROJECT}-linux-amd64 not found"
|
||||
[ -f "${SCRIPT_DIR}/output/${PROJECT}-linux-arm64" ] || die "${PROJECT}-linux-arm64 not found"
|
||||
|
||||
# uplaod to getbin.xyz
|
||||
|
||||
# # download the sos binary
|
||||
SOS="${SCRIPT_DIR}/temp/sos"
|
||||
mkdir -p "${SCRIPT_DIR}/temp"
|
||||
trap 'rm -rf "${SCRIPT_DIR}/temp"' EXIT
|
||||
|
||||
curl -L -o "${SOS}" "https://getbin.xyz/sos"
|
||||
chmod +x "${SOS}"
|
||||
|
||||
"${SOS}" upload "getbin.xyz" "${SCRIPT_DIR}/output/${PROJECT}-linux-amd64" "${PROJECT}:amd64"
|
||||
"${SOS}" upload "getbin.xyz" "${SCRIPT_DIR}/output/${PROJECT}-linux-arm64" "${PROJECT}:arm64"
|
||||
|
||||
"${SOS}" upload "getbin.xyz" "${SCRIPT_DIR}/install.sh" "simple-object-server-install:latest"
|
||||
|
Reference in New Issue
Block a user