Skip to content

Commit

Permalink
Update docker setup.
Browse files Browse the repository at this point in the history
To build and run:
    $ cp example.env.yml env.yml
    # add fb app id and secret to eny.yml
    $ docker build -t afra .
    $ docker run -itp 9292:9292 afra

Signed-off-by: Saurabh Kumar <[email protected]>
  • Loading branch information
sa1 authored and yeban committed Nov 17, 2014
1 parent 55c4e70 commit b5cf4ad
Show file tree
Hide file tree
Showing 6 changed files with 176 additions and 42 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
.git
Gemfile.lock
MYMETA.yml
MYMETA.json
Makefile
.extlib
node_modules
www/lib
node_modules
data/jbrowse
data/genevalidator
75 changes: 69 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,74 @@
#
# VERSION 0.0.1

FROM bmpvieira/afra-environment
FROM debian:sid
MAINTAINER Anurag Priyam <[email protected]>

USER root
ADD . /afra
WORKDIR /afra
RUN ./scripts/build.sh
ENTRYPOINT ["./scripts/run.sh"]
RUN echo 'APT::Install-Recommends "false";' >> /etc/apt/apt.conf
RUN echo 'APT::Install-Suggests "false";' >> /etc/apt/apt.conf

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
apt-utils locales build-essential git curl openssl ca-certificates && \
rm -rf /var/lib/apt/lists/*

# FIXME:
# Added this line so that Postgres will be UTF-8 by default. However, it
# doesn't seem to have any effect - Postgres has the default 'C' locale.
RUN localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG en_US.utf8

## Setup Ruby.
RUN cd /tmp/ && \
curl -o ruby-install-0.5.0.tar.gz -L https://github.com/postmodern/ruby-install/archive/v0.5.0.tar.gz && \
tar xvf ruby-install-0.5.0.tar.gz && \
cd ruby-install-0.5.0/ && \
make install && \
cd /tmp/ && \
curl -o chruby-0.3.8.tar.gz -L https://github.com/postmodern/chruby/archive/v0.3.8.tar.gz && \
tar xvf chruby-0.3.8.tar.gz && \
cd chruby-0.3.8/ && \
make install && \
cd / && rm -rf /tmp/*

RUN apt-get update && \
ruby-install ruby 2.1.4 -- --disable-install-rdoc && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/*

## Setup NodeJS and npm.
# FIXME:
# This pulls in a lot of packages. Consider using pre-built binaries.
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
nodejs nodejs-legacy npm && \
rm -rf /var/lib/apt/lists/*

## Setup Postgres.
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
postgresql postgresql-contrib postgresql-client libpq-dev \
libexpat1-dev libperlio-gzip-perl && \
rm -rf /var/lib/apt/lists/*

RUN /etc/init.d/postgresql start &&\
su postgres -c "psql --command \"CREATE USER afra WITH SUPERUSER PASSWORD 'afra';\"" \
&& /etc/init.d/postgresql stop

COPY etc/postgresql/9.4/main/pg_hba.conf /etc/postgresql/9.4/main/

RUN chmod 644 /etc/postgresql/9.4/main/pg_hba.conf

## Setup Afra

RUN groupadd -r afra && useradd -m -g afra afra

COPY . /home/afra/src

RUN chown -R afra /home/afra/src/

WORKDIR /home/afra/src

RUN /etc/init.d/postgresql start && su afra -s /bin/bash -c "source /usr/local/share/chruby/chruby.sh && chruby ruby-2.1.4 && /usr/local/src/ruby-2.1.4/bin/rake" && /etc/init.d/postgresql stop

CMD /etc/init.d/postgresql start && su afra -s /bin/bash -c "source /usr/local/share/chruby/chruby.sh && chruby ruby-2.1.4 && /usr/local/src/ruby-2.1.4/bin/rake serve"
9 changes: 0 additions & 9 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,6 @@ fi;
set -e;
bin/cpanm -v --notest -l $PWD/.extlib/ --installdeps . < /dev/null;
);
if [ $? == 0 ]; then
echo "Done."
touch ".rake/pl"
else
echo "Failed."
echo "As a first troubleshooting step, make sure development libraries and
header files for Zlib are installed and try again.";
fi
SH
end

Expand Down
99 changes: 99 additions & 0 deletions etc/postgresql/9.4/main/pg_hba.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# PostgreSQL Client Authentication Configuration File
# ===================================================
#
# Refer to the "Client Authentication" section in the PostgreSQL
# documentation for a complete description of this file. A short
# synopsis follows.
#
# This file controls: which hosts are allowed to connect, how clients
# are authenticated, which PostgreSQL user names they can use, which
# databases they can access. Records take one of these forms:
#
# local DATABASE USER METHOD [OPTIONS]
# host DATABASE USER ADDRESS METHOD [OPTIONS]
# hostssl DATABASE USER ADDRESS METHOD [OPTIONS]
# hostnossl DATABASE USER ADDRESS METHOD [OPTIONS]
#
# (The uppercase items must be replaced by actual values.)
#
# The first field is the connection type: "local" is a Unix-domain
# socket, "host" is either a plain or SSL-encrypted TCP/IP socket,
# "hostssl" is an SSL-encrypted TCP/IP socket, and "hostnossl" is a
# plain TCP/IP socket.
#
# DATABASE can be "all", "sameuser", "samerole", "replication", a
# database name, or a comma-separated list thereof. The "all"
# keyword does not match "replication". Access to replication
# must be enabled in a separate record (see example below).
#
# USER can be "all", a user name, a group name prefixed with "+", or a
# comma-separated list thereof. In both the DATABASE and USER fields
# you can also write a file name prefixed with "@" to include names
# from a separate file.
#
# ADDRESS specifies the set of hosts the record matches. It can be a
# host name, or it is made up of an IP address and a CIDR mask that is
# an integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that
# specifies the number of significant bits in the mask. A host name
# that starts with a dot (.) matches a suffix of the actual host name.
# Alternatively, you can write an IP address and netmask in separate
# columns to specify the set of hosts. Instead of a CIDR-address, you
# can write "samehost" to match any of the server's own IP addresses,
# or "samenet" to match any address in any subnet that the server is
# directly connected to.
#
# METHOD can be "trust", "reject", "md5", "password", "gss", "sspi",
# "ident", "peer", "pam", "ldap", "radius" or "cert". Note that
# "password" sends passwords in clear text; "md5" is preferred since
# it sends encrypted passwords.
#
# OPTIONS are a set of options for the authentication in the format
# NAME=VALUE. The available options depend on the different
# authentication methods -- refer to the "Client Authentication"
# section in the documentation for a list of which options are
# available for which authentication methods.
#
# Database and user names containing spaces, commas, quotes and other
# special characters must be quoted. Quoting one of the keywords
# "all", "sameuser", "samerole" or "replication" makes the name lose
# its special character, and just match a database or username with
# that name.
#
# This file is read on server startup and when the postmaster receives
# a SIGHUP signal. If you edit the file on a running system, you have
# to SIGHUP the postmaster for the changes to take effect. You can
# use "pg_ctl reload" to do that.

# Put your actual configuration here
# ----------------------------------
#
# If you want to allow non-local connections, you need to add more
# "host" records. In that case you will also need to make PostgreSQL
# listen on a non-local interface via the listen_addresses
# configuration parameter, or via the -i or -h command line switches.




# DO NOT DISABLE!
# If you change this first entry you will need to make sure that the
# database superuser can access the database using some other method.
# Noninteractive access to all databases is required during automatic
# maintenance (custom daily cronjobs, replication, and similar tasks).
#
# Database administrative login by Unix domain socket
local all postgres peer

# TYPE DATABASE USER ADDRESS METHOD

# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres peer
#host replication postgres 127.0.0.1/32 md5
#host replication postgres ::1/128 md5
21 changes: 0 additions & 21 deletions scripts/build.sh

This file was deleted.

6 changes: 0 additions & 6 deletions scripts/run.sh

This file was deleted.

0 comments on commit b5cf4ad

Please sign in to comment.