aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMhd Sulhan <ms@kilabit.info>2016-01-14 11:37:11 +0700
committerMhd Sulhan <ms@kilabit.info>2016-01-14 11:37:11 +0700
commit37aa1552a9bb1519f9425ed47b7d9cd92fe3bef0 (patch)
treec4d7e556b63ca34a13f2e64fcae77c965b7aeea5
parent24fad7604c0732b6c303655bade0322733ef0e34 (diff)
downloadarch-docker-37aa1552a9bb1519f9425ed47b7d9cd92fe3bef0.tar.xz
Add new image: mongodb.
l---------arch-base-mongodb/00_create_rootfs.sh1
l---------arch-base-mongodb/01_create_image.sh1
l---------arch-base-mongodb/02_clean.sh1
-rwxr-xr-xarch-base-mongodb/bootstrap_rootfs.sh6
-rwxr-xr-xarch-base-mongodb/init.sh4
-rw-r--r--arch-base-mongodb/mongodb.conf16
-rwxr-xr-xarch-base-mongodb/run.sh5
-rwxr-xr-xarch-base-mongodb/vars.sh43
8 files changed, 77 insertions, 0 deletions
diff --git a/arch-base-mongodb/00_create_rootfs.sh b/arch-base-mongodb/00_create_rootfs.sh
new file mode 120000
index 0000000..54a9807
--- /dev/null
+++ b/arch-base-mongodb/00_create_rootfs.sh
@@ -0,0 +1 @@
+../scripts/create_rootfs.sh \ No newline at end of file
diff --git a/arch-base-mongodb/01_create_image.sh b/arch-base-mongodb/01_create_image.sh
new file mode 120000
index 0000000..ec69652
--- /dev/null
+++ b/arch-base-mongodb/01_create_image.sh
@@ -0,0 +1 @@
+../scripts/create_image.sh \ No newline at end of file
diff --git a/arch-base-mongodb/02_clean.sh b/arch-base-mongodb/02_clean.sh
new file mode 120000
index 0000000..1e93f10
--- /dev/null
+++ b/arch-base-mongodb/02_clean.sh
@@ -0,0 +1 @@
+../scripts/clean.sh \ No newline at end of file
diff --git a/arch-base-mongodb/bootstrap_rootfs.sh b/arch-base-mongodb/bootstrap_rootfs.sh
new file mode 100755
index 0000000..e625f74
--- /dev/null
+++ b/arch-base-mongodb/bootstrap_rootfs.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+## Run any program here.
+echo ">>> bootstraping ..."
+mkdir -p /data/db
+chown mongodb:daemon /data/db
diff --git a/arch-base-mongodb/init.sh b/arch-base-mongodb/init.sh
new file mode 100755
index 0000000..a23bd1d
--- /dev/null
+++ b/arch-base-mongodb/init.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+## Run a program here when docker image is running.
+mongod -f /etc/mongodb.conf
diff --git a/arch-base-mongodb/mongodb.conf b/arch-base-mongodb/mongodb.conf
new file mode 100644
index 0000000..beeaa96
--- /dev/null
+++ b/arch-base-mongodb/mongodb.conf
@@ -0,0 +1,16 @@
+
+systemLog:
+ destination: file
+ path: /var/log/mongodb/mongod.log
+ logAppend: true
+ quiet: true
+storage:
+ dbPath: /var/lib/mongodb
+ directoryPerDB: true
+ journal:
+ enabled: true
+processManagement:
+ fork: true
+net:
+ bindIp: "0.0.0.0"
+ port: 27017
diff --git a/arch-base-mongodb/run.sh b/arch-base-mongodb/run.sh
new file mode 100755
index 0000000..a29b6fd
--- /dev/null
+++ b/arch-base-mongodb/run.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+docker run --net=host --rm \
+ -v $PWD/data.mongodb:/data/db \
+ -it sulhan/arch-mongodb
diff --git a/arch-base-mongodb/vars.sh b/arch-base-mongodb/vars.sh
new file mode 100755
index 0000000..c5bb8cc
--- /dev/null
+++ b/arch-base-mongodb/vars.sh
@@ -0,0 +1,43 @@
+#!/bin/zsh
+
+## Get current directory.
+THISD=${0:a:h}
+
+## The name of docker image.
+IMAGE_NAME="sulhan/arch-mongodb"
+
+##
+## List of arguments to be passed when creating images
+## Example:
+## IMAGE_ARGS=(-c="VOLUME /var/lib/postgres" -c="EXPOSE 5432")
+##
+IMAGE_ARGS=(-c="VOLUME /data/db" -c="EXPOSE 27017" -c="CMD /init.sh")
+
+## The size of rootfs in memory.
+## Remember that we use tmpfs to speedup installation and copying.
+## This is the default size, some bootstraping (i.e. nodejs) need more
+## size (~900M).
+ROOTFS_SIZE=600M
+
+## List of packages to be installed.
+PKGS=(binutils coreutils file findutils gzip sed shadow)
+
+## List of packages to be installed after PKGS.
+PKGS_ADD=(mongodb)
+
+## List of packages to be removed after creating chroot.
+PKGS_REMOVED=(binutils bzip2 db file findutils gdbm gzip less linux-api-header
+ pcre perl sed)
+
+## List of files that will be copied from current directory to rootfs
+## The init.sh file is used to run the image.
+## Format: source destination.
+FILES+=("${THISD}/init.sh" "${ROOTFS}/")
+FILES+=("${THISD}/bootstrap_rootfs.sh" "${ROOTFS}/")
+FILES+=("${THISD}/mongodb.conf" "${ROOTFS}/etc/")
+
+## List of script that will be running on rootfs after package has been
+## installed.
+## The script path is relative to rootfs.
+## Do not use the name bootstrap.sh because it was preserved for main script.
+BOOTSTRAP_S+=("/bootstrap_rootfs.sh")