Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OERu
wenotes-docker
Commits
5674fe23
Commit
5674fe23
authored
Mar 05, 2018
by
Dave Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commiting a bunch of old stuff
parent
1a8b831e
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
187 additions
and
466 deletions
+187
-466
README.md
README.md
+3
-0
docker-couchdb-2.x/Dockerfile
docker-couchdb-2.x/Dockerfile
+0
-140
docker-couchdb-2.x/README.oerf
docker-couchdb-2.x/README.oerf
+0
-12
docker-couchdb-2.x/conf/run.sh
docker-couchdb-2.x/conf/run.sh
+0
-54
docker-couchdb-2.x/couchdb/couchdb-init.sh
docker-couchdb-2.x/couchdb/couchdb-init.sh
+0
-66
docker-couchdb-2.x/couchdb/local.ini
docker-couchdb-2.x/couchdb/local.ini
+0
-8
docker-couchdb-2.x/couchdb/vm.args
docker-couchdb-2.x/couchdb/vm.args
+0
-28
docker-couchdb/Dockerfile
docker-couchdb/Dockerfile
+73
-60
docker-couchdb/couchdb/couchdb-init.sh
docker-couchdb/couchdb/couchdb-init.sh
+25
-19
docker-faye/Dockerfile
docker-faye/Dockerfile
+12
-10
docker-faye/conf/run.sh
docker-faye/conf/run.sh
+72
-66
docker-wenotes-tools/conf/run.sh
docker-wenotes-tools/conf/run.sh
+2
-3
No files found.
README.md
View file @
5674fe23
...
...
@@ -2,6 +2,9 @@ From https://github.com/klaemo/docker-couchdb/tree/master/2.0.0
See https://github.com/klaemo/docker-couchdb for documentation
# update 2018-01-09
Adding docker-wenotes-cron - might not need it, but cron in the docker-wenotes-tools container seems unreliable.
# Starting CouchDB
> docker run -d --name couchdb -v /home/dave/Docker/couchdb/data:/opt/couchdb/data oeru/couchdb
...
...
docker-couchdb-2.x/Dockerfile
deleted
100644 → 0
View file @
1a8b831e
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
FROM
ubuntu:xenial
MAINTAINER
Dave Lane dave@oerfoundation.org
# (adapted from work by Clemens Stolle klaemo@apache.org)
# Purpose - run a full WENotes stack including the faye message server,
# the wenotes service with couchdb, and various external processing tools
#
# The aim: to make a manageable fully functional dev environment which
# fosters remote API-ification for registering new blog users,
# updating details for session validation, and possibly integrating Mautic...
ENV
APT_SERVER http://ucmirror.canterbury.ac.nz/ubuntu
ENV
APT_FILE sources.list
ENV
UBUNTU_NAME xenial
# subdue the "Dialog" errors...
ENV
DEBIAN_FRONTEND noninteractive
ENV
COUCHDIR /opt/couchdb
#
# Add CouchDB user account
RUN
groupadd
-r
couchdb
&&
useradd
-d
$COUCHDIR
-g
couchdb couchdb
#
# add local mirror to reduce build time :)
RUN
echo
"deb
$APT_SERVER
${
UBUNTU_NAME
}
main universe"
>
/etc/apt/
${
APT_FILE
}
RUN
echo
"deb
$APT_SERVER
${
UBUNTU_NAME
}
-updates main universe"
>>
/etc/apt/
${
APT_FILE
}
RUN
echo
"deb
$APT_SERVER
${
UBUNTU_NAME
}
-security main universe"
>>
/etc/apt/
${
APT_FILE
}
RUN
echo
"deb-src
$APT_SERVER
${
UBUNTU_NAME
}
main universe"
>>
/etc/apt/
${
APT_FILE
}
RUN
echo
"deb-src
$APT_SERVER
${
UBUNTU_NAME
}
-updates main universe"
>>
/etc/apt/
${
APT_FILE
}
RUN
echo
"deb-src
$APT_SERVER
${
UBUNTU_NAME
}
-security main universe"
>>
/etc/apt/
${
APT_FILE
}
# do one update and start installing...
RUN
apt-get update
-y
&&
apt-get
install
-y
--no-install-recommends
\
apt-transport-https
\
apt-utils
\
ca-certificates
\
curl
\
git
\
haproxy
\
erlang-nox
\
erlang-reltool
\
# libicu52
\
libmozjs185-1.0
\
locales
\
openssl
\
&&
rm
-rf
/var/lib/apt/lists/
*
# grab gosu for easy step-down from root and tini for signal handling
RUN
gpg
--keyserver
ha.pool.sks-keyservers.net
--recv-keys
B42F6819007F00F88E364FD4036A9C25BF357DD4
\
&&
curl
-o
/usr/local/bin/gosu
-fSL
"https://github.com/tianon/gosu/releases/download/1.7/gosu-
$(
dpkg
--print-architecture
)
"
\
&&
curl
-o
/usr/local/bin/gosu.asc
-fSL
"https://github.com/tianon/gosu/releases/download/1.7/gosu-
$(
dpkg
--print-architecture
)
.asc"
\
&&
gpg
--verify
/usr/local/bin/gosu.asc
\
&&
rm
/usr/local/bin/gosu.asc
\
&&
chmod
+x /usr/local/bin/gosu
\
&&
gpg
--keyserver
ha.pool.sks-keyservers.net
--recv-keys
6380DC428747F6C393FEACA59A84159D7001A4E5
\
&&
curl
-o
/usr/local/bin/tini
-fSL
"https://github.com/krallin/tini/releases/download/v0.9.0/tini"
\
&&
curl
-o
/usr/local/bin/tini.asc
-fSL
"https://github.com/krallin/tini/releases/download/v0.9.0/tini.asc"
\
&&
gpg
--verify
/usr/local/bin/tini.asc
\
&&
rm
/usr/local/bin/tini.asc
\
&&
chmod
+x /usr/local/bin/tini
ENV
COUCHDB_VERSION 2.0.0
# install Node.JS repos and do another update...
RUN
curl
-s
https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
\
&&
echo
'deb https://deb.nodesource.com/node_4.x trusty main'
>
/etc/apt/sources.list.d/nodesource.list
\
&&
echo
'deb-src https://deb.nodesource.com/node_4.x trusty main'
>>
/etc/apt/sources.list.d/nodesource.list
\
&&
apt-get update
-y
-qq
# Download dev dependencies
RUN
apt-get
install
-y
--no-install-recommends
\
build-essential
\
erlang-dev
\
libcurl4-openssl-dev
\
libicu-dev
\
libmozjs185-dev
\
# install nodejs stack...
&& apt-get install -y nodejs \
&& npm install -g grunt-cli
# set up pm2
#RUN npm install -g pm2
# Acquire CouchDB source code
RUN cd /usr/src && mkdir couchdb \
&& curl -fSL https://dist.apache.org/repos/dist/release/couchdb/source/${COUCHDB_VERSION}/apache-couchdb-${COUCHDB_VERSION}.tar.gz -o couchdb.tar.gz \
&& tar -xzf couchdb.tar.gz -C couchdb --strip-components=1 \
&& cd couchdb \
# Build the release and install into /opt
&& ./configure --disable-docs \
&& make release \
&& mv /usr/src/couchdb/rel/couchdb $COUCHDIR \
# Cleanup build detritus
&& apt-get purge -y \
binutils \
build-essential \
cpp \
git \
erlang-dev \
libicu-dev \
make \
perl \
&& apt-get autoremove -y && apt-get clean \
# && apt-get install -y libicu52 --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* /usr/lib/node_modules /usr/src/couchdb*
# Sprinkle couchdb configuration to the right places...
COPY
couchdb/local.ini ${COUCHDIR}/etc/
COPY
couchdb/vm.args ${COUCHDIR}/etc/
COPY
couchdb/couchdb-init.sh /
# Setup directories and permissions
RUN
chmod
+x /couchdb-init.sh
\
&&
mkdir
${
COUCHDIR
}
/data
${
COUCHDIR
}
/etc/local.d
${
COUCHDIR
}
/etc/default.d
\
&&
chown
-R
couchdb:couchdb
${
COUCHDIR
}
# Set up the language variables
ENV
LANG en_NZ.UTF-8
ENV
LANGUAGE en_NZ.UTF-8
ENV
LC_ALL en_NZ.UTF-8
# Compile the language spec
RUN
locale-gen
$LANG
#
# Some final exports to get the environment right...
RUN
echo
"export VISIBLE=now"
>>
/etc/profile
\
&&
echo
"export TERM=xterm"
>>
/etc/bash.bashrc
# expose relevant ports
WORKDIR
${COUCHDIR}
EXPOSE
5984 4369 9100
VOLUME
["${COUCHDIR}/data"]
ENTRYPOINT
["tini", "--", "/couchdb-init.sh"]
CMD
["/opt/couchdb/bin/couchdb"]
docker-couchdb-2.x/README.oerf
deleted
100644 → 0
View file @
1a8b831e
===CouchDB===
Build: docker build -t oeru/couchdb docker-couchdb
Launch (replacing [admin password] and [bot password]):
docker run --name couchdb -v /home/dave/Docker/wenotes/data:/opt/couchdb/data \
-e COUCHDB_USER=admin -e COUCHDB_PASSWORD=[admin password] \
-e COUCHDB_BOT_USER=bot -e COUCHDB_BOT_PASSWORD=[bot password] \
-d oeru/couchdb
DB="http://user:password@localhost:5984"
curl -X PUT "$DB/dbname"
curl -d @dbname-backup-file.json -X POST "$DB/_bulk_docs" -H"Content-Type: application/json"
docker-couchdb-2.x/conf/run.sh
deleted
100644 → 0
View file @
1a8b831e
#!/bin/bash
# Bash hasn't been initialized yet so add path to composer manually.
#export PATH="$HOME/.composer/vendor/bin:$PATH"
# Run start script.
echo
"*****Running run.sh"
CONF
=
/root/conf
COUCH
=
/root
CWD
=
`
pwd
`
PM2
=
`
which pm2
`
echo
"CWD=
$CWD
, GIT=
$GIT
"
# Run before-run scripts added by another containers.
if
[[
-d
$CONF
/before-start
]]
;
then
FILES
=
$CONF
/before-start/
*
for
f
in
$FILES
do
echo
"Attaching:
$f
"
source
$f
done
fi
if
[[
-f
$CONF
/pre-install.sh
]]
;
then
echo
"Running: pre-install.sh"
source
$CONF
/pre-install.sh
fi
echo
"starting services"
# first start couchdb
if
[[
-f
$COUCH
/couchdb-init.sh
]]
;
then
echo
"starting couchdb via
$COUCH
/couchdb-init.sh"
$PM2
start
--no-daemon
$COUCH
/couchdb-init.sh
fi
echo
"finished services"
if
[[
-f
$CONF
/post-install.sh
]]
;
then
echo
"Running: post-install.sh"
source
$CONF
/post-install.sh
fi
echo
"
\n
****** in run.sh ********
\n
"
# Run after-run scripts added by another containers.
if
[[
-d
$CONF
/after-start
]]
;
then
FILES
=
$CONF
/after-start/
*
for
f
in
$FILES
do
echo
"Attaching:
$f
"
source
$f
done
fi
docker-couchdb-2.x/couchdb/couchdb-init.sh
deleted
100755 → 0
View file @
1a8b831e
#!/bin/bash
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
set
-e
if
[
"
$1
"
=
'/opt/couchdb/bin/couchdb'
]
;
then
# we need to set the permissions here because docker mounts volumes as root
chown
-R
couchdb:couchdb /opt/couchdb
chmod
-R
0770 /opt/couchdb/data
chmod
664 /opt/couchdb/etc/
*
.ini
chmod
775 /opt/couchdb/etc/
*
.d
if
[
!
-z
"
$NODENAME
"
]
&&
!
grep
"couchdb@"
/opt/couchdb/etc/vm.args
;
then
echo
"-name couchdb@
$NODENAME
"
>>
/opt/couchdb/etc/vm.args
fi
if
[
"
$COUCHDB_USER
"
]
&&
[
"
$COUCHDB_PASSWORD
"
]
;
then
# Create admin
echo
"Setting admin access details"
printf
"[admins]
\n
%s = %s
\n
"
"
$COUCHDB_USER
"
"
$COUCHDB_PASSWORD
"
>
/opt/couchdb/etc/local.d/docker.ini
if
[
"
$COUCHDB_BOT_USER
"
]
&&
[
"
$COUCHDB_BOT_PASSWORD
"
]
;
then
printf
"%s = %s
\n
"
"
$COUCHDB_BOT_USER
"
"
$COUCHDB_BOT_PASSWORD
"
>>
/opt/couchdb/etc/local.d/docker.ini
fi
if
[
"
$COUCHDB_PROXYSECRET
"
]
;
then
echo
"Setting a proxy secret"
printf
"[couch_httpd_auth
\]\n
require_valid_user = true
\n
secret = %s
\n
"
"
$COUCHDB_PROXYSECRET
"
>>
/opt/couchdb/etc/local.d/docker.ini
else
printf
"[couch_httpd_auth
\]\n
require_valid_user = true
\n
"
>>
/opt/couchdb/etc/local.d/docker.ini
fi
chown
couchdb:couchdb /opt/couchdb/etc/local.d/docker.ini
fi
# if we don't find an [admins] section followed by a non-comment, display a warning
if
!
grep
-Pzoqr
'\[admins\]\n[^;]\w+'
/opt/couchdb/etc/local.d/
*
.ini
;
then
# The - option suppresses leading tabs but *not* spaces. :)
cat
>
&2
<<-
'
EOWARN
'
****************************************************
WARNING: CouchDB is running in Admin Party mode.
This will allow anyone with access to the
CouchDB port to access your database. In
Docker's default configuration, this is
effectively any other container on the same
system.
Use "-e COUCHDB_USER=admin -e COUCHDB_PASSWORD=password"
to set it in "docker run".
****************************************************
EOWARN
fi
exec
gosu couchdb
"
$@
"
fi
exec
"
$@
"
docker-couchdb-2.x/couchdb/local.ini
deleted
100644 → 0
View file @
1a8b831e
; CouchDB Configuration Settings
; Custom settings should be made in this file. They will override settings
; in default.ini, but unlike changes made to default.ini, this file won't be
; overwritten on server upgrade.
[chttpd]
bind_address
=
any
docker-couchdb-2.x/couchdb/vm.args
deleted
100644 → 0
View file @
1a8b831e
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
# Ensure that the Erlang VM listens on a known port
-kernel inet_dist_listen_min 9100
-kernel inet_dist_listen_max 9100
# Tell kernel and SASL not to log anything
-kernel error_logger silent
-sasl sasl_error_logger false
# Use kernel poll functionality if supported by emulator
+K true
# Start a pool of asynchronous IO threads
+A 16
# Comment this line out to enable the interactive Erlang shell on startup
+Bd -noinput
docker-couchdb/Dockerfile
View file @
5674fe23
...
...
@@ -10,32 +10,49 @@
# License for the specific language governing permissions and limitations under
# the License.
FROM
debian:jessie
FROM
ubuntu:xenial
MAINTAINER
Dave Lane dave@oerfoundation.org
# (adapted from work by Clemens Stolle klaemo@apache.org)
# Purpose - run a full WENotes stack including the faye message server,
# the wenotes service with couchdb, and various external processing tools
#
# The aim: to make a manageable fully functional dev environment which
# fosters remote API-ification for registering new blog users,
# updating details for session validation, and possibly integrating Mautic...
ENV
APT_SERVER http://ucmirror.canterbury.ac.nz/ubuntu
ENV
APT_FILE sources.list
ENV
UBUNTU_NAME xenial
# subdue the "Dialog" errors...
ENV
DEBIAN_FRONTEND noninteractive
ENV
COUCHDIR /opt/couchdb
#
# Add CouchDB user account
RUN
groupadd
-r
couchdb
&&
useradd
-d
$COUCHDIR
-g
couchdb couchdb
# Install instructions from https://cwiki.apache.org/confluence/display/COUCHDB/Debian
RUN
groupadd
-r
couchdb
&&
useradd
-d
/var/lib/couchdb
-g
couchdb couchdb
#
# add local mirror to reduce build time :)
RUN
echo
"deb
$APT_SERVER
${
UBUNTU_NAME
}
main universe"
>
/etc/apt/
${
APT_FILE
}
RUN
echo
"deb
$APT_SERVER
${
UBUNTU_NAME
}
-updates main universe"
>>
/etc/apt/
${
APT_FILE
}
RUN
echo
"deb
$APT_SERVER
${
UBUNTU_NAME
}
-security main universe"
>>
/etc/apt/
${
APT_FILE
}
RUN
echo
"deb-src
$APT_SERVER
${
UBUNTU_NAME
}
main universe"
>>
/etc/apt/
${
APT_FILE
}
RUN
echo
"deb-src
$APT_SERVER
${
UBUNTU_NAME
}
-updates main universe"
>>
/etc/apt/
${
APT_FILE
}
RUN
echo
"deb-src
$APT_SERVER
${
UBUNTU_NAME
}
-security main universe"
>>
/etc/apt/
${
APT_FILE
}
# do one update and start installing...
RUN
apt-get update
-y
&&
apt-get
install
-y
--no-install-recommends
\
apt-transport-https
\
apt-utils
\
ca-certificates
\
curl
\
git
\
haproxy
\
erlang-nox
\
libicu52
\
erlang-reltool
\
# libicu52
\
libmozjs185-1.0
\
libnspr4
\
libnspr4-0d
\
locales
\
openssl
\
&&
rm
-rf
/var/lib/apt/lists/
*
# grab gosu for easy step-down from root and tini for signal handling
...
...
@@ -52,59 +69,57 @@ RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364
&&
rm
/usr/local/bin/tini.asc
\
&&
chmod
+x /usr/local/bin/tini
# https://www.apache.org/dist/couchdb/KEYS
ENV
GPG_KEYS \
15DD4F3B8AACA54740EB78C7B7B7C53943ECCEE1 \
1CFBFA43C19B6DF4A0CA3934669C02FFDF3CEBA3 \
25BBBAC113C1BFD5AA594A4C9F96B92930380381 \
4BFCA2B99BADC6F9F105BEC9C5E32E2D6B065BFB \
5D680346FAA3E51B29DBCB681015F68F9DA248BC \
7BCCEB868313DDA925DF1805ECA5BCB7BB9656B0 \
C3F4DFAEAD621E1C94523AEEC376457E61D50B88 \
D2B17F9DA23C0A10991AF2E3D9EE01E47852AEE4 \
E0AF0A194D55C84E4A19A801CDB0C0F904F4EE9B
RUN
set
-xe
\
&&
for
key
in
$GPG_KEYS
;
do
\
gpg
--keyserver
ha.pool.sks-keyservers.net
--recv-keys
"
$key
"
;
\
done
ENV
COUCHDB_VERSION 1.6.1
ENV
COUCHDB_VERSION 2.0.0
# download dependencies, compile and install couchdb,
# set correct permissions, expose couchdb to the outside and disable logging to disk
RUN
buildDeps
=
'
\
gcc
\
g++
\
# install Node.JS repos and do another update...
RUN
curl
-s
https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
\
&&
echo
'deb https://deb.nodesource.com/node_4.x trusty main'
>
/etc/apt/sources.list.d/nodesource.list
\
&&
echo
'deb-src https://deb.nodesource.com/node_4.x trusty main'
>>
/etc/apt/sources.list.d/nodesource.list
\
&&
apt-get update
-y
-qq
# Download dev dependencies
RUN
apt-get
install
-y
--no-install-recommends
\
build-essential
\
erlang-dev
\
libcurl4-openssl-dev
\
libicu-dev
\
libmozjs185-dev
\
libnspr4-dev
\
# install nodejs stack...
&& apt-get install -y nodejs \
&& npm install -g grunt-cli
# set up pm2
#RUN npm install -g pm2
# Acquire CouchDB source code
RUN cd /usr/src && mkdir couchdb \
&& curl -fSL https://dist.apache.org/repos/dist/release/couchdb/source/${COUCHDB_VERSION}/apache-couchdb-${COUCHDB_VERSION}.tar.gz -o couchdb.tar.gz \
&& tar -xzf couchdb.tar.gz -C couchdb --strip-components=1 \
&& cd couchdb \
# Build the release and install into /opt
&& ./configure --disable-docs \
&& make release \
&& mv /usr/src/couchdb/rel/couchdb $COUCHDIR \
# Cleanup build detritus
&& apt-get purge -y \
binutils \
build-essential \
cpp \
git \
erlang-dev \
libicu-dev \
make \
'
\
&&
apt-get update
&&
apt-get
install
-y
--no-install-recommends
$buildDeps
\
&&
curl
-fSL
http://apache.osuosl.org/couchdb/source/
$COUCHDB_VERSION
/apache-couchdb-
$COUCHDB_VERSION
.tar.gz
-o
couchdb.tar.gz
\
&&
curl
-fSL
https://www.apache.org/dist/couchdb/source/
$COUCHDB_VERSION
/apache-couchdb-
$COUCHDB_VERSION
.tar.gz.asc
-o
couchdb.tar.gz.asc
\
&&
gpg
--verify
couchdb.tar.gz.asc
\
&&
mkdir
-p
/usr/src/couchdb
\
&&
tar
-xzf
couchdb.tar.gz
-C
/usr/src/couchdb
--strip-components
=
1
\
&&
cd
/usr/src/couchdb
\
&&
./configure
--with-js-lib
=
/usr/lib
--with-js-include
=
/usr/include/mozjs
\
&&
make
&&
make
install
\
&&
apt-get purge
-y
--auto-remove
$buildDeps
\
&&
rm
-rf
/var/lib/apt/lists/
*
/usr/src/couchdb /couchdb.tar.gz
*
\
&&
chown
-R
couchdb:couchdb
\
/usr/local/lib/couchdb /usr/local/etc/couchdb
\
/usr/local/var/lib/couchdb /usr/local/var/log/couchdb /usr/local/var/run/couchdb
\
&&
chmod
-R
g+rw
\
/usr/local/lib/couchdb /usr/local/etc/couchdb
\
/usr/local/var/lib/couchdb /usr/local/var/log/couchdb /usr/local/var/run/couchdb
\
&&
mkdir
-p
/var/lib/couchdb
\
&&
sed
-e
's/^bind_address = .*$/bind_address = 0.0.0.0/'
-i
/usr/local/etc/couchdb/default.ini
\
&&
sed
-e
's!/usr/local/var/log/couchdb/couch.log$!/dev/null!'
-i
/usr/local/etc/couchdb/default.ini
perl \
&& apt-get autoremove -y && apt-get clean \
# && apt-get install -y libicu52 --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* /usr/lib/node_modules /usr/src/couchdb*
# Sprinkle couchdb configuration to the right places...
COPY
couchdb/local.ini ${COUCHDIR}/etc/
COPY
couchdb/vm.args ${COUCHDIR}/etc/
COPY
couchdb/couchdb-init.sh /
RUN
chmod
+x /couchdb-init.sh
# Setup directories and permissions
RUN
chmod
+x /couchdb-init.sh
\
&&
mkdir
${
COUCHDIR
}
/data
${
COUCHDIR
}
/etc/local.d
${
COUCHDIR
}
/etc/default.d
\
&&
chown
-R
couchdb:couchdb
${
COUCHDIR
}
# Set up the language variables
ENV
LANG en_NZ.UTF-8
...
...
@@ -117,11 +132,9 @@ RUN locale-gen $LANG
RUN
echo
"export VISIBLE=now"
>>
/etc/profile
\
&&
echo
"export TERM=xterm"
>>
/etc/bash.bashrc
# Define mountable directories.
VOLUME
["/usr/local/var/lib/couchdb"]
EXPOSE
5984
WORKDIR
/var/lib/couchdb
# expose relevant ports
WORKDIR
${COUCHDIR}
EXPOSE
5984 4369 9100
VOLUME
["${COUCHDIR}/data"]
ENTRYPOINT
["tini", "--", "/couchdb-init.sh"]
CMD
["couchdb"]
CMD
["
/opt/couchdb/bin/
couchdb"]
docker-couchdb/couchdb/couchdb-init.sh
100644 → 100755
View file @
5674fe23
...
...
@@ -13,37 +13,42 @@
set
-e
if
[
"
$1
"
=
'couchdb'
]
;
then
if
[
"
$1
"
=
'
/opt/couchdb/bin/
couchdb'
]
;
then
# we need to set the permissions here because docker mounts volumes as root
chown
-R
couchdb:couchdb
\
/usr/local/var/lib/couchdb
\
/usr/local/var/log/couchdb
\
/usr/local/var/run/couchdb
\
/usr/local/etc/couchdb
chown
-R
couchdb:couchdb /opt/couchdb
chmod
-R
0770
\
/usr/local/var/lib/couchdb
\
/usr/local/var/log/couchdb
\
/usr/local/var/run/couchdb
\
/usr/local/etc/couchdb
chmod
-R
0770 /opt/couchdb/data
chmod
664 /usr/local/etc/couchdb/
*
.ini
chmod
775 /usr/local/etc/couchdb/
*
.d
chmod
664 /opt/couchdb/etc/
*
.ini
chmod
775 /opt/couchdb/etc/
*
.d
if
[
!
-z
"
$NODENAME
"
]
&&
!
grep
"couchdb@"
/opt/couchdb/etc/vm.args
;
then
echo
"-name couchdb@
$NODENAME
"
>>
/opt/couchdb/etc/vm.args
fi
# create the local settings
printf
"[httpd]
\n
allow_jsonp = true
\n
"
>
/opt/couchdb/etc/local.d/docker.ini
if
[
"
$COUCHDB_USER
"
]
&&
[
"
$COUCHDB_PASSWORD
"
]
;
then
# Create admin
printf
"[admins]
\n
%s = %s
\n
"
"
$COUCHDB_USER
"
"
$COUCHDB_PASSWORD
"
>
/usr/local/etc/couchdb/local.d/docker.ini
echo
"Setting admin access details"
printf
"[admins]
\n
%s = %s
\n
"
"
$COUCHDB_USER
"
"
$COUCHDB_PASSWORD
"
>>
/opt/couchdb/etc/local.d/docker.ini
if
[
"
$COUCHDB_BOT_USER
"
]
&&
[
"
$COUCHDB_BOT_PASSWORD
"
]
;
then
printf
"%s = %s
\n
"
"
$COUCHDB_BOT_USER
"
"
$COUCHDB_BOT_PASSWORD
"
>>
/usr/local/etc/couchdb/local.d/docker.ini
printf
"%s = %s
\n
"
"
$COUCHDB_BOT_USER
"
"
$COUCHDB_BOT_PASSWORD
"
>>
/opt/couchdb/etc/local.d/docker.ini
fi
if
[
"
$COUCHDB_PROXYSECRET
"
]
;
then
echo
"Setting a proxy secret"
printf
"[couch_httpd_auth]
\n
require_valid_user = true
\n
secret = %s
\n
"
"
$COUCHDB_PROXYSECRET
"
>>
/opt/couchdb/etc/local.d/docker.ini
else
printf
"[couch_httpd_auth]
\n
require_valid_user = true
\n
"
>>
/opt/couchdb/etc/local.d/docker.ini
fi
chown
couchdb:couchdb /usr/local/etc/couchdb/local.d/docker.ini
fi
printf
"[httpd]
\n
port = %s
\n
bind_address = %s
\n
"
${
COUCHDB_HTTP_PORT
:
=5984
}
${
COUCHDB_HTTP_BIND_ADDRESS
:
=0.0.0.0
}
>
/usr/local/etc/couchdb/local.d/bind_address.ini
chown
couchdb:couchdb /
usr/local/etc
/couchdb/local.d/
bind_address
.ini
# set the permissions correctly
chown
couchdb:couchdb /
opt
/couchdb/
etc/
local.d/
docker
.ini
# if we don't find an [admins] section followed by a non-comment, display a warning
if
!
grep
-Pzoqr
'\[admins\]\n[^;]\w+'
/
usr/local/etc/couchdb
;
then
if
!
grep
-Pzoqr
'\[admins\]\n[^;]\w+'
/
opt/couchdb/etc/local.d/
*
.ini
;
then
# The - option suppresses leading tabs but *not* spaces. :)
cat
>
&2
<<-
'
EOWARN
'
****************************************************
...
...
@@ -59,6 +64,7 @@ if [ "$1" = 'couchdb' ]; then
EOWARN
fi
exec
gosu couchdb
"
$@
"
fi
...
...
docker-faye/Dockerfile
View file @
5674fe23
...
...
@@ -21,19 +21,19 @@ MAINTAINER Dave Lane dave@oerfoundation.org
# The aim: to make a manageable fully functional dev environment which
# fosters remote API-ification for registering new blog users,
# updating details for session validation, and possibly integrating Mautic...
ENV
APT_SERVER http://ucmirror.canterbury.ac.nz/ubuntu
ENV
APT_FILE sources.list
ENV
UBUNTU_NAME xenial
#
ENV APT_SERVER http://ucmirror.canterbury.ac.nz/ubuntu
#
ENV APT_FILE sources.list
#
ENV UBUNTU_NAME xenial
# subdue the "Dialog" errors...
ENV
DEBIAN_FRONTEND noninteractive
#
# add local mirror to reduce build time :)
RUN
echo
"deb
$APT_SERVER
${
UBUNTU_NAME
}
main universe"
>
/etc/apt/
${
APT_FILE
}
RUN
echo
"deb
$APT_SERVER
${
UBUNTU_NAME
}
-updates main universe"
>>
/etc/apt/
${
APT_FILE
}
RUN
echo
"deb
$APT_SERVER
${
UBUNTU_NAME
}
-security main universe"
>>
/etc/apt/
${
APT_FILE
}
RUN
echo
"deb-src
$APT_SERVER
${
UBUNTU_NAME
}
main universe"
>>
/etc/apt/
${
APT_FILE
}
RUN
echo
"deb-src
$APT_SERVER
${
UBUNTU_NAME
}
-updates main universe"
>>
/etc/apt/
${
APT_FILE
}
RUN
echo
"deb-src
$APT_SERVER
${
UBUNTU_NAME
}
-security main universe"
>>
/etc/apt/
${
APT_FILE
}
#
RUN echo "deb $APT_SERVER ${UBUNTU_NAME} main universe" > /etc/apt/${APT_FILE}
#
RUN echo "deb $APT_SERVER ${UBUNTU_NAME}-updates main universe" >> /etc/apt/${APT_FILE}
#
RUN echo "deb $APT_SERVER ${UBUNTU_NAME}-security main universe" >> /etc/apt/${APT_FILE}
#
RUN echo "deb-src $APT_SERVER ${UBUNTU_NAME} main universe" >> /etc/apt/${APT_FILE}
#
RUN echo "deb-src $APT_SERVER ${UBUNTU_NAME}-updates main universe" >> /etc/apt/${APT_FILE}
#
RUN echo "deb-src $APT_SERVER ${UBUNTU_NAME}-security main universe" >> /etc/apt/${APT_FILE}
# do one update and start installing...
RUN
apt-get update
-y
&&
apt-get
install
-y
--no-install-recommends
\
apt-transport-https
\
...
...
@@ -45,9 +45,11 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \
erlang-nox
\
erlang-reltool
\
# libicu52
\
less
\
libmozjs185-1.0
\
locales
\
openssl
\
vim
\
&&
rm
-rf
/var/lib/apt/lists/
*
# grab gosu for easy step-down from root and tini for signal handling
...
...
@@ -98,7 +100,7 @@ RUN chmod u+x /root/conf/*.sh
# expose relevant ports
EXPOSE
80
VOLUME
["/opt/wenotes
/server
", "/opt/
wenotes/options.json
"]
VOLUME
["/opt/wenotes", "/opt/
conf
"]
# First, say we're doing it
RUN
echo
"running run.sh - /root/conf/run.sh"
# Actually do it when we run the container.
...
...
docker-faye/conf/run.sh
View file @
5674fe23
...
...
@@ -3,9 +3,10 @@
#export PATH="$HOME/.composer/vendor/bin:$PATH"