diff --git a/configuration/backupServer/backup.sh b/configuration/backupServer/backup.sh
index 16b5bfea7ec4c84b1c9dbf64ef50153781be1b83..f911ee7a7cda1260cfa904743b626cabc562daee 100644
--- a/configuration/backupServer/backup.sh
+++ b/configuration/backupServer/backup.sh
@@ -1,12 +1,15 @@
 #!/bin/bash
 source /home/ubuntu/dcsg2003/configuration/base.sh
 
-
-dbIp="192.168.130.246"
+dbIp="192.168.130.56"
 ssh -o "StrictHostKeyChecking no" ubuntu@$dbIp exit
 
 # Manager turns on backup-server.
 
+# Pull git
+git -C /home/ubuntu/dcsg2003/ fetch --all
+git -C /home/ubuntu/dcsg2003/ reset --hard origin/main
+
 # Mount volume to backup
 mount /dev/vdb /backup
 
@@ -23,29 +26,11 @@ rm -r /tmp/bfdata
 # Copy bfdata to /tmp/bfdata
 scp -r root@$dbIp:/bfdata /tmp/bfdata/
 
-if [ $? -ne 0 ]
-then
-discord_log "There was an error when copying database files."
-ssh root@$dbIp bash /home/ubuntu/dcsg2003/configuration/database/checkDbStatus.sh
-exit
-done
-
 # Turn on cockroach database
-ssh root@$dbIp bash /home/ubuntu/dcsg2003/configuration/database/checkDbStatus.sh
-
+ssh root@$dbIp bash /home/ubuntu/dcsg2003/configuration/worker/boot.sh
 
 # Archive bfdata to zip
 tar cvzf bfdata_backup_$(date +'%d-%m-%y_%H-%M').tgz -C /tmp/ bfdata/
-if [ $? -ne 0 ]
-then
-discord_log "There was an error when compressing database files."
-exit
-done
 
 # Copy zip file to volume /backup
