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

Automation of deployment #917

Closed
chrismedrela opened this issue Jul 22, 2016 · 14 comments
Closed

Automation of deployment #917

chrismedrela opened this issue Jul 22, 2016 · 14 comments

Comments

@chrismedrela
Copy link
Contributor

chrismedrela commented Jul 22, 2016

So far, every time a contributor wants to deploy something to amy-dev, that person needs to hassle @pbanaszkiewicz and wait while he makes deploy. That has three drawbacks:

  1. It's a lot of workload on Piotr.
  2. When Piotr is unavailable, we cannot deploy.
  3. The contributor needs to wait until Piotr checks mailbox.

I'm wondering if we could automate this process. This could looks like this: nginx could be configured to execute deployment script when we hit the server with specific HTTP request (let's say amy-dev.software-carpentry.org/deploy). In that case, the script pulls amy-dev branch and deploys it. The output of the script could be returned as the HTTP response, so if the deployment fails, you can tell why.

@gvwilson, @narayanaditya95, @pbanaszkiewicz, any opinions?

@chrismedrela chrismedrela changed the title Amy-dev deployment Automation of amy-dev deployment Jul 22, 2016
@aditnryn
Copy link

We might also want to deploy a branch from a fork.
I dont think an automated solution would be as simple as a hitting an endpoint.

@chrismedrela
Copy link
Contributor Author

@narayanaditya95 We can pass repo URL in the HTTP request to the endpoint. Why do you think that it's not as easy as hitting an endpoint?

@pbanaszkiewicz
Copy link
Contributor

I'm wondering if we could automate this process. This could looks like this…

Or I can give you both credentials and instructions how to proceed when deploying on amy-dev. :-)

@gvwilson
Copy link
Contributor

gvwilson commented Jul 29, 2016 via email

@chrismedrela
Copy link
Contributor Author

Or I can give you both credentials and instructions how to proceed when deploying on amy-dev. :-)

Yeah, why didn't I thought about it earlier. :)

The deployment script proposed by @gvwilson would be very useful. It'd be very nice if I could just execute something like that:

ssh amy-dev deploy https://github.com/swcarpentry/amy/tree/develop

@pbanaszkiewicz
Copy link
Contributor

Unfortunately it'll take some time for me to do such a script because the amy-dev is running Django dev server on tmux session -- the easiest thing to set up.

@chrismedrela
Copy link
Contributor Author

@pbanaszkiewicz, could you write down instructions how to deploy and give me credentials to login into AMY? Once you do this, I can write the script. Or we can even defer writing the script if the deployment procedure is easy and quick enough.

@chrismedrela
Copy link
Contributor Author

@pbanaszkiewicz, could you give me credentials to amy-dev and a quick&dirty instruction on deployment? In next few days, I'll probably do a demo of what I've done this summer, and that's a chance for me to learn the deployment process.

@pbanaszkiewicz
Copy link
Contributor

@chrismedrela @narayanaditya95 please email me your SSH public keys and I'll add you to the server.

The update procedure:

$ ssh address
$ tmux attach  # or just "tmux" if it's not running

# tmux is session manager, it should run in two panes side by side, one pane has normal terminal prompt and the other one has devserver running
# use ctrl+b,o (that means press ctrl+b, release, then press o)  to switch active pane
# use ctrl+b,d to deactivate tmux (close & run in background)
# use ctrl+b," to create a new vertical pane (if you accidentally closed one)
# use ctrl+b,% to create a new horizontal pane
  1. Update code
    1. switch to develop
    2. make a new branch, switch to it
    3. pull the code
  2. install updates if necessary make upgrade
  3. prepare database - it is preferred to make a dev database from scratch and add an admin user and then add users, but you may want to only run migrations - depends on you
    1. make dev_database to remove database and recreate
    2. make superuser to create admin:admin superuser account
  4. make sure the server is running in the server pane (it may be stuck OR some requests make it change font to some scribble)
    1. recreate pane if necessary (switch to it, ctrl+d to close running server, ctrl+d to close the pane, ctrl+b," to open a new pane)
    2. run server cd ~/amy_site and ./run_server.sh

I hope I didn't forget anything.

@chrismedrela
Copy link
Contributor Author

@pbanaszkiewicz please ping me when we can deploy to amy-dev.

@pbanaszkiewicz
Copy link
Contributor

You can now (I'm still waiting for @narayanaditya95 public key).

@pbanaszkiewicz pbanaszkiewicz added this to the v2.1 milestone Aug 12, 2018
@pbanaszkiewicz
Copy link
Contributor

amy-dev server was shut down, but with #1164 and #1167 and #1203 scheduled for this release, I'd like to revisit the idea of continuous deployment of main AMY.

@pbanaszkiewicz pbanaszkiewicz changed the title Automation of amy-dev deployment Automation of deployment Aug 12, 2018
@pbanaszkiewicz pbanaszkiewicz modified the milestones: v2.1, v2.2 Sep 4, 2018
@pbanaszkiewicz pbanaszkiewicz modified the milestones: v2.2, v2.3 Oct 8, 2018
@pbanaszkiewicz
Copy link
Contributor

I'd like to consider using a software-automation tool like Ansible for easy software deployment.

@pbanaszkiewicz pbanaszkiewicz modified the milestones: v2.4, v2.4.1 Jan 2, 2019
@pbanaszkiewicz
Copy link
Contributor

pbanaszkiewicz commented Jan 20, 2019

The Ansible playbooks were created for AMY, and will be used for future server deployment over at https://amy.carpentries.org/.

EDIT: the playbooks are hosted at sysadmins repository, not available publicly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants