Skip to content

Commit

Permalink
neue localtime (#507)
Browse files Browse the repository at this point in the history
  • Loading branch information
FalkoBenthin authored and Metauriel committed Mar 13, 2019
1 parent 1f60c80 commit 2597e9d
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 29 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ COPY ./package.json .
RUN npm install
#--only=production
COPY . .
COPY ./localtime /etc/localtime

#ENTRYPOINT crontab ./crontab && crond
CMD npm start
72 changes: 43 additions & 29 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,34 +1,48 @@
#! /bin/bash

### das ist alt
#cd ~/schulcloud-server/
#git pull
#npm install
#forever restart src/index.js
#curl -s -X POST https://api.telegram.org/bot$BOT_ID/sendMessage -d text="$NODE_ENV Server - update done" -d chat_id=$CHAT_ID
### das war alt

# replace special characters in branch name for docker tag
export DOCKERTAG=$( echo $TRAVIS_BRANCH | tr -s "[:punct:]" "-" )

# build containers
docker build -t schulcloud/schulcloud-server:$DOCKERTAG -t schulcloud/schulcloud-server:$GIT_SHA .

# Log in to the docker CLI
echo "$MY_DOCKER_PASSWORD" | docker login -u "$DOCKER_ID" --password-stdin

# take those images and push them up to docker hub
docker push schulcloud/schulcloud-server:$DOCKERTAG
docker push schulcloud/schulcloud-server:$GIT_SHA

# screw together config file for docker swarm
eval "echo \"$( cat compose-server-test.dummy )\"" > docker-compose-server.yml

# copy config-file to server and execute mit travis_rsa
chmod 600 travis_rsa
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i travis_rsa docker-compose-server.yml linux@test.schul-cloud.org:~
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i travis_rsa linux@test.schul-cloud.org /usr/bin/docker stack deploy -c /home/linux/docker-compose-server.yml test-schul-cloud
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i travis_rsa linux@test.schul-cloud.org /usr/bin/docker service update --force test-schul-cloud_server
export TESTDEPLOY=$( cat testdeploy )

if [ "$TRAVIS_BRANCH" = "master" ]
then
export DOCKERTAG=latest
else
# replace special characters in branch name for docker tag
export DOCKERTAG=$( echo $TRAVIS_BRANCH | tr -s "[:punct:]" "-" | tr -s "[:upper:]" "[:lower:]" )
fi

function buildandpush {
# build containers
docker build -t schulcloud/schulcloud-server:$DOCKERTAG -t schulcloud/schulcloud-server:$GIT_SHA .

# Log in to the docker CLI
echo "$MY_DOCKER_PASSWORD" | docker login -u "$DOCKER_ID" --password-stdin

# take those images and push them up to docker hub
docker push schulcloud/schulcloud-server:$DOCKERTAG
docker push schulcloud/schulcloud-server:$GIT_SHA
}

function deploytotest {
# screw together config file for docker swarm
eval "echo \"$( cat compose-server-test.dummy )\"" > docker-compose-server.yml

# copy config-file to server and execute mit travis_rsa
chmod 600 travis_rsa
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i travis_rsa docker-compose-server.yml linux@test.schul-cloud.org:~
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i travis_rsa linux@test.schul-cloud.org /usr/bin/docker stack deploy -c /home/linux/docker-compose-server.yml test-schul-cloud
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i travis_rsa linux@test.schul-cloud.org /usr/bin/docker service update --force test-schul-cloud_server
}

if [[ "$TRAVIS_BRANCH" = "master" && "$TRAVIS_PULL_REQUEST" = "false" ]]
then
buildandpush
elif [ "$TESTDEPLOY" = "true" ]
then
buildandpush
deploytotest
else
echo "Nix wird deployt"
fi

exit 0

Expand Down
Binary file added localtime
Binary file not shown.
1 change: 1 addition & 0 deletions testdeploy
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
false

0 comments on commit 2597e9d

Please sign in to comment.