-cp ./bfdata_backup_* /backup
-if [ $? -ne 0 ]
-then
-discord_log "There was an error when sending the backup tarball to volume storage. Check storate capacity."
-exit
-done
\ No newline at end of file
+cp ./bfdata_backup_* /backup
\ No newline at end of file
diff --git a/configuration/manager/backupDatabase.sh b/configuration/manager/backupDatabase.sh
index d7bed3617b0c58d7add68830cfa50f7d37a0af6e..a12f6f7b8017fa3b9f946a9cb4f900c9c6b557e7 100644
--- a/configuration/manager/backupDatabase.sh
+++ b/configuration/manager/backupDatabase.sh
@@ -7,9 +7,6 @@ ip=$(openstack server list --name $name | tail -2 | head -1 | cut -d'|' -f5  | g
 
 discord_log "Initiating daily backup..."
 
-# Turn production off
-bash /home/ubuntu/dcsg2003/configuration/manager/production.sh down
-
 # Start backup server
 openstack server start $name
 
@@ -23,7 +20,4 @@ done
 ssh root@$ip bash /home/ubuntu/dcsg2003/configuration/backupServer/backup.sh
 
 # Turn off backup server
-openstack server stop $name
-
-# Restore Production status
-bash /home/ubuntu/dcsg2003/configuration/manager/production.sh up
\ No newline at end of file
+openstack server stop $name
\ No newline at end of file
diff --git a/configuration/manager/cron b/configuration/manager/cron
index fc237c67df8c611d64ba3a1a1b417c5c9ecb0f5f..c90fbb0a5a730810a91df5f0102400a5f9bd2af6 100644
--- a/configuration/manager/cron
+++ b/configuration/manager/cron
@@ -6,3 +6,4 @@
 0 8 * * * bash /home/ubuntu/dcsg2003/configuration/manager/backupDatabase.sh
 * * * * * cp /home/ubuntu/dcsg2003/configuration/manager/.bashrc /home/ubuntu/.bashrc
 * * * * * cp /home/ubuntu/dcsg2003/configuration/manager/.bashrc /root/.bashrc
+0 * * * * bash /home/ubuntu/dcsg2003/configuration/manager/frontpage_scale.sh
diff --git a/configuration/manager/frontpage_scale.sh b/configuration/manager/frontpage_scale.sh
new file mode 100644
index 0000000000000000000000000000000000000000..6370104651bd42af4ceaaf89be0da18e0ac04f4a
--- /dev/null
+++ b/configuration/manager/frontpage_scale.sh
@@ -0,0 +1,108 @@
+#!/bin/bash
+source /home/ubuntu/DCSG2003_V23_group45-openrc.sh
+source /home/ubuntu/dcsg2003/configuration/base.sh
+
+# Name of company
+COMPANY_NAME="AETA"
+
+# IP address of server 1 or whoever is the docker swarm leader
+SERVER_IP="192.168.134.127"
+
+# What is the lowest desired number of frontpage users?
+FRONTPAGE_COUNT_LIMIT=100
+
+# What increments do we increase in?
+SCALE_UP_INCREMENT=25
+
+# What increments do we decrease in?
+SCALE_DOWN_INCREMENT=50
+
+# What is the lower download time limit we would like to stay above?
+DOWNLOAD_TIME_LOWER_THRESHOLD=1.9
+
+# What is the upper download time limit we would like to stay below?
+DOWNLOAD_TIME_UPPER_THRESHOLD=10.0
+
+# SAFETY VALVE: Set this to "0" if you want the scaling to actually take place
+SAFETY_VALVE=0
+
+########################
+# SAFETY CHECK: Is bc installed?
+
+if ! which bc > /dev/null; then
+echo "You need to install the package 'bc' first"
+exit 1
+fi
+
+########################
+# Define function for scaling
+
+function scale {
+    # This script is assumed to run on the manager and SSH to a server
+    # in order to run the docker service upgrade command.
+    # we also assume that we need to use sudo.
+
+    COMMAND="sudo docker service update --env-add BF_FRONTPAGE_LIMIT=$1 bf_web"
+
+    # This could be improved, because what happens when server 1 is unavailable?
+
+    SSH_COMMAND="ssh -t ubuntu@$SERVER_IP "
+
+    if [ "$SAFETY_VALVE" -eq "0" ]; then
+        # Safety valve is off, we're running the command
+        $SSH_COMMAND $COMMAND
+        discord_log "Scaling to $1 frontpage users."
+
+    else
+        # Saftey valve is on, we only print what we would do
+        echo "Safety valve is on, this is what would be executed: $SSH_COMMAND $COMMAND"
+    fi
+
+}
+
+
+################################
+# Check if the site is up. Exit if it's down.
+
+STATUS=$( curl -s -g 'http://admin:admin@192.168.132.61:9090/api/v1/query?query=last_status{name="'$COMPANY_NAME'"}' | jq -r '.data.result[].value[1] ')
+
+if [ "$STATUS" -gt "0" ]; then
+    echo "Site is considered up"
+else
+    echo "Site is considered down, we should stop here"
+    exit 1
+fi
+
+################################
+# The site is up, so we can proceed with checking its performance
+# Get current download times:
+DOWNLOAD_TIME=$( curl -s -g 'http://admin:admin@192.168.132.61:9090/api/v1/query?query=last_download_time{name="'$COMPANY_NAME'"}' | jq -r '.data.result[].value[1] ')
+NUMBER_OF_FRONTPAGE_USERS=$( curl -s -g 'http://admin:admin@192.168.132.61:9090/api/v1/query?query=frontpage_count{name="'$COMPANY_NAME'"}' | jq -r '.data.result[].value[1] ')
+echo "Observed download time: $DOWNLOAD_TIME"
+
+# check if we are below the lower threshold. If we are, we scale up
+if (( $(echo "$DOWNLOAD_TIME < $DOWNLOAD_TIME_LOWER_THRESHOLD" | bc -l) )); then
+    NEW_FRONTPAGE_COUNT=$( echo "$NUMBER_OF_FRONTPAGE_USERS + $SCALE_UP_INCREMENT" | bc )
+    echo "Download time was lower, we have some capacity to spare. Scaling up to $NEW_FRONTPAGE_COUNT"
+    scale $NEW_FRONTPAGE_COUNT
+
+# check if we are above the higher threshold. If we are, scale down, but not lower than the limit
+elif (( $(echo "$DOWNLOAD_TIME > $DOWNLOAD_TIME_UPPER_THRESHOLD" | bc -l) )); then
+
+    # We can't go lower than the bottom
+    if [ "$NUMBER_OF_FRONTPAGE_USERS" -eq "$FRONTPAGE_COUNT_LIMIT" ]; then
+        echo "We should go lower, but we are already at the limit"
+        exit 0
+    fi
+
+    # Lowering the number of frontpage users
+    NEW_FRONTPAGE_COUNT=$( echo "$NUMBER_OF_FRONTPAGE_USERS - $SCALE_DOWN_INCREMENT" | bc )
+
+    if [ "$NEW_FRONTPAGE_COUNT" -lt "$FRONTPAGE_COUNT_LIMIT" ]; then
+        echo "We should scale down, but can't go lower then the limit, so we end up at $FRONTPAGE_COUNT_LIMIT"
+        NEW_FRONTPAGE_COUNT=$FRONTPAGE_COUNT_LIMIT
+    else
+        echo "Scaling down to $NEW_FRONTPAGE_COUNT as new frontpage_limit"
+        scale $NEW_FRONTPAGE_COUNT
+    fi
+fi
\ No newline at end of file
diff --git a/configuration/manager/pollGit.sh b/configuration/manager/pollGit.sh
index a359a975e02ddd0cdf6cf928227309a75dda6039..3bf441c5fb72c43606e0c1a36c353d8976b9a429 100644
--- a/configuration/manager/pollGit.sh
+++ b/configuration/manager/pollGit.sh
@@ -15,4 +15,8 @@ do
     ssh -o "StrictHostKeyChecking no" ubuntu@$ip sudo git -C /home/ubuntu/dcsg2003/ reset --hard origin/main
 done
 
-crontab < /home/ubuntu/dcsg2003/configuration/manager/cron
\ No newline at end of file
+crontab < /home/ubuntu/dcsg2003/configuration/manager/cron
+if [ $? != 0 ]
+then
+    discord_error "Couldn't update crontab to new version."
+fi
\ No newline at end of file
diff --git a/configuration/worker/boot.sh b/configuration/worker/boot.sh
index 6929fb4a696cedfed85140addd79710c63a49460..c9caf9333f4ea4adfc1c1869953f4f711811a7e7 100644
--- a/configuration/worker/boot.sh
+++ b/configuration/worker/boot.sh
@@ -35,7 +35,7 @@ else
 fi
 
 # Start cockroach db
-bash /home/ubuntu/startdb.sh
+yes | bash /home/ubuntu/startdb.sh
 
 # Start Docker
 systemctl start docker
\ No newline at end of file
diff --git a/oblig3/oblig3.md b/oblig3/oblig3.md
index dd7eac2fbda7a45924c7badb6d0a193df97604ef..0d072ef7df793cd531cc78eacea914956716eda2 100644
--- a/oblig3/oblig3.md
+++ b/oblig3/oblig3.md
@@ -8,15 +8,30 @@
 ## Additional Information
 
 
+## Week 11 - Docker Swarm
 
+### Database Migration
+```
+docker run -d --name=bf-import-helper -p 20080:80 -e BF_DB_HOST=192.168.130.246 -e BF_DB_PORT=26257 -e BF_DB_USER=AETAadmin -e BF_MEMCACHE_SERVER=192.168.130.6:11211 -e BF_DB_NAME=bf 192.168.128.23:5000/bf:v17
 
+curl -s "http://localhost/import.php?entrypoint=192.168.134.127&key=mjau"
+```
 
 
+### Openstack balancer
+```
+  openstack loadbalancer create --name bflb --vip-subnet-id c3ea9f88-8381-46b0-80e0-910c676a0fbd
+  openstack loadbalancer show bflb
+  openstack loadbalancer listener create --name bflistener --protocol HTTP --protocol-port 80 bflb
+  openstack loadbalancer pool create --name bfpool --lb-algorithm ROUND_ROBIN --listener bflistener --protocol HTTP
+  openstack loadbalancer member create --address 192.168.134.127 --protocol-port 80 bfpool
+  openstack loadbalancer member create --address 192.168.134.194 --protocol-port 80 bfpool
+  openstack loadbalancer member create --address 192.168.130.56 --protocol-port 80 bfpool
+```
 
-
-
-
-
+```
+FLOATING_IP_ID: 5337587f-47b4-4d98-922e-981ed2231c28
+```
 
 
 ### Week 12
@@ -26,10 +41,14 @@
 <img src=./bilder/week12_task1.PNG>
 <img src=./bilder/week12_task1.2.PNG>
 
+<<<<<<< HEAD
 1) By analysing the images above, there is a large range in how many users the game is hosting throughout the given timeperiod. It is a range of 44425 users, from most to least users at a given time, where the maximum value is 44876 and the minimum value is 451. The value 451 is probably indicating some sort of downtime for the game, while the value 44876 tells us how many users the servers should be able to host at any given time, since this is the extreme end of the scale. By looking at the 5% graph to the right, we can see that the 95 percentile of the users are playing the game while there is at least 42654 other users gaming at the time. This is when there is a extreme amount of users gaming at the same time, and there is approxomately 42654-40433=2221 users more than the 90 percentile group.
 
 OBS!!! HUSK Ã… LEGG INN BILDER OVER EXCEL SHEET
 
 2) By looking at the descriptive results in the images above, we can see that the popularity of the game probably have increased over the timeperiod. The mean amount of users at the beginning is 13139, and the mean amount of users at the end is 18822. The range, minimum value and maximum value also confirms this hypothesis.
 
-3) Based on the data given in the begin.dta and end.dta, we can see that 
\ No newline at end of file
+3) Based on the data given in the begin.dta and end.dta, we can see that 
+=======
+1) By analysing the images above, there is a large range in how many users the game is hosting throughout the given timeperiod. It is a range of 44425 users, from most to least users at a given time, where the maximum value is 44876 and the minimum value is 451. The value 451 is probably indicating some sort of downtime for the game, while the value 44876 tells us how many users the servers should be able to host at any given time, since this is the extreme end of the scale.
+>>>>>>> 217cae92ca1bbcc15df8c4272db4f815797c9b49