-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit 'b0f8e06b995393d1b67037ac60c5b8d29c898c59' into names-an…
…d-labels * commit 'b0f8e06b995393d1b67037ac60c5b8d29c898c59': #372 Removed unnecessary execution permission grant #372 Refactored student prototype startup script #355: Refactor and fix crash loop. #356: Added explanation why we sanitise. #356: Forgot to add the prefix. #356: Added username sanitation. #361 added default prefix to username to prevent errors when only using numbers Fixed typo Fixes for deployment issues with prototype (newlines and chmod) documented in deployment-guide.md Update ExecEngineFunctions.php #354: Reverted imagepullpolicy #354: Fixed the getImageCommand added getimagecommand Added image pull policy
- Loading branch information
Showing
11 changed files
with
188 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#import shared functions | ||
source shared.sh | ||
|
||
#functions | ||
start_apache() { | ||
docker-php-entrypoint apache2-foreground & | ||
sleep 3600 | ||
} | ||
|
||
#run commands | ||
echo "Deploying to docker" | ||
|
||
#these are required for the file to pick up the variables | ||
echo "Encoded zip: $1" | ||
echo "Encoded main: $2" | ||
|
||
read_input "$1" "$2" | ||
deploy | ||
start_apache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#import shared functions | ||
source shared.sh | ||
|
||
#functions | ||
start_apache() { | ||
docker-php-entrypoint apache2-foreground | ||
} | ||
|
||
#run commands | ||
echo "Deploying to kubernetes" | ||
|
||
#these are required for the file to pick up the variables | ||
echo "Encoded zip: $1" | ||
echo "Encoded main: $2" | ||
|
||
read_input "$1" "$2" | ||
deploy | ||
start_apache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
# Exit immediately if a command exits with a non-zero status | ||
set -e | ||
|
||
kubernetes_file="deploy-kubernetes.sh" | ||
docker_file="deploy-docker.sh" | ||
|
||
# Functions | ||
deploy_kubernetes(){ | ||
if [ -z "$1" ] || [ -z "$2" ]; then | ||
echo "No arguments supplied" | ||
sleep 3600 | ||
else | ||
zip="$1" | ||
main="$2" | ||
|
||
if [ -f "$kubernetes_file" ]; then | ||
echo "Loading $kubernetes_file" | ||
source $kubernetes_file $zip $main | ||
else | ||
echo "Could't find file at $kubernetes_file" | ||
fi | ||
|
||
fi | ||
} | ||
|
||
deploy_docker(){ | ||
read -r line | ||
|
||
if [ -z "$line" ]; then | ||
echo "Line is empty" | ||
else | ||
# Split the line into zip and main | ||
zip="${line%% *}" # Everything before the first space | ||
main="${line#* }" # Everything after the first space | ||
|
||
if [ -f "$docker_file" ]; then | ||
echo "Loading $docker_file" | ||
|
||
source $docker_file $zip $main | ||
else | ||
echo "Could't find file at $docker_file" | ||
fi | ||
fi | ||
} | ||
|
||
# Code run on startup | ||
if [[ -n $RAP_DEPLOYMENT && $RAP_DEPLOYMENT == "Kubernetes" ]]; then | ||
echo "Target is kubernetes" | ||
deploy_kubernetes "$1" "$2" | ||
else | ||
echo "Target is docker" | ||
deploy_docker "$1" "$2" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
outzip="/out.zip" | ||
outfolder="/out" | ||
|
||
read_input(){ | ||
echo "Reading input" | ||
|
||
echo "$1" | base64 -d > $outzip | ||
|
||
main="$2" | ||
} | ||
|
||
unzip_content(){ | ||
echo "Unzipping zip: $outzip to folder: $outfolder" | ||
|
||
unzip $outzip -d $outfolder | ||
} | ||
|
||
set_entry(){ | ||
echo "Decoding entry name" | ||
|
||
entry=$(echo -n $main | base64 -d) | ||
} | ||
|
||
generate_prototype() { | ||
entrypath="$outfolder/$entry" | ||
|
||
echo "Generating prototype from path: $entrypath" | ||
|
||
ampersand proto "$entrypath" --proto-dir=/var/www --verbose | ||
} | ||
|
||
set_permissions() { | ||
echo "Setting permissions" | ||
|
||
chown -R www-data:www-data /var/www/data /var/www/generics | ||
} | ||
|
||
deploy(){ | ||
unzip_content | ||
set_entry | ||
generate_prototype | ||
set_permissions | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters