V
V
Vladimir Chernyshev2013-03-08 00:00:22
linux
Vladimir Chernyshev, 2013-03-08 00:00:22

Where and how to put your scripts and how best to store them?

Not for self-interest, but only by the will of the wife of the customers who sent me, who do not have money for admins, I have to not only develop, but also administer vds for their projects that I am working on. I am using Ubuntu Server. There are several bash/python/php scripts for the server (creating nginx+php-fpm virtual hosts and users for them, backups, log analysis and other little things). some scripts must be run as root (via sudo), some from the current user (each virthost has its own user and group). How to organize all this, preferably with some kind of central repository (known, free), from which it would be possible to deploy a familiar environment on a new server, even if the old and personal desktop were not available?
As I see it: scripts are developed locally under the control of git or hg (sources are hosted on github or bitbacket), then deb packages are formed (essentially from a single file), they are uploaded to launchpad (it seems to be the only popular free hosting where you can raise a deb repository without any problems), the turnip address is added to the source-list, and then the scripts are placed via apt-get in /usr/local/bin/<scriptname.sh> ( so that they are immediately available via path), if necessary, directories are created in /usr/local/{lib,share,etc}. I get that on any machine (with Ubuntu for sure, with other Debian-likes, probably, and the rest are not particularly interested), I can deploy the familiar environment. The disadvantage is that the packages, and in the case of github, the source codes, are available in the public (and everyone can laugh at them :)
Or am I making my life too complicated and usually it's all easier to solve? Or separate remarks to my scenario are? Maybe you need to do without local, since I install it through apt? Maybe something else?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
N
Nikolai Vasilchuk, 2013-03-08
@Anonym

git clone <repo>
git checkout <branch>
sudo ./install.sh

Something like this. Why bother with deb packages and stuff? Write one script, get a git repository.

Z
z0rc, 2013-03-08
@z0rc

Under all this, puppet asks. But you will have to keep its server yourself (at the same time, it will be possible to organize repositories for code and packages on it).

V
Vyacheslav Slinko, 2013-03-08
@KeepYourMind

I am using chef.
He is very cool.
If you delve into it, then issues with setting up servers will be resolved quickly.
And I store the chef settings on github.

E
egorinsk, 2013-03-08
@egorinsk

> Where and how to put your scripts
/usr/local/bin
/usr/local specifically for your scripts and intended. If you do not want to put them in public repositories, you need to raise your own (although if these are simple scripts, maybe it's easier to unpack them from a tar archive?)

F
FanKiLL, 2013-03-08
@FanKiLL

You can also keep private repositories on bitbucket, there is a section where you can add server keys for deployment. So that the server can ssh from the repository.
If you do not want to install scripts in local, you can ~/.bash_aliaseswrite aliases directly to the folder with the cloned repository.
For example:

alias yourComandName='python /home/User/Repos/scriptName.py'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question