Open dreeves opened 5 years ago
I started a deploy script, but i'm not so very smart at bash scripting, so I haven't figured out how to do all the things via ssh or using bash commands or whatever. Here is what I do:
date=`date +%Y%m%d_%H%M`
server=fshr # i have named entries for each of the servers in my ssh config; fshr, germ, hop
# 1. open up the jsbrain logs in a different terminal (there's actually a
# detached screen under the beeminder account on each server that's named
# jsbrain, which is running `pm2 logs jsbrain`, so the following just connects
# to that screen):
ssc beeminder@$server jsbrain
# 2. make a fallback branch in jsbrain dir using timestamp
ssh beeminder@$server "cd /var/www/jsbrain; git branch $date"
# blist=`ssh beeminder@$server 'cd /var/www/jsbrain; git branch'`
# 3. only keep the last 8 checkpoints
ssh beeminder@$server
cd /var/www/jsbrain/
git branch # lists all the branches
git branch -D $oldestbranch
# 4. gently stop resque
ssh beeminder@$server
sudo god stop resque
# this does not actually do a gentle stop, i think we have to do something to
# our resque config or something to get it to respond gently? anyhow, so I watch
# the resque queues until they're empty, or i just go visit resque web and
# requeue anything that gets killed by this.
# 5. check that it's all quiesced
# Look at the tail of the jsbrain logs. Is it quiet now? It should be because there
# should no longer be any workers on this server sending stuff to this jsbrain instance
# 7. git pull
ssh beeminder@$server
cd /var/www/jsbrain/
git pull
# 8. cd jsbrain_server
cd jsbrain_server
# 9. npm install
npm install
# 10. reload jsbrain
pm2 reload jsbrain
# 11. restart god
sudo god start resque
# 12. look at the jsbrain logs again and see that they are starting up again and
# getting new jobs and there aren't any errors.
# 13. repeat for the other 2 servers.
Bee has a deploy script -- deploy.sh here in the beebrain repo -- for Beebrain but it needs robusted up and generalized so people besides her can actually use it.
Currently it assumes her personal aliases for the servers and probably other such junk. So it's sort of rudimentary but with minimal modification can be run by anyone with beeminder-user access to servers.
Here's how deploys happen currently:
./deploy.sh
Cognata
257
Verbata: deploy scripts, infrastructure, deploying beebrain, beebody adjacent, web hosting,