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

Deployments should be triggered from ol-home0 #4318

Closed
4 of 6 tasks
cclauss opened this issue Dec 21, 2020 · 4 comments
Closed
4 of 6 tasks

Deployments should be triggered from ol-home0 #4318

cclauss opened this issue Dec 21, 2020 · 4 comments
Assignees
Labels
Lead: @cclauss Issues overseen by Chris (Python3 & Dev-ops lead 2019-2021) [managed] Needs: Triage This issue needs triage. The team needs to decide who should own it, what to do, by when. [managed]
Projects

Comments

@cclauss
Copy link
Collaborator

cclauss commented Dec 21, 2020

A subtask of #4060

We need to automate the Docker/Python3-based deployment process on ol-home0. We would like to continue using fabfiles for this work but we must shift from process-based deployments to docker-based deployments. We intend to run these services:

When we do a new deployment, we will need the fabfile to:

  1. Checkout the four repos script below or will fabfile.rsync_repo() work as is?:
    1. olsystem
    2. openlibrary
    3. infogami
    4. bookserver-utils (only needed on Web nodes)
  2. Build the Docker image and do docker save
  3. Run rsync to copy the image to all hosts
  4. docker load and docker up on each of the machines
    • Semi-automatic with commands

Describe the problem that you'd like solved

Proposal & Constraints

Additional context

Stakeholders

@cclauss cclauss added Needs: Triage This issue needs triage. The team needs to decide who should own it, what to do, by when. [managed] Lead: @cclauss Issues overseen by Chris (Python3 & Dev-ops lead 2019-2021) [managed] labels Dec 21, 2020
@cclauss cclauss added this to the Active Sprint milestone Dec 21, 2020
@cclauss cclauss added this to In progress in Python3 Dec 22, 2020
@cclauss
Copy link
Collaborator Author

cclauss commented Jan 3, 2021

% cat distribute_docker_payload.sh # on ol-home0

#!/bin/bash

FILENAME=${1:-"payload.txt.gz"}

if [[ ! -f $FILENAME ]]; then
    echo "$FILENAME does not exist."
    exit 1
fi
echo "rsyncing $FILENAME to multiple hosts..."

REMOTE_HOSTS="ol-covers0 ol-web1 ol-web2"
for REMOTE_HOST in $REMOTE_HOSTS
do
    echo "Starting rsync to $REMOTE_HOST..."
    rsync -a --delete --no-owner --no-group --verbose $FILENAME "$REMOTE_HOST:/home/cclauss/"
    echo "Finished rsync to $REMOTE_HOST..."
done

@cdrini cdrini modified the milestones: Active Sprint, Next (proposed) Jan 4, 2021
@cclauss
Copy link
Collaborator Author

cclauss commented Jan 5, 2021

% cat scripts/update_ol_repos.sh

#!/bin/bash

# This deployment script is used to update the core repos on an ol-server node.
# The core Open Library repos are:
# 1. https://github.com/internetarchive/olsystem
# 2. https://git.archive.org/jake/booklending_utils
# 3. https://github.com/internetarchive/openlibrary
# 4. https://github.com/internetarchive/infogami

# This script takes a few environment variables:
# CAUTION: To git clone olsystem, environment variables must be set...
# Set $GITHUB_USERNAME or $USER will be used.
# Set $GITHUB_TOKEN or this script will halt.
if [[ -z ${GITHUB_TOKEN} ]]; then
    echo "FATAL: Can not git clone olsystem" ;
    exit 1 ;
fi

cd /opt/olsystem                    && sudo git pull origin master
cd /opt/booklending_utils           && sudo git pull origin master
cd /opt/openlibrary                 && sudo git pull origin master
cd /opt/openlibrary/vendor/infogami && sudo git pull origin master
cd /opt/openlibrary

@cclauss
Copy link
Collaborator Author

cclauss commented Jan 5, 2021

Does fabfile.rsync_repo() work as is? Or will we need a script like the one above that we run on each node?

@cdrini cdrini changed the title Need a fabfile-based deployment script for ol-home0 Deployments should be triggered from ol-home0 Jan 8, 2021
@cclauss
Copy link
Collaborator Author

cclauss commented Jan 15, 2021

Closing in favor of #4423 because we have too many tracking issues.

@cclauss cclauss closed this as completed Jan 15, 2021
@cclauss cclauss moved this from In progress to Done in Python3 Jan 21, 2021
@mekarpeles mekarpeles removed this from the Next (proposed) milestone Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Lead: @cclauss Issues overseen by Chris (Python3 & Dev-ops lead 2019-2021) [managed] Needs: Triage This issue needs triage. The team needs to decide who should own it, what to do, by when. [managed]
Projects
No open projects
Python3
  
Done
Development

No branches or pull requests

3 participants