Skip to content

Commit

Permalink
Merge pull request #1217 from stvoutsin/issue/how-to-notes
Browse files Browse the repository at this point in the history
How to markdown notes & notes on new deploy
  • Loading branch information
stvoutsin authored Oct 24, 2023
2 parents 9eec6b2 + d2b110e commit ffd5866
Show file tree
Hide file tree
Showing 2 changed files with 572 additions and 0 deletions.
218 changes: 218 additions & 0 deletions notes/instructions/live-deploy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
# Instructions for deploying a live GDMP Service

### Setup aglais.env (if it doesn't exist)

edit "${HOME:?}/aglais.env"

AGLAIS_REPO='[email protected]:wfau/aglais.git'
AGLAIS_HOME="/home/user/gdmp_repo_location"
AGLAIS_CODE="${AGLAIS_HOME:?}/"


### Check current live deploy

[user@desktop]

ssh [email protected] \
'
date
hostname
'
> iris-gaia-green-20230308-zeppelin



### Create a container to work with.

[user@desktop]

source "${HOME:?}/aglais.env"
agcolour=red
configname=zeppelin-54.86-spark-6.26.43
agproxymap=3000:3000
clientname=ansibler-${agcolour}
cloudname=iris-gaia-${agcolour}

podman run \
--rm \
--tty \
--interactive \
--name "${clientname:?}" \
--hostname "${clientname:?}" \
--publish "${agproxymap:?}" \
--env "cloudname=${cloudname:?}" \
--env "configname=${configname:?}" \
--env "SSH_AUTH_SOCK=/mnt/ssh_auth_sock" \
--volume "${SSH_AUTH_SOCK:?}:/mnt/ssh_auth_sock:rw,z" \
--volume "${HOME:?}/clouds.yaml:/etc/openstack/clouds.yaml:ro,z" \
--volume "${AGLAIS_CODE:?}/deployments:/deployments:ro,z" \
ghcr.io/wfau/atolmis/ansible-client:2022.07.25 \
bash


### Backup the notebooks onto data node.

[root@ansibler]

ssh [email protected]

sshuser=fedora
sshhost=live.gaia-dmp.uk

ssh-keyscan "${sshhost:?}" 2>/dev/null >> "${HOME}/.ssh/known_hosts"

pushd /var/local/backups
pushd notebooks

datetime=$(date '+%Y%m%d-%H%M%S')
backname="${datetime:?}-${sshhost:?}-notebooks"

mkdir "${backname}"

rsync \
--perms \
--times \
--group \
--owner \
--stats \
--progress \
--exclude '~Trash' \
--human-readable \
--checksum \
--recursive \
--rsync-path 'sudo rsync' \
"${sshuser:?}@${sshhost:?}:/home/fedora/zeppelin/notebook" \
"${backname:?}"

rsync \
--perms \
--times \
--group \
--owner \
--stats \
--progress \
--human-readable \
--checksum \
--recursive \
--rsync-path 'sudo rsync' \
"${sshuser:?}@${sshhost:?}:/home/fedora/zeppelin/conf/notebook-authorization.json" \
"${backname:?}"

if [ -L latest ]
then
rm latest
fi
ln -s "${backname:?}" latest

popd
popd

Verify the results

ls -al /var/local/backups/notebooks/
du -h -d 3 /var/local/backups/notebooks/latest/



### Deploy everything.

[root@ansibler]

time \
source /deployments/hadoop-yarn/bin/deploy.sh


### Manually validate our service

[user@dekstop]

firefox \
--new-window \
'https://iris-gaia-red.gaia-dmp.uk/'


### Import our live users.

[root@ansibler]

source /deployments/zeppelin/bin/create-user-tools.sh

import-live-users


### Run UI Tests

[user@desktop]

git clone https://github.com/stvoutsin/gaiadmp-ui-testing/

Edit settings

tests/settings.py

Install requirements

pip install -r requirements.txt
pytest


### Get the public IP address of our Zeppelin node.

[root@ansibler]

deployname=$(
yq eval \
'.aglais.status.deployment.name' \
'/opt/aglais/aglais-status.yml'
)

zeppelinid=$(
openstack \
--os-cloud "${cloudname:?}" \
server list \
--format json \
| jq -r '.[] | select(.Name == "'${deployname:?}'-zeppelin") | .ID'
)

zeppelinip=$(
openstack \
--os-cloud "${cloudname:?}" \
server show \
--format json \
"${zeppelinid:?}" \
| jq -r ".addresses | .\"${deployname}-internal-network\" | .[1]"
)
cat << EOF
Zeppelin ID [${zeppelinid:?}]
Zeppelin IP [${zeppelinip:?}]
EOF

> Zeppelin ID ..
> Zeppelin IP ..


### Update the dns entry with new IP

dmp.gaia.ac.uk -> Zeppelin IP

source /deployments/zeppelin/bin/create-user-tools.sh
ducktoken=$(getsecret 'devops.duckdns.token')
duckname=aglais-live

curl "https://www.duckdns.org/update/${duckname:?}/${ducktoken:?}/${zeppelinip:?}"

> OK


### Manually validate live URL

[user@dekstop]

firefox \
--new-window \
'https://dmp.gaia.ac.uk/'

Loading

0 comments on commit ffd5866

Please sign in to comment.