-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[readme.md] Updated with instructured
[web] Updated with base web app folder [db] Updated with base db folder
- Loading branch information
1 parent
60d5380
commit 24f0642
Showing
12 changed files
with
898 additions
and
33 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,2 +1,36 @@ | ||
# dockercompose | ||
Using Docker Compose to Construct linked services | ||
# Docker compose demostration for basic web application with scaling | ||
|
||
## Docker-Compose Version 2 file format used | ||
|
||
|
||
### Recreate both web and database base images | ||
|
||
```sh | ||
|
||
sh rebuild_bash_images.sh | ||
|
||
``` | ||
|
||
### Docker-Compose bring up services (without build) | ||
|
||
```sh | ||
|
||
docker-compose up | ||
|
||
``` | ||
|
||
### Docker-Compose bring up services (with build) | ||
|
||
```sh | ||
|
||
docker-compose up --build | ||
|
||
``` | ||
|
||
### Docker-Compose scale up services (web services | ||
|
||
```sh | ||
|
||
docker-compose scale web=4 | ||
|
||
``` |
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 |
---|---|---|
@@ -1,44 +1,20 @@ | ||
#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;" \ | ||
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 "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');" | ||
|
||
|
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,48 @@ | ||
FROM centos:7 | ||
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)');" | ||
|
||
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 | ||
|
||
|
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,7 @@ | ||
#!/bin/bash | ||
|
||
## Richard Keit ## | ||
|
||
|
||
## build docker file as ## | ||
docker build --no-cache -t richardkeit/basepgbrm . |
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,12 @@ | ||
#!/bin/bash | ||
|
||
## Re-build base images both Web and DB | ||
|
||
|
||
echo "Re-build base images both Web and DB \n\n" | ||
|
||
echo "Main script pwd is $PWD" | ||
cd /media/sf_git/private/DockerCompose/db/basepgbrm/ | ||
sh /media/sf_git/private/DockerCompose/db/basepgbrm/build_base.sh | ||
cd /media/sf_git/private/DockerCompose/web/baseWebImage/ | ||
sh web/baseWebImage/build_base.sh |
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,68 @@ | ||
FROM centos:7 | ||
MAINTAINER Richard Keit <[email protected]> | ||
|
||
################################## | ||
# Install EPEL repo | ||
################################## | ||
RUN yum -y install epel-release \ | ||
|
||
################################### | ||
# Installing gdal1.11, psycopg2, wget | ||
# gcc gcc-c++ python-devel make | ||
# python-lxml gdal gdal-devel | ||
# libxslt-devel libxml2-devel | ||
################################### | ||
|
||
&& yum install -y \ | ||
make \ | ||
gdal-python.x86_64 \ | ||
python-psycopg2.x86_64 \ | ||
wget \ | ||
gcc \ | ||
gcc-c++ \ | ||
python-devel \ | ||
python-lxml \ | ||
gdal \ | ||
gdal-devel \ | ||
libxslt-devel \ | ||
libxml2-devel \ | ||
python-reportlab | ||
|
||
################################## | ||
# Adding get-pip.py, | ||
# libspatialindex & pipinstall.sh | ||
# Update Pip | ||
################################## | ||
|
||
RUN wget https://bootstrap.pypa.io/get-pip.py \ | ||
&& mkdir /tmp/spatialindex \ | ||
&& wget --directory-prefix=/tmp/spatialindex/ http://download.osgeo.org/libspatialindex/spatialindex-src-1.7.0.tar.gz \ | ||
&& python get-pip.py | ||
|
||
COPY pipinstall.sh /tmp/ | ||
|
||
################################## | ||
# Build SpatialIndex | ||
# Credit pvillard/agdc-docker | ||
################################# | ||
|
||
RUN tar -xvzf /tmp/spatialindex/spatialindex-src-1.7.0.tar.gz -C /tmp/spatialindex \ | ||
&& cd /tmp/spatialindex/spatialindex-src-1.7.0/ \ | ||
&& ./configure; make; make install \ | ||
&& echo export LD_LIBRARY_PATH=/usr/local/lib/ >> /root/.bashrc && source /root/.bashrc \ | ||
&& pip install Rtree | ||
|
||
|
||
################################# | ||
# Install other Pip modules | ||
################################ | ||
|
||
|
||
RUN /tmp/pipinstall.sh && pip list && mkdir -p /opt/webapp | ||
#ADD . /opt/webapp/ | ||
|
||
EXPOSE 5000 | ||
#CMD python /opt/webapp/app.py | ||
|
||
|
||
|
Oops, something went wrong.