Commit 3864317c authored by Lasse Overgaard Møldrup's avatar Lasse Overgaard Møldrup
Browse files

Merge branch 'develop' into 'feature/move-blocks'

# Conflicts:
#   website/studerende-dk/src/views/Home.vue
parents a9323a4a e12a0098
Pipeline #52218 passed with stage
in 40 seconds
#!/bin/bash
# this script pulls the docker images and
# deploys them respectively if they are
# newer than the ones running.
# this script can be run at any time,
# and will only change the running
# containers if newer ones are available.
function deploy {
local url=$1
local service_name=$2
local run_arguments=$3
old_digest=$(docker inspect -f '{{.RepoDigests}}' ${url}:active | grep -o 'sha256:[0-9A-Fa-f]*')
# probably no existing image
if [ $? -ne 0 ]; then
echo "No existing image! Abort."
exit 1;
fi
new_digest=$(docker pull ${url}:latest | grep Digest | sed 's/Digest: //')
# network error or authentication might go wrong
if [ $? -ne 0 ]; then
echo "Auth or network err! Abort."
exit 2;
fi
# sanity check that new digest is formatted correctly and is same length as old.
# if it aint, it could be the result of a gitlab server error or such.
local check=$(echo $new_digest | grep -o 'sha256:[0-9A-Fa-f]*')
if [ "${#check}" -eq "0" ] || [ ${#old_digest} -ne 71 ]; then
echo "Damnit, something went bad! Crash and burn.."
exit 3;
fi
echo "Old digest: $old_digest"
echo "New digest: $new_digest"
if [ "$old_digest" != "$new_digest" ]; then
echo "Deploying new docker instance: $service_name."
docker stop $service_name
docker rm $service_name
docker rmi ${url}:active
docker tag ${url}:latest ${url}:active
docker run --network persist-net $run_arguments --name $service_name -d ${url}:active
result=0
else
echo "Already up to date."
fi
# remove/untag file. silence output
docker rmi ${url}:latest >/dev/null 2>&1
}
base_url="registry.gitlab.au.dk/exsys2021/da6/hold-afstand/"
# deploy new server if available
result=1
deploy ${base_url}server "server" "--network-alias server"
server_deployed=$result
echo
# deploy new web if available
result=1
deploy ${base_url}web "web" "-p 80:80"
web_deployed=$result
# if anything has been deployed, notify the devs
if [ $server_deployed -eq 0 ] || [ $web_deployed -eq 0 ]; then
[ $server_deployed -eq 0 ] && msg="backend"
[ $web_deployed -eq 0 ] && [ $server_deployed -eq 0 ] && msg=${msg}" and "
[ $web_deployed -eq 0 ] && msg=${msg}"frontend"
slack_msg="A new version of the ${msg} has been deployed! Check it out: https://vm34.exsys2021.cs.au.dk/"
echo $slack_msg
# notify slack channel
/home/auuser/slack-notifier.sh $slack_msg
fi
echo "Done."
#!/bin/bash
# ----- CAUTION!!! -----
# This script stops and removes the running web and server
# containers, removes their images and the persist-net
# docker network.
#
# It then reconfigures the network, download
# the images and redeploys them again.
base_url="registry.gitlab.au.dk/exsys2021/da6/hold-afstand/"
# stops docker containers
echo -n "Stopping containers..."
docker stop server >/dev/null 2>&1
docker stop web >/dev/null 2>&1
echo " Done."
# removes docker containers
echo -n "Removing containers..."
docker rm server >/dev/null 2>&1
docker rm web >/dev/null 2>&1
echo " Done."
# removes docker images
echo -n "Removing images..."
docker rmi ${base_url}server:active >/dev/null 2>&1
docker rmi ${base_url}web:active >/dev/null 2>&1
echo " Done."
# removes unused docker networks
echo -n "Removing docker network..."
docker network rm persist-net >/dev/null 2>&1
echo " Done."
# pulling the images
echo -n "Pulling latest sever image..."
docker pull ${base_url}server:latest >/dev/null 2>&1
echo " Done."
echo -n "Pulling latest web image..."
docker pull ${base_url}web:latest >/dev/null 2>&1
echo " Done."
# changes tags from latest to active
echo -n "Tagging..."
docker tag ${base_url}server:latest ${base_url}server:active >/dev/null 2>&1
docker tag ${base_url}web:latest ${base_url}web:active >/dev/null 2>&1
docker rmi ${base_url}server:latest >/dev/null 2>&1
docker rmi ${base_url}web:latest >/dev/null 2>&1
echo " Done."
# crates network
echo -n "Creates docker network..."
docker network create -d bridge persist-net --attachable >/dev/null 2>&1
echo " Done."
# spins up containers
echo -n "Spinning up containers..."
docker run --network persist-net --network-alias server --name server -d ${base_url}server:active >/dev/null 2>&1
docker run --network persist-net -p 80:80 --name web -d ${base_url}web:active >/dev/null 2>&1
echo " Done."
echo "All done!"
#!/bin/bash
# INFO: This script should be placed in auuser 's homefolder!
# sanity check
if [ "$#" == "0" ]; then
echo "The message should be passed as an argument!"
exit 1
fi
data='{"text":"'"$@"'"}'
url=$(head -n 1 slack-url)
curl -X POST -H 'Content-type: application/json' --data "$data" $url
......@@ -15,4 +15,10 @@ export default {
}
}
}
</script>
\ No newline at end of file
</script>
<style scoped lang="scss">
.block{
min-width: 250px;
}
</style>
\ No newline at end of file
......@@ -21,6 +21,7 @@ export default {
.block {
width: 100%;
height: 100%;
min-width: 150px;
text-align: left;
display: flex;
flex-direction: column;
......
......@@ -175,6 +175,7 @@ export default {
</script>
<style lang="scss" scoped>
table{
width: 100%;
position: absolute;
......@@ -291,6 +292,7 @@ export default {
}
#calendar{
min-width: 250px;
width: 100%;
height: 100%;
position: relative;
......
......@@ -40,6 +40,10 @@ export default {
</script>
<style scoped lang="scss">
.block{
min-width: 350px;
}
ul {
margin-top: 8px;
}
......
......@@ -37,6 +37,10 @@ Any assumption that the word "same" means "same or different" is wrong and canno
</script>
<style scoped lang="scss">
.block{
min-width: 250px;
}
ul {
padding: 20px;
}
......
......@@ -2,7 +2,7 @@
<BlockTemplate heading="Post">
<ul>
<li v-for="(mail, index) in mails" :key="index">
<span>{{ mail.sender }}</span>
<span style="width: 50%;">{{ mail.sender }}</span>
<span class="send-date">{{ mail.date.toLocaleDateString('da-dk').replace(/\./g, '/') }}</span>
<br/>
<a class="subject" href="/about">{{ mail.subject }}</a>
......@@ -40,8 +40,14 @@ export default {
</script>
<style scoped lang="scss">
.block{
min-width: 250px;
}
ul {
margin-top: 8px;
//display: inline-block;
}
li:nth-child(even) {
......
......@@ -355,7 +355,8 @@ export default {
display: flex;
margin-bottom: $gap;
position: relative;
min-height: 150px
&.drag * {
pointer-events: none;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment