Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker: Introduce a proof of concept of docker pause on centos 7 #6

Draft
wants to merge 1 commit into
base: docker-compose
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ requires 'JSON::XS';
requires 'LWP';
requires 'List::MoreUtils';
requires 'Log::Dispatch::Config';
requires 'Log::Dispatchouli';
requires 'Log::Dispatchouli', '== 2.023';
requires 'Mail::Send';
requires 'Module::Signature';
requires 'MojoX::Log::Dispatch::Simple';
Expand Down
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ services:
NGINX_HOST: ${NGINX_HOST}
hostname: ${NGINX_HOST}
app:
build: ./docker/app
build:
context: ./docker/app
dockerfile: Dockerfile.centos7
container_name: app
ports:
- 5000:5000
Expand Down
20 changes: 20 additions & 0 deletions docker/app/Dockerfile.centos7
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM centos:7
WORKDIR /home/k/pause
RUN yum install -y \
make gcc curl perl perl-core ssh git gpg gpg-agent openssl unzip bzip2 ca-certificates crontabs rsyslog \
openssl-devel zlib-devel expat-devel libxml2-devel mariadb-libs mariadb-devel which procps \
mariadb \
nano && \
yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm && \
yum install -y --enablerepo=remi golang && \
go install github.com/mailhog/mhsendmail@latest && mv /root/go/bin/mhsendmail /usr/sbin/sendmail && \
curl -skL --compressed https://git.io/cpm > cpm && \
chmod +x cpm && mv cpm /usr/local/bin && \
curl -skL --compressed https://cpanmin.us > cpanm && \
chmod +x cpanm && mv cpanm /usr/local/bin && \
cpanm -n IPC::Run Log::[email protected] && \
curl -skL https://raw.githubusercontent.com/andk/pause/master/cpanfile > cpanfile && \
# cpm install -g
cpanm --installdeps -n .
COPY ./docker-entrypoint.centos7.sh /
ENTRYPOINT ["/docker-entrypoint.centos7.sh"]
67 changes: 67 additions & 0 deletions docker/app/docker-entrypoint.centos7.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash
set -e

AUTH="-u ${MYSQL_USER} --password=${MYSQL_ROOT_PASSWORD}"
AUTH_DB="$AUTH ${MYSQL_DATABASE}"

for i in 1 2 3 4 5 6 7 8 9 10
do
mysqladmin -h mysql $AUTH ping > /dev/null 2>&1 && break
sleep 10
done

if ! mysql -h mysql $AUTH_DB -e 'SELECT 1 FROM abrakadabra' > /dev/null 2>&1; then
mysql -h mysql $AUTH_DB < ./doc/authen_pause.schema.txt
fi
if ! mysql -h mysql $AUTH_DB -e 'SELECT 1 FROM applymod' > /dev/null 2>&1; then
mysql -h mysql $AUTH_DB < ./doc/mod.schema.txt
fi

cd /root
tar xf /root/gnupg.tar.gz
cp -R /root/gnupg/* /root/.gnupg/
cd /home/k/pause
chmod 0600 /root/.gnupg/*
chmod 0600 /root/.gnupg/private-keys-v1.d
chmod 0600 /root/.gnupg/openpgp-revocs.d
chmod 0700 /root/.gnupg

perl -Ilib ./docker/app/insert_fixture.pl

if [ ! -d /home/ftp/incoming ]; then
mkdir /home/ftp/incoming
fi
if [ ! -d /home/ftp/run ]; then
mkdir /home/ftp/run
fi
if [ ! -d /home/ftp/pub/PAUSE ]; then
mkdir /home/ftp/pub/PAUSE
fi
if [ ! -d /home/ftp/pub/PAUSE/PAUSE-git ]; then
mkdir -p /home/ftp/pub/PAUSE/PAUSE-git
cd /home/ftp/pub/PAUSE/PAUSE-git
git config --global init.defaultBranch main
git init
git config --global --add safe.directory /home/ftp/pub/PAUSE/PAUSE-git
git config --global user.email "${FTP}"
git config --global user.name "PAUSE-git"
cd /home/k/pause
fi
if [ ! -d /home/ftp/pub/PAUSE/PAUSE-data ]; then
mkdir -p /home/ftp/pub/PAUSE/PAUSE-data
fi
if [ ! -d /home/ftp/pub/PAUSE/modules ]; then
mkdir -p /home/ftp/pub/PAUSE/modules
fi

cpm install -g

perl ./bin/paused --pidfile=/var/run/paused.pid &

# Or cron won't run it...
chmod 0600 /var/spool/cron/crontabs/root

exec rsyslogd &
exec crond &

plackup ./app_2017.psgi