Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for AFS deployment #377

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 48 additions & 8 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,61 @@
# To run this script you must have 'aklog' written in ~/.bash_environment
# (or the environment file for whatever shell you use)
# and 'sipb' and 'athena' written in ~/.xlog (both of these files should be in your athena locker).
#!/bin/bash
# To run this script you must have *in your athena locker*:
# - 'aklog' written in ~/.bash_environment (or the environment file for whatever shell you use)
# - 'sipb' and 'athena' written in ~/.xlog.
# Otherwise, you will not have permission to access the courseroad locker,
# even if you are on courseroad-dev.
# even if you are on courseroad-dev@.

#syntax: ./deploy.sh [dev|prod] [kerberos]

# this section is for Miriam's kdo setup
if [ $SHELL = "/bin/zsh" ]; then
source ~/.zshrc
fi

# exit if anything errors
set -e

#syntax: ./deploy.sh [dev or prod] [kerberos]
npm run build-$1
if [ "$1" = "prod" ]; then
echo -n "You are about to deploy to the production site, are you sure? (y/n)? "
read answer
if [ "$answer" != "${answer#[Yy]}" ] ;then
scp -r deploy/production/.htaccess dist/* [email protected]:/mit/courseroad/web_scripts/courseroad/
if [ "$answer" != "${answer#[Yy]}" ]; then
echo "Checking for AFS on this system"
if which aklog &>/dev/null; then
echo "AFS detected, using AFS for deployment"
if which kdo &>/dev/null; then
echo "Using kdo"
kdo $2 aklog sipb
else
kinit -f -l 1h $2
aklog sipb
fi
rsync --delete --progress --checksum -r deploy/production/.htaccess dist/* /afs/sipb.mit.edu/project/courseroad/web_scripts/courseroad/
else
echo "Could not locate AFS, using SSH for deployment"
# this is what happens without any fancy setup
scp -r deploy/production/.htaccess dist/* [email protected]:/mit/courseroad/web_scripts/courseroad/
fi
else
echo cancelled
echo "Cancelled"
fi
elif [ "$1" = "dev" ]; then
echo "Checking for AFS on this system"
if which aklog &>/dev/null; then
echo "AFS detected, using AFS for deployment"
if which kdo &>/dev/null; then
echo "Using kdo"
kdo $2 aklog sipb
else
kinit -f -l 1h $2
aklog sipb
fi
rsync --delete --progress --checksum -r deploy/development/.htaccess dist/* /afs/sipb.mit.edu/project/courseroad/web_scripts/courseroad/dev/
else
echo "Could not locate AFS, using SSH for deployment"
# this is what happens without any fancy setup
scp -r deploy/development/.htaccess dist/* [email protected]:/mit/courseroad/web_scripts/courseroad/dev/
fi
else
echo "Invalid build location"
fi