Skip to content

Commit

Permalink
Add dev installation support (#122)
Browse files Browse the repository at this point in the history
* resolve 404 errors on dashboard with chi router

* fix api response on service create

* use git clone to allow custom version

* account for duplicate network names

* revert variables in dev installer

* revert variables in dev installer
  • Loading branch information
idoqo authored May 11, 2022
1 parent 6a1e2fb commit 8e7bb4b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 23 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ require (
github.com/containerd/containerd v1.5.7 // indirect
github.com/docker/docker v20.10.9+incompatible
github.com/docker/go-connections v0.4.0
github.com/go-chi/chi/v5 v5.0.7 // indirect
github.com/go-chi/chi/v5 v5.0.7
github.com/golang-jwt/jwt v3.2.1+incompatible
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/websocket v1.4.2
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.11.0
github.com/robfig/cron/v3 v3.0.1
github.com/rs/cors v1.8.0
Expand Down
15 changes: 3 additions & 12 deletions scripts/install-spinup-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,13 @@ if [ -z "$SPINUP_API_KEY" ]; then
fi

SPINUP_DIR=${SPINUP_DIR:-"${HOME}/.local/spinup"}

if [ -z "$API_VERSION" ]; then
if [ -z "$VERSION" ]; then
echo "Fetching latest Spinup version..."
SPINUP_VERSION=$(curl --silent "https://api.github.com/repos/spinup-host/spinup/releases" | jq -r 'first | .tag_name')
else
SPINUP_VERSION=$API_VERSION
fi

if [ -z "$UI_VERSION" ]; then
echo "Fetching latest Spinup version..."
SPINUP_UI_VERSION=main
else
SPINUP_UI_VERSION=$UI_VERSION
SPINUP_VERSION=$VERSION
fi


OS=$(go env GOOS)
ARCH=$(go env GOARCH)
PLATFORM="${OS}-${ARCH}"
Expand All @@ -55,7 +46,7 @@ go build -o spinup-backend ./main.go
./spinup-backend version
cp ${SPINUP_TMP_DIR}/spinup-api/spinup-backend ${SPINUP_DIR}/spinup

git clone --depth=1 --branch=${UI_VERSION} https://github.com/spinup-host/spinup-dash.git ${SPINUP_TMP_DIR}/spinup-dash
git clone --depth=1 https://github.com/spinup-host/spinup-dash.git ${SPINUP_TMP_DIR}/spinup-dash
cd ${SPINUP_TMP_DIR}/spinup-dash
# setup env variables for dashboard's npm build
cat >.env <<-EOF
Expand Down
21 changes: 12 additions & 9 deletions scripts/install-spinup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,29 @@ if [ -z "$SPINUP_API_KEY" ]; then
fi

SPINUP_DIR=${SPINUP_DIR:-"${HOME}/.local/spinup"}
echo "Fetching latest Spinup version..."
SPINUP_VERSION=$(curl --silent "https://api.github.com/repos/spinup-host/spinup/releases" | jq -r 'first | .tag_name')
if [ -z "$VERSION" ]; then
echo "Fetching latest Spinup version..."
SPINUP_VERSION=$(curl --silent "https://api.github.com/repos/spinup-host/spinup/releases" | jq -r 'first | .tag_name')
else
SPINUP_VERSION=$VERSION
fi

OS=$(go env GOOS)
ARCH=$(go env GOARCH)
PLATFORM="${OS}-${ARCH}"
API_DL_URL="https://github.com/spinup-host/spinup/releases/download/${SPINUP_VERSION}/spinup-backend-${SPINUP_VERSION}-${PLATFORM}.tar.gz"

SPINUP_PACKAGE="spinup-${SPINUP_VERSION}-${OS}-${ARCH}.tar.gz"
SPINUP_TMP_DIR="/tmp/spinup-install"

mkdir -p ${SPINUP_DIR}
mkdir -p ${SPINUP_TMP_DIR}

curl -LSs ${API_DL_URL} -o ${SPINUP_TMP_DIR}/${SPINUP_PACKAGE}
tar xzvf ${SPINUP_TMP_DIR}/${SPINUP_PACKAGE} -C "${SPINUP_TMP_DIR}/"
rm -f ${SPINUP_TMP_DIR}/${SPINUP_PACKAGE}

${SPINUP_TMP_DIR}/spinup-backend version
cp ${SPINUP_TMP_DIR}/spinup-backend ${SPINUP_DIR}/spinup
echo "git clone --depth=1 --branch=${SPINUP_VERSION} https://github.com/spinup-host/spinup.git ${SPINUP_TMP_DIR}/spinup-api"
git clone --depth=1 --branch=${SPINUP_VERSION} https://github.com/spinup-host/spinup.git ${SPINUP_TMP_DIR}/spinup-api
cd ${SPINUP_TMP_DIR}/spinup-api
go build -o spinup-backend ./main.go
./spinup-backend version
cp ${SPINUP_TMP_DIR}/spinup-api/spinup-backend ${SPINUP_DIR}/spinup

git clone --depth=1 https://github.com/spinup-host/spinup-dash.git ${SPINUP_TMP_DIR}/spinup-dash
cd ${SPINUP_TMP_DIR}/spinup-dash
Expand Down

0 comments on commit 8e7bb4b

Please sign in to comment.