A
A
AlexRas2018-05-29 15:50:52
linux
AlexRas, 2018-05-29 15:50:52

What can be used on a VPS to quickly deploy from a git repository?

Hello.
Bitbucket has a repository with a website. On the server, you need to execute the order of commands to get the latest changes, for example:

$ git pull
$ npm run build
$ /etc/init.d/supervisor restart site

How can you get rid of writing all these commands, there are several sites, do you need to be able to update the site in one action?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
K
ky0, 2018-05-29
@ky0

Google "continious deployment".

D
Dmitry Aleksandrov, 2018-05-29
@jamakasi666

git pull && npm run build && /etc/init.d/supervisor restart site
Optionally wrap this in a script. Those. create text file with .sh extension inside write

#!/bin/sh
git pull && npm run build && /etc/init.d/supervisor restart site

Then run it with the command ./name.sh . It is advisable to give execute permission before this chmod +X name.sh
&& control statement, i.e. if git pull runs without errors, then npm run build will run, if npm run build runs without errors, then /etc/init.d/supervisor restart site will run. If at any stage the command fails, then subsequent commands will not run.

A
Alexey Cheremisin, 2018-05-29
@leahch

Try ansible. You write a script that crawls into the repository, deploys it and does everything you need: installs packages, configures users, lowers and raises services. At least put it on an empty server - if only there was access via SSH.
https://www.digitalocean.com/community/tutorials/h...
and
https://www.digitalocean.com/community/tutorials/h...

O
OnYourLips, 2018-05-29
@OnYourLips

The simplest tool for pet projects is capistrano.
It has many clones, like the Deployer mentioned above.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question