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

Deploy script for Beebrain #44

Open
2 tasks
dreeves opened this issue Jan 12, 2019 · 1 comment
Open
2 tasks

Deploy script for Beebrain #44

dreeves opened this issue Jan 12, 2019 · 1 comment
Assignees
Labels
INF Infra, not user-visible PEA Easy-peasy RFE Request For Enhancement

Comments

@dreeves
Copy link
Member

dreeves commented Jan 12, 2019

Desiderata

Preview Give feedback

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:

  1. Danny or Uluc (or an open source contributor!) says "check out the new hotness in the beebrain repo"
  2. Danny uses Automon to convince himself it doesn't break things
  3. Danny updates the version number at the top of package.json and merges/pushes to master
  4. Danny asks Bee to deploy what's in the master branch of the beebrain (aka road) repo to production
  5. Bee runs ./deploy.sh
  6. Danny does "import from GitHub" on road.glitch.me and occasionally road-staging.glitch.me

Cognata

Verbata: deploy scripts, infrastructure, deploying beebrain, beebody adjacent, web hosting,

@dreeves dreeves added INF Infra, not user-visible RFE Request For Enhancement labels May 30, 2019
@dreeves dreeves added the PEA Easy-peasy label Aug 9, 2020
@bsoule
Copy link
Member

bsoule commented Oct 26, 2020

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.

@dreeves dreeves added the ADO Question / what to Actually Do / much ado... label Jun 5, 2021
@dreeves dreeves removed the ADO Question / what to Actually Do / much ado... label Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
INF Infra, not user-visible PEA Easy-peasy RFE Request For Enhancement
Projects
None yet
Development

No branches or pull requests

2 participants