Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial BOSH Release #1222

Merged
merged 34 commits into from
Sep 12, 2017
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
147f7ee
Initialize a BOSH release dir structure
viovanov Aug 11, 2017
7bf5856
Add bosh config files
viovanov Aug 11, 2017
25a5b18
Updated pre-packaging scripts
Aug 15, 2017
e029f37
Updated .gitignore
Aug 15, 2017
47e315a
Minor update to pre-packaging
Aug 15, 2017
0fc42da
Added templates
Aug 16, 2017
0471eb0
Add frontend spec
Aug 16, 2017
3bf80a1
spec updates
Aug 16, 2017
b438de3
Fix indentation issues
Aug 16, 2017
0ec5209
Add SSL certs
Aug 16, 2017
d6c2ff6
Nginx conf update
Aug 16, 2017
b006611
Updated spec
Aug 16, 2017
21644ef
Add erb to templates
Aug 16, 2017
4d463b5
Complete BOSH deployment configurations and example deployment manifest
viovanov Aug 16, 2017
15ee4c3
Initial bosh release
Aug 17, 2017
0ee1e24
Merge branch 'master' into bosh-release
Aug 17, 2017
a0dd94b
Add README.md
Aug 23, 2017
c269af1
Update BOSH release
Aug 24, 2017
996d076
Merge branch 'update-helm' into bosh-release
Aug 24, 2017
af4c518
Updated post-deploy script
Aug 25, 2017
7f97899
Update templates and README.md
Aug 25, 2017
fac25ce
Merge branch 'master' into bosh-release
Aug 25, 2017
918cf2a
Merge branch 'master' into bosh-release
Sep 8, 2017
a7052f1
Merge branch 'master' into bosh-release
Sep 8, 2017
9f7698e
Update BOSH templates
Sep 8, 2017
9b8c9da
Don't write upgrade-lock file when running with SQLlite
Sep 11, 2017
030a912
Create directory
Sep 11, 2017
09b91f1
Update README.md
Sep 11, 2017
3fb8605
Add Sqlite DB migration script
Sep 11, 2017
ff98e31
Merge branch 'master' into bosh-release
Sep 12, 2017
3c57826
Moved bosh-deploy
Sep 12, 2017
ad541ae
Merge branch 'master' into bosh-release
Sep 12, 2017
075a806
Updated symlink
Sep 12, 2017
4ef5ded
Tweaks to layout of the readme
nwmac Sep 12, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/

stratos-ui-release/.dev_builds
stratos-ui-release/blobs
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
97 changes: 97 additions & 0 deletions stratos-ui-release/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
## 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"'chart" should be "console"



### 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to be in the stratots-ui-release folder - need to add this to the instructions.

```

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your formatting foes weird in this section.

sub-sections (a) and (b) aren't indented.
I think you are missing ``` under the 5. heading
"To use SQLlite" - this is not formatted correctly which has knock-ons for the text afterwards


a. 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
```

b. Select the database you want to use. The Stratos UI Console can be deployed using a MySQL/MariaDB store or SQLite. The followign 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