Skip to content

Commit

Permalink
first push
Browse files Browse the repository at this point in the history
  • Loading branch information
richardkeit committed Jul 29, 2016
0 parents commit c091d48
Show file tree
Hide file tree
Showing 17 changed files with 983 additions and 0 deletions.
51 changes: 51 additions & 0 deletions db/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#FROM centos:7
FROM richardkeit/basepgbrm
MAINTAINER Richard Keit <[email protected]>
ENV PGDATA /opt/postgres/data
ENV POSTGRESPASS postgres

## Install the Centos 7 Postgres 9.5 Repoistory

RUN yum install -y https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm \
epel-release

RUN yum install -y $(yum list |grep postgres |grep x86 |grep 9.5.3 | awk '{print $1}') \
wget \
gdal* \
python-pip* \
sudo \
postgis2_95* \
&& echo $POSTGRESPASS > /opt/pw && mkdir -p /opt/postgres/data && chown -R postgres:postgres /opt/

USER postgres

RUN /usr/pgsql-9.5/bin/initdb -E UTF8 --lc-collate=en_US.UTF-8 --lc-ctype=en_US.UTF-8 --lc-messages=en_US.UTF-8 --lc-monetary=en_US.UTF-8 --lc-numeric=en_US.UTF-8 --lc-time=en_US.UTF-8 -D /opt/postgres/data/ --pwfile=/opt/pw

####
# Create postgresql.conf and pg_hba.conf file per template
####


RUN echo "host all all all md5" >> $PGDATA/pg_hba.conf && echo "listen_addresses='*'" >> $PGDATA/postgresql.conf


RUN /usr/pgsql-9.5/bin/pg_ctl -D $PGDATA start ; sleep 2 && createuser ipss && createdb -E UTF8 -O ipss ipss && \
psql ipss -c "CREATE EXTENSION postgis;" \
#&& \
#psql ipss -c "SELECT name, default_version, \
#installed_version FROM pg_available_extensions \
#WHERE name LIKE 'postgis%' ;" \
&& psql ipss -c "ALTER TABLE geometry_columns OWNER TO ipss;" \
&& psql ipss -c "ALTER TABLE spatial_ref_sys OWNER TO ipss;" \
&& psql ipss -c "SELECT ST_GeomFromText('POINT(-71.064 42.287)');" \
&& psql ipss -c "CREATE SCHEMA temp;" \
&& psql ipss -c "CREATE TABLE temp.containers (containerid varchar, "time" varchar ) WITH (OIDS=FALSE);" \
&& psql ipss -c "INSERT INTO TEMP.CONTAINERS (Containerid, time) VALUES ('First Entry', 'From Richard DB');"

EXPOSE 5432

VOLUME ["/opt/postgres/data/pg_log", "/usr/pgsql-9.5/bin" , "/etc/postgresql"]


CMD /usr/pgsql-9.5/bin/postgres -D $PGDATA -c config_file=$PGDATA/postgresql.conf

19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: '2'
services:
web:
build: web
ports:
- "5000"
volumes:
- share:/sharedvol/
links:
- pgdb
pgdb:
build: db


volumes:
share: {}

networks:
sharenet: {}
25 changes: 25 additions & 0 deletions docker-compose.yml2
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: '2'
services:
web:
build: web
ports:
- "5000"
volumes:
- share:/sharedvol/
# networks:
# - sharenet
links:
- pgdb
pgdb:
build: db
# networks:
# - sharenet




volumes:
share: {}

networks:
sharenet: {}
9 changes: 9 additions & 0 deletions docker-compose.ymlVersion1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
web:
build: web
ports:
- "5000"
links:
- "db:PGDB"
db:
build: db

55 changes: 55 additions & 0 deletions docker-compose.yml_rabbitmq_etc
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
version: '2'
services:
web:
build: web
ports:
- "5000"
volumes:
- share:/sharedvol/
# networks:
# - sharenet
links:
- pgdb
pgdb:
build: db
# networks:
# - sharenet
pgclient:
image: postgres
links:
- pgdb
logtailer:
image: busybox
volumes:
- share:/some_other_dir/
command: tail -f /some_other_dir/sharedfile
rabbit1:
# image: rabbitmq:3
build: rabbit/new
hostname: rabbit1
environment:
- RABBITMQ_ERLANG_COOKIE=5555
# networks:
# - default
rabbit2:
build: rabbit/new
# image: rabbitmq:3
hostname: rabbit2
# links:
# - rabbit-node1:rabbit1
environment:
- RABBITMQ_ERLANG_COOKIE=5555
- CLUSTERED=true
- CLUSTER_WITH=rabbit1
# networks:
# - default





volumes:
share: {}

networks:
sharenet: {}
24 changes: 24 additions & 0 deletions docker-compose.ymlback
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: '2'
services:
web:
build:
context: ./web
dockerfile: Dockerfile
ports:
- "5000"
depends_on:
- db
links:
- db:pggb
volumes:
- /opt/webapp
- webvolume01:/opt/webapp

