This repository has been archived by the owner on Jan 25, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 622d14e
Showing
25 changed files
with
1,731 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
PREFIX ?= /usr | ||
DESTDIR ?= | ||
BINDIR ?= $(DESTDIR)$(PREFIX)/bin | ||
LIBDIR ?= $(DESTDIR)$(PREFIX)/lib | ||
MANDIR ?= $(DESTDIR)$(PREFIX)/share/man/man1 | ||
BASHCOMP_PATH ?= $(DESTDIR)$(PREFIX)/share/bash-completion/completions | ||
|
||
DS = $(BINDIR)/ds | ||
LIB = $(LIBDIR)/ds | ||
|
||
all: install | ||
|
||
install: uninstall | ||
@install -v -d "$(LIB)/" | ||
@cp -v -r sh/* "$(LIB)/" | ||
|
||
@install -v -d "$(BINDIR)/" | ||
@mv -v "$(LIB)"/docker.sh "$(DS)" | ||
@sed -i "$(DS)" -e "s#LIBDIR=.*#LIBDIR=\"$(LIB)\"#" | ||
@chmod -c 0755 "$(DS)" | ||
|
||
@install -v -d "$(BASHCOMP_PATH)" | ||
@mv -v "$(LIB)"/bash-completion.sh "$(BASHCOMP_PATH)"/ds | ||
@chmod -c 0644 "$(BASHCOMP_PATH)"/ds | ||
|
||
@install -v -d "$(MANDIR)/" | ||
@install -v -m 0644 man/ds.1 "$(MANDIR)/ds.1" | ||
|
||
uninstall: | ||
@rm -vrf "$(DS)" "$(LIB)" "$(MANDIR)/ds.1" "$(BASHCOMP_PATH)"/ds | ||
|
||
TESTS = $(sort $(wildcard tests/t*.t)) | ||
|
||
test: $(TESTS) | ||
|
||
$(TESTS): | ||
@$@ $(DS_TEST_OPTS) | ||
|
||
clean: | ||
$(RM) -rf tests/test-results/ tests/trash\ directory.*/ | ||
|
||
.PHONY: install uninstall test clean $(TESTS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
DockerScripts | ||
============= | ||
|
||
This is a shell script framework for Docker which simplifies managing | ||
containers in a context. Each container is like a virtual machine that | ||
has an application installed inside. Each container has a base | ||
directory where the settings of the container are stored (in the file | ||
*settings.sh*). The command `ds` picks the parameters that it needs | ||
from the file *settings.sh* in the current directory. | ||
|
||
## COMMANDS | ||
|
||
* `init` *<src_dir>*, `info` | ||
|
||
Initialize a working directory by getting the file *settings.sh* | ||
from the given source directory. Show some of the current | ||
settings. | ||
|
||
* `build`, `create`, `config` | ||
|
||
Build the image, create the container, and configure the guest | ||
system inside the container. | ||
|
||
* `start`, `stop`, `restart` | ||
|
||
Start, stop and restart the container. | ||
|
||
* `shell` | ||
|
||
Get a shell on the container. | ||
|
||
* `exec` | ||
|
||
Execute a command inside the container. | ||
|
||
* `snapshot` | ||
|
||
Make a snapshot of the container. | ||
|
||
* `remove` | ||
|
||
Remove the container and the image. | ||
|
||
* `help` | ||
|
||
Display a help message. | ||
|
||
|
||
|
||
## FILES | ||
|
||
`./settings.sh` | ||
It is located in directory of the container and keeps | ||
the settings of the container and the application installed | ||
inside it. | ||
|
||
|
||
## CUSTOMIZATION | ||
|
||
The file `$SRC/ds.sh` or `./ds.sh` can be used to redefine and | ||
customize some functions, without having to touch the code of the main | ||
script. Also, custom commands can be defined for each container by | ||
adding the file `./cmd/command.sh`, which contains the function | ||
`cmd_command() { . . . }`. | ||
|
||
|
||
## INSTALLATION | ||
|
||
git clone https://github.com/docker-scripts/ds | ||
cd ds/ | ||
sudo make install | ||
ds help | ||
|
||
|
||
## USAGE | ||
|
||
Some examples of using `ds` are shown below. | ||
|
||
### Installing Moodle | ||
|
||
git clone https://github.com/docker-scripts/moodle /usr/local/src/moodle | ||
mkdir -p /var/containers/moodle1 | ||
cd /var/containers/moodle1/ | ||
ds init /usr/local/src/moodle | ||
vim settings.sh | ||
ds build | ||
ds create | ||
ds config | ||
ds shell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Ronn is a markdown-like format that can be used for man files. | ||
For more details see: | ||
- https://github.com/rtomayko/ronn | ||
- http://rtomayko.github.io/ronn/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
.\" generated with Ronn/v0.7.3 | ||
.\" http://github.com/rtomayko/ronn/tree/0.7.3 | ||
. | ||
.TH "DS" "1" "July 2017" "dashohoxha" "DockerScripts" | ||
. | ||
.SH "NAME" | ||
\fBds\fR \- Docker Scripts | ||
. | ||
.SH "SYNOPSIS" | ||
\fBds\fR \fICOMMAND\fR | ||
. | ||
.SH "DESCRIPTION" | ||
DockerScripts is a shell script framework for Docker which simplifies managing containers in a context\. Each container is like a virtual machine that has an application installed inside\. Each container has a base directory where the settings of the container are stored (in the file \fIsettings\.sh\fR)\. The command \fBds\fR picks the parameters that it needs from the file \fIsettings\.sh\fR in the current directory\. | ||
. | ||
.SH "COMMANDS" | ||
. | ||
.IP "\(bu" 4 | ||
\fBinit\fR \fI\fIsrc_dir\fR\fR, \fBinfo\fR | ||
. | ||
.IP | ||
Initialize a working directory by getting the file \fIsettings\.sh\fR from the given source directory\. Show some of the current settings\. | ||
. | ||
.IP "\(bu" 4 | ||
\fBbuild\fR, \fBcreate\fR, \fBconfig\fR | ||
. | ||
.IP | ||
Build the image, create the container, and configure the guest system inside the container\. | ||
. | ||
.IP "\(bu" 4 | ||
\fBstart\fR, \fBstop\fR, \fBrestart\fR | ||
. | ||
.IP | ||
Start, stop and restart the container\. | ||
. | ||
.IP "\(bu" 4 | ||
\fBshell\fR | ||
. | ||
.IP | ||
Get a shell on the container\. | ||
. | ||
.IP "\(bu" 4 | ||
\fBexec\fR | ||
. | ||
.IP | ||
Execute a command inside the container\. | ||
. | ||
.IP "\(bu" 4 | ||
\fBsnapshot\fR | ||
. | ||
.IP | ||
Make a snapshot of the container\. | ||
. | ||
.IP "\(bu" 4 | ||
\fBremove\fR | ||
. | ||
.IP | ||
Remove the container and the image\. | ||
. | ||
.IP "\(bu" 4 | ||
\fBhelp\fR | ||
. | ||
.IP | ||
Display a help message\. | ||
. | ||
.IP "" 0 | ||
. | ||
.SH "FILES" | ||
\fB\./settings\.sh\fR | ||
. | ||
.IP "" 4 | ||
. | ||
.nf | ||
|
||
It is located in directory of the container and keeps | ||
the settings of the container and the application installed | ||
inside it\. | ||
. | ||
.fi | ||
. | ||
.IP "" 0 | ||
. | ||
.SH "CUSTOMIZATION" | ||
The file \fB$SRC/ds\.sh\fR or \fB\./ds\.sh\fR can be used to redefine and customize some functions, without having to touch the code of the main script\. Also, custom commands can be defined for each container by adding the file \fB\./cmd/command\.sh\fR, which contains the function \fBcmd_command() { \. \. \. }\fR\. | ||
. | ||
.SH "INSTALLATION" | ||
user@laptop:~$ \fBgit clone https://github\.com/docker\-scripts/ds\fR user@laptop:~$ \fBcd ds/\fR user@laptop:~$ \fBsudo make install\fR user@laptop:~$ \fBds help\fR | ||
. | ||
.SH "USAGE" | ||
Some examples of using \fBds\fR are shown below\. | ||
. | ||
.SS "Installing Moodle" | ||
user@laptop:~# \fBgit clone https://github\.com/docker\-scripts/moodle /usr/local/src/moodle\fR user@laptop:~# \fBmkdir \-p /var/containers/moodle1\fR user@laptop:~# \fBcd /var/containers/moodle1/\fR user@laptop:~# \fBds init /usr/local/src/moodle\fR user@laptop:~# \fBvim settings\.sh\fR user@laptop:~# \fBds build\fR user@laptop:~# \fBds create\fR user@laptop:~# \fBds config\fR user@laptop:~# \fBds shell\fR | ||
. | ||
.SH "AUTHOR" | ||
Copyright (C) 2017 Dashamir Hoxha (dashohoxha@gmail\.com)\. The code is on GitHub at \fIhttps://github\.com/dashohoxha/ds\fR\. | ||
. | ||
.SH "COPYLEFT" | ||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version\. | ||
. | ||
.P | ||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE\. See the GNU General Public License for more details\. | ||
. | ||
.P | ||
You should have received a copy of the GNU General Public License along with this program\. If not, see \fIhttp://www\.gnu\.org/licenses/\fR\. |
Oops, something went wrong.