forked from External/greenlight
Helper scripts (#298)
* Added helper scripts * Added commit tag to version tag to builds from master * Restored script for Travis * Restored script for Jenkins * Restored script for Jenkins * Restored script for Jenkins
This commit is contained in:
parent
ec250f3ed5
commit
1617b7dba1
|
@ -30,6 +30,7 @@ vendor/bundle
|
||||||
|
|
||||||
# Ignore environment configuration.
|
# Ignore environment configuration.
|
||||||
.env
|
.env
|
||||||
|
env
|
||||||
|
|
||||||
# IDEs
|
# IDEs
|
||||||
.idea
|
.idea
|
||||||
|
|
|
@ -61,7 +61,7 @@ volumes: [
|
||||||
withCredentials([file(credentialsId: 'cloud-datastore-user-account-creds', variable: 'FILE'), string(credentialsId: 'DOCKER_USER', variable: 'DOCKER_USER'), string(credentialsId: 'DOCKER_PASSWORD', variable: 'DOCKER_PASSWORD')]) {
|
withCredentials([file(credentialsId: 'cloud-datastore-user-account-creds', variable: 'FILE'), string(credentialsId: 'DOCKER_USER', variable: 'DOCKER_USER'), string(credentialsId: 'DOCKER_PASSWORD', variable: 'DOCKER_PASSWORD')]) {
|
||||||
sh "gcloud auth activate-service-account --key-file=$FILE"
|
sh "gcloud auth activate-service-account --key-file=$FILE"
|
||||||
if (stageBuild) {
|
if (stageBuild) {
|
||||||
sh "sed -i 's/VERSION =.*/VERSION = \"${gitBranch}\"/g' config/initializers/version.rb"
|
sh "sed -i 's/VERSION =.*/VERSION = \"${gitBranch} (${gitCommit.substring(7)})\"/g' config/initializers/version.rb"
|
||||||
sh "gcloud docker -- build -t ${imageTag} -t 'bigbluebutton/${appName}:master' . && gcloud docker -- push ${imageTag}"
|
sh "gcloud docker -- build -t ${imageTag} -t 'bigbluebutton/${appName}:master' . && gcloud docker -- push ${imageTag}"
|
||||||
sh "docker login -u $DOCKER_USER -p $DOCKER_PASSWORD"
|
sh "docker login -u $DOCKER_USER -p $DOCKER_PASSWORD"
|
||||||
sh "docker push 'bigbluebutton/${appName}:master'"
|
sh "docker push 'bigbluebutton/${appName}:master'"
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Helpers
|
||||||
|
|
||||||
|
## Running automatic updates
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo ln -s /root/greenlight/scripts/deploy.sh /usr/local/bin/greenlight-deploy
|
||||||
|
sudo cp /root/greenlight/scripts/greenlight-auto-deployer.service /etc/systemd/system/greenlight-auto-deployer.service
|
||||||
|
sudo cp /root/greenlight/scripts/greenlight-auto-deployer.timer /etc/systemd/system/greenlight-auto-deployer.timer
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl enable greenlight-auto-deployer.service
|
||||||
|
sudo systemctl enable greenlight-auto-deployer.timer
|
||||||
|
sudo systemctl start greenlight-auto-deployer.timer
|
||||||
|
```
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
STATUS="Status: Downloaded newer image for bigbluebutton/greenlight:v2"
|
||||||
|
|
||||||
|
new_status=$(sudo docker pull bigbluebutton/greenlight:v2 | grep Status:)
|
||||||
|
|
||||||
|
echo $new_status
|
||||||
|
|
||||||
|
if [ "$STATUS" == "$new_status" ]
|
||||||
|
then
|
||||||
|
cd /home/ubuntu/greenlight
|
||||||
|
sudo docker-compose down
|
||||||
|
sudo docker rmi $(sudo docker images -f dangling=true -q)
|
||||||
|
sudo docker-compose up -d
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
|
@ -0,0 +1,5 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Greenlight Auto Deployer
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/bin/bash /usr/local/bin/greenlight-deploy
|
|
@ -0,0 +1,12 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Runs greenlight-deploy every minute
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
# Time to wait after booting before we run first time
|
||||||
|
OnBootSec=1min
|
||||||
|
# Time between running each consecutive time
|
||||||
|
OnUnitActiveSec=1m
|
||||||
|
Unit=greenlight-auto-deployer.service
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in New Issue