db:
build:
context: ./db
dockerfile: Dockerfile
expose:
- "5432"
volumes:
webvolume01: {}
19 changes: 19 additions & 0 deletions docker-compose.ymlbackup2
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: '2'
services:
web:
build:
context: ./web
dockerfile: Dockerfile
expose:
- "5000"
depends_on:
- db
links:
- "db:PGDB"
command: env
db:
build:
context: ./db
dockerfile: Dockerfile
expose:
- "5432"
19 changes: 19 additions & 0 deletions rabbit/baseimage/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM centos:7
MAINTAINER Richard Keit <[email protected]>

# Install base deps
RUN yum install -y net-tools pwgen wget curl tar unzip mlocate logrotate

# Install base the EPEL repo
#RUN rpm -Uvh http://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
RUN yum -y install epel-release


# Install RabbitMQ deps
RUN rpm --import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
RUN yum install -y erlang
RUN yum install -y http://www.rabbitmq.com/releases/rabbitmq-server/v3.5.6/rabbitmq-server-3.5.6-1.noarch.rpm

# Allow triggerable events on the first time running
RUN touch /tmp/firsttimerunning

25 changes: 25 additions & 0 deletions rabbit/new/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM rabbitmq:3
MAINTAINER Richard Keit <[email protected]>

###### Used the base RabbitMQ image as it works well! #######

##### Set the ENV var to have the same cookie for clustering ##
ENV RABBITMQ_ERLANG_COOKIE=richardrabbit


EXPOSE 1883
EXPOSE 8883
EXPOSE 5672
EXPOSE 15672
EXPOSE 25672
EXPOSE 4369
EXPOSE 9100
EXPOSE 9101
EXPOSE 9102
EXPOSE 9103
EXPOSE 9104
EXPOSE 9105

ADD startclusternode.sh /var/lib/rabbitmq/startclusternode.sh
ENTRYPOINT /var/lib/rabbitmq/startclusternode.sh

17 changes: 17 additions & 0 deletions rabbit/new/baseimage/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM centos:7
MAINTAINER Richard Keit <[email protected]>

# Install base deps
RUN yum install -y net-tools pwgen wget curl tar unzip mlocate logrotate telnet vim

# Install base the EPEL repo
RUN yum -y install epel-release


# Install RabbitMQ deps
RUN rpm --import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
RUN yum install -y erlang
RUN yum install -y http://www.rabbitmq.com/releases/rabbitmq-server/v3.5.6/rabbitmq-server-3.5.6-1.noarch.rpm

# Allow triggerable events on the first time running
RUN touch /tmp/firsttimerunning
1 change: 1 addition & 0 deletions rabbit/new/baseimagedebian/rabbitmq
Submodule rabbitmq added at 6d3777
42 changes: 42 additions & 0 deletions rabbit/new/startclusternode.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash
## Based on Jay-Johnson ###
## Appends by Richard Keit <[email protected]>

logfile="/tmp/rabbitnode.log"
touch $logfile
cookieFile='/var/lib/rabbitmq/.erlang.cookie'

if [ "$CLUSTER_WITH" = "rabbit1" ] ;
then

echo "Starting Clustered Server Instance as a DETACHED single instance"
echo "$RABBITMQ_ERLANG_COOKIE" > "$cookieFile"
chmod 600 "$cookieFile" ; chown rabbitmq:rabbitmq "$cookieFile"
/usr/sbin/rabbitmq-server -detached >> $logfile

echo "Stopping App with /usr/sbin/rabbitmqctl stop_app"
/usr/sbin/rabbitmqctl stop_app >> $logfile

/usr/sbin/rabbitmqctl join_cluster rabbit@$CLUSTER_WITH >> $logfile

echo "Starting App"
/usr/sbin/rabbitmqctl start_app >> $logfile

echo `/usr/sbin/rabbitmqctl cluster_status`
echo "Done Starting Cluster Node"
tail -f /tmp/rabbitnode.log

else
echo "$RABBITMQ_ERLANG_COOKIE" > "$cookieFile"
chmod 600 "$cookieFile" ; chown rabbitmq:rabbitmq "$cookieFile"

/usr/sbin/rabbitmq-server -detached >> $logfile

tail -f /tmp/rabbitnode.log



fi



14 changes: 14 additions & 0 deletions rabbit/new/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash



if [ "$USERNAME" = "root" ] ;
then

echo "Test"

fi

for (( i = 0; i < 10; i++ )); do
echo $i
done
10 changes: 10 additions & 0 deletions web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM richardkeit/centos:baseweb
MAINTAINER Richard Keit <[email protected]>


ADD . /opt/webapp/

EXPOSE 5000
CMD python /opt/webapp/app.py


Loading

0 comments on commit c091d48

Please sign in to comment.