Commit b80bca253a6e7945c9713351899c9ffb98c9665d
Committed by
GitHub
Merge pull request #937 from thingsboard/cassandra_upgrade_docker
Cassandra upgrade docker
Showing
4 changed files
with
107 additions
and
0 deletions
docker/cassandra-upgrade/Dockerfile
0 → 100644
1 | +# | ||
2 | +# Copyright © 2016-2018 The Thingsboard Authors | ||
3 | +# | ||
4 | +# Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | +# you may not use this file except in compliance with the License. | ||
6 | +# You may obtain a copy of the License at | ||
7 | +# | ||
8 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | +# | ||
10 | +# Unless required by applicable law or agreed to in writing, software | ||
11 | +# distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | +# See the License for the specific language governing permissions and | ||
14 | +# limitations under the License. | ||
15 | +# | ||
16 | + | ||
17 | +FROM openjdk:8-jre | ||
18 | + | ||
19 | +ADD upgrade.sh /upgrade.sh | ||
20 | +ADD thingsboard.deb /thingsboard.deb | ||
21 | + | ||
22 | +RUN apt-get update \ | ||
23 | + && apt-get install -y nmap \ | ||
24 | + && chmod +x /upgrade.sh |
docker/cassandra-upgrade/Makefile
0 → 100644
1 | +VERSION=2.0.3 | ||
2 | +PROJECT=thingsboard | ||
3 | +APP=cassandra-upgrade | ||
4 | + | ||
5 | +build: | ||
6 | + cp ../../application/target/thingsboard.deb . | ||
7 | + docker build --pull -t ${PROJECT}/${APP}:${VERSION} -t ${PROJECT}/${APP}:latest . | ||
8 | + rm thingsboard.deb | ||
9 | + | ||
10 | +push: build | ||
11 | + docker push ${PROJECT}/${APP}:${VERSION} | ||
12 | + docker push ${PROJECT}/${APP}:latest |
docker/cassandra-upgrade/upgrade.sh
0 → 100755
1 | +#!/bin/bash | ||
2 | +# | ||
3 | +# Copyright © 2016-2018 The Thingsboard Authors | ||
4 | +# | ||
5 | +# Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | +# you may not use this file except in compliance with the License. | ||
7 | +# You may obtain a copy of the License at | ||
8 | +# | ||
9 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | +# | ||
11 | +# Unless required by applicable law or agreed to in writing, software | ||
12 | +# distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | +# See the License for the specific language governing permissions and | ||
15 | +# limitations under the License. | ||
16 | +# | ||
17 | + | ||
18 | + | ||
19 | +dpkg -i /thingsboard.deb | ||
20 | + | ||
21 | +until nmap $CASSANDRA_HOST -p $CASSANDRA_PORT | grep "$CASSANDRA_PORT/tcp open" | ||
22 | +do | ||
23 | + echo "Wait for cassandra db to start..." | ||
24 | + sleep 10 | ||
25 | +done | ||
26 | + | ||
27 | +echo "Upgrading 'Thingsboard' schema..." | ||
28 | +/usr/share/thingsboard/bin/install/upgrade.sh --fromVersion=$UPGRADE_FROM_VERSION |
docker/k8s/cassandra-upgrade.yaml
0 → 100644
1 | +# | ||
2 | +# Copyright © 2016-2018 The Thingsboard Authors | ||
3 | +# | ||
4 | +# Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | +# you may not use this file except in compliance with the License. | ||
6 | +# You may obtain a copy of the License at | ||
7 | +# | ||
8 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | +# | ||
10 | +# Unless required by applicable law or agreed to in writing, software | ||
11 | +# distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | +# See the License for the specific language governing permissions and | ||
14 | +# limitations under the License. | ||
15 | +# | ||
16 | + | ||
17 | +apiVersion: v1 | ||
18 | +kind: Pod | ||
19 | +metadata: | ||
20 | + name: cassandra-upgrade | ||
21 | +spec: | ||
22 | + containers: | ||
23 | + - name: cassandra-upgrade | ||
24 | + imagePullPolicy: Always | ||
25 | + image: thingsboard/cassandra-upgrade:2.0.3 | ||
26 | + env: | ||
27 | + - name: ADD_DEMO_DATA | ||
28 | + value: "true" | ||
29 | + - name : CASSANDRA_HOST | ||
30 | + value: "cassandra-headless" | ||
31 | + - name : CASSANDRA_PORT | ||
32 | + value: "9042" | ||
33 | + - name : DATABASE_TYPE | ||
34 | + value: "cassandra" | ||
35 | + - name : CASSANDRA_URL | ||
36 | + value: "cassandra-headless:9042" | ||
37 | + - name : UPGRADE_FROM_VERSION | ||
38 | + value: "1.4.0" | ||
39 | + command: | ||
40 | + - sh | ||
41 | + - -c | ||
42 | + - /upgrade.sh | ||
43 | + restartPolicy: Never |