Skip to content

Commit

Permalink
Merge pull request #1222 from SUSE/bosh-release
Browse files Browse the repository at this point in the history
Initial BOSH Release
  • Loading branch information
nwmac authored Sep 12, 2017
2 parents a62604c + 4ef5ded commit fef5da9
Show file tree
Hide file tree
Showing 39 changed files with 1,139 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ deploy/development.rc
deploy/ci/secrets.yml
deploy/kubernetes/values.yaml
outputs/

deploy/stratos-ui-release/.dev_builds
deploy/stratos-ui-release/blobs
deploy/stratos-ui-release/dev_releases/
121 changes: 121 additions & 0 deletions build/tools/get-glide.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#!/bin/sh

# The install script is licensed under the MIT license Glide itself is under.
# See https://github.com/Masterminds/glide/blob/master/LICENSE for more details.

# To run this script execute:
# `curl https://glide.sh/get | sh`

PROJECT_NAME="glide"

# LGOBIN represents the local bin location. This can be either the GOBIN, if set,
# or the GOPATH/bin.

LGOBIN=""

verifyGoInstallation() {
GO=$(which go)
if [ "$?" = "1" ]; then
echo "$PROJECT_NAME needs go. Please intall it first."
exit 1
fi
if [ -z "$GOPATH" ]; then
echo "$PROJECT_NAME needs environment variable "'$GOPATH'". Set it before continue."
exit 1
fi
if [ -n "$GOBIN" ]; then
if [ ! -d "$GOBIN" ]; then
echo "$GOBIN "'($GOBIN)'" folder not found. Please create it before continue."
exit 1
fi
LGOBIN="$GOBIN"
else
if [ ! -d "$GOPATH/bin" ]; then
echo "$GOPATH/bin "'($GOPATH/bin)'" folder not found. Please create it before continue."
exit 1
fi
LGOBIN="$GOPATH/bin"
fi

}

initArch() {
ARCH=$(uname -m)
case $ARCH in
armv5*) ARCH="armv5";;
armv6*) ARCH="armv6";;
armv7*) ARCH="armv7";;
aarch64) ARCH="arm64";;
x86) ARCH="386";;
x86_64) ARCH="amd64";;
i686) ARCH="386";;
i386) ARCH="386";;
esac
}

initOS() {
OS=$(echo `uname`|tr '[:upper:]' '[:lower:]')

case "$OS" in
# Minimalist GNU for Windows
mingw*) OS='windows';;
esac
}

downloadFile() {
TAG=$(wget -q -O - https://glide.sh/version)
LATEST_RELEASE_URL="https://api.github.com/repos/Masterminds/$PROJECT_NAME/releases/tags/$TAG"
LATEST_RELEASE_JSON=$(wget -q -O - "$LATEST_RELEASE_URL")
GLIDE_DIST="glide-$TAG-$OS-$ARCH.tar.gz"
# || true forces this command to not catch error if grep does not find anything
DOWNLOAD_URL=$(echo "$LATEST_RELEASE_JSON" | grep 'browser_' | cut -d\" -f4 | grep "$GLIDE_DIST") || true
if [ -z "$DOWNLOAD_URL" ]; then
echo "Sorry, we dont have a dist for your system: $OS $ARCH"
echo "You can ask one here: https://github.com/Masterminds/$PROJECT_NAME/issues"
exit 1
else
GLIDE_TMP_FILE="/tmp/$GLIDE_DIST"
echo "Downloading $DOWNLOAD_URL"
wget -q -O "$GLIDE_TMP_FILE" "$DOWNLOAD_URL"
fi
}

installFile() {
GLIDE_TMP="/tmp/$PROJECT_NAME"
mkdir -p "$GLIDE_TMP"
tar xf "$GLIDE_TMP_FILE" -C "$GLIDE_TMP"
GLIDE_TMP_BIN="$GLIDE_TMP/$OS-$ARCH/$PROJECT_NAME"
cp "$GLIDE_TMP_BIN" "$LGOBIN"
}

bye() {
result=$?
if [ "$result" != "0" ]; then
echo "Fail to install $PROJECT_NAME"
fi
exit $result
}

testVersion() {
set +e
GLIDE="$(which $PROJECT_NAME)"
if [ "$?" = "1" ]; then
echo "$PROJECT_NAME not found. Did you add "'$LGOBIN'" to your "'$PATH?'
exit 1
fi
set -e
GLIDE_VERSION=$($PROJECT_NAME -v)
echo "$GLIDE_VERSION installed successfully"
}

# Execution

#Stop execution on any error
trap "bye" EXIT
verifyGoInstallation
set -e
initArch
initOS
downloadFile
installFile
testVersion
3 changes: 3 additions & 0 deletions components/app-core/backend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,9 @@ func isConsoleUpgrading() bool {
}

upgradeLockPath := fmt.Sprintf("/%s/%s", upgradeVolume, upgradeLockFile)
if string(upgradeVolume[0]) == "/" {
upgradeLockPath = fmt.Sprintf("%s/%s", upgradeVolume, upgradeLockFile)
}

if _, err := os.Stat(upgradeLockPath); err == nil {
return true
Expand Down
8 changes: 6 additions & 2 deletions components/app-core/backend/repository/crypto/aes.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ func Decrypt(key, ciphertext []byte) (plaintext []byte, err error) {
// ReadEncryptionKey - Read the encryption key from the shared volume
func ReadEncryptionKey(v, f string) ([]byte, error) {
log.Println("ReadEncryptionKey")
fname := fmt.Sprintf("/%s/%s", v, f)
key64chars, err := ioutil.ReadFile(fname)

encryptionKey := fmt.Sprintf("/%s/%s", v, f)
if string(f[0]) == "/" {
encryptionKey = fmt.Sprintf("%s/%s", v, f)
}
key64chars, err := ioutil.ReadFile(encryptionKey)
if err != nil {
log.Errorf("Unable to read encryption key file: %+v\n", err)
return nil, err
Expand Down
98 changes: 98 additions & 0 deletions deploy/stratos-ui-release/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
## Deploying the BOSH release

**Note:** BOSH release is currently experimental. It currently has only been tested in a BOSH Lite environment, any suggestions for improvements to support other BOSH environments are welcome.

To build and deploy the BOSH release you will require a BOSH director. If you don't have one available follow these instructions to setup BOSH lite [here](https://bosh.io/docs/bosh-lite.html).
The rest of the instruction assume that a BOSH lite environment is being used to deploy the chart.


### Deploying in a BOSH lite environment

1. To upload a cloud-config execute the following:
```
$ bosh -e vbox update-cloud-config ~/workspace/bosh-deployment/warden/cloud-config.yml
```
2. Upload a stemcell (using the `bosh-warden-boshlite-ubuntu-trusty`)
```
bosh -e vbox upload-stemcell https://bosh.io/d/stemcells/bosh-warden-boshlite-ubuntu-trusty-go_agent?v=3421.9 \
--sha1 1396d7877204e630b9e77ae680f492d26607461d
```
3. Build the Stratos UI BOSH release
```
$ bosh create-release
```
If you have outstanding changes locally add the `--force` flag.
4. After a successful build, upload the release to your director.
```
$ bosh -e vbox upload-release -d stratos-ui
```
5. Deploy the release
A sample bosh-lite deployment manifest has been provided in `bosh-lite/deployment.yaml`. The following will use that command to deploy the Console.
5.1. Provide UAA settings in the deployment manifest if known. In the following some sample values have been provided.
```
uaa_address: https://my-uaa:8080
console_admin_scope: cloud_controller.admin
console_uaa_client: cf
```
5.2. Select the database you want to use. The Stratos UI Console can be deployed using a MySQL/MariaDB store or SQLite. The following are sample values for a mysql configuration. This assumes a MySQL server has been deployed locally on the host.
```
use_mysql: true
use_sqlite: false
mysql_user: stratos
mysql_admin_user: root
mysql_admin_password: changeme
mysql_user_password: strat0s
mysql_db: stratos-db
mysql_host: 127.0.0.1
mysql_port: 3306
```
To use SQLite, use the following and comment out the mysql parameters.
```
# use_mysql: true
use_sqlite: true
# mysql_user: stratos
# mysql_admin_user: root
# mysql_admin_password: changeme
# mysql_user_password: strat0s
# mysql_db: stratos-db
# mysql_host: 127.0.0.1
# mysql_port: 3306
```
To deploy you deployment manifest execute the following.
```
$ bosh -e vbox -d stratos-ui deploy bosh-lite/deployment.yml
```
6. List deployment
List deployment to get the IP address of the frontend to access the Console. In the following example to access the Console the address is `https://10.0.16.4`.
```
09:10 $ bosh -e vbox -d stratos-ui instances
Using environment '192.168.50.6' as client 'admin'
Task 22. Done
Deployment 'stratos-ui'
Instance Process State AZ IPs
backend/68580d76-a241-4de2-b246-82d0a184c9bb running - 10.0.16.103
frontend/477c94ef-3138-416c-97d7-c09682e6d5dd running - 10.0.16.4
2 instances
Succeeded
```
Loading

0 comments on commit fef5da9

Please sign in to comment.