Commit 7c17d200 authored by Stefano Alberto Russo's avatar Stefano Alberto Russo
Browse files

Added the Postgres and Proxy services. Minor fixes in the docker-compose.

parent 1016fca1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -16,3 +16,4 @@ data*

# DB conf
services/webapp/db_conf.sh
services/proxy/certificates
+25 −1
Original line number Diff line number Diff line
@@ -37,6 +37,15 @@ services:
    ports:
      - "5000:5000"

  postgres:
    image: "rosetta/postgres"
    container_name: postgres
    hostname: postgres
    environment:
      - SAFEMODE=False
    volumes:
      - ./data_rosetta/postgres/data:/data    

  webapp:
    image: "rosetta/webapp"
    container_name: webapp
@@ -50,6 +59,9 @@ services:
      #- ROSETTA_WEBAPP_PORT=8080
      #- LOCAL_DOCKER_REGISTRY_HOST=
      #- LOCAL_DOCKER_REGISTRY_PORT=5000
      #- DJANGO_EMAIL_APIKEY=""
      #- DJANGO_EMAIL_FROM="Rosetta Platform <notifications@rosetta.platform>"
      #- DJANGO_PUBLIC_HTTP_HOST=http://localhost:8080
    ports:
      - "8080:8080"
      - "8000:8590"
@@ -59,7 +71,19 @@ services:
      - ./data_rosetta/webapp/data:/data
      - ./data_rosetta/webapp/log:/var/log/webapp
      - /var/run/docker.sock:/var/run/docker.sock
      #- ./services/webapp/code:/opt/webapp_code
      - ./services/webapp/code:/opt/webapp_code

  proxy:
    image: "rosetta/proxy"
    container_name: proxy
    hostname: proxy
    environment:
      - SAFEMODE=False
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./data_rosetta/proxy/data:/data    



+2 −1
Original line number Diff line number Diff line
@@ -36,7 +36,8 @@ if [[ "x$SERVICE" == "x" ]] ; then
    $BUILD_COMMAND services/slurmclusterworker -t rosetta/slurmclusterworker    
    $BUILD_COMMAND services/dregistry -t rosetta/dregistry
    $BUILD_COMMAND services/webapp -t rosetta/webapp

    $BUILD_COMMAND services/postgres -t rosetta/postgres
    $BUILD_COMMAND services/proxy -t rosetta/proxy
    
else

+9 −0
Original line number Diff line number Diff line
@@ -7,3 +7,12 @@ if [ ! -f services/webapp/db_conf.sh ]; then
else
    echo "Not using dev webapp database settings as settings are already present."
fi


# Use dev (local) database for backend
if [ ! -d services/proxy/certificates ]; then
    echo "Using dev certificates."
    cp -a services/proxy/certificates-dev  services/proxy/certificates
else
    echo "Not using dev certificates as certificates are already present."
fi
+48 −0
Original line number Diff line number Diff line
FROM rosetta/base
MAINTAINER Stefano Alberto Russo <stefano.russo@gmail.com>

# Always start with an apt-get update when extending Reyns images,
# otherwise apt repositories might get outdated (404 not found)
# and building without cache does not re-build Reyns services.
RUN apt-get update

#------------------------
# Install Postgres 11
#------------------------

# Add repo
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main" >> /etc/apt/sources.list.d/pgdg.list
RUN wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -

RUN apt-get update
RUN apt-get install -y postgresql-11

# Copy conf 
RUN mv /etc/postgresql/11/main/pg_hba.conf /etc/postgresql/11/main/pg_hba.conf.or
COPY pg_hba.conf /etc/postgresql/11/main/pg_hba.conf
COPY postgresql.conf /etc/postgresql/11/main/postgresql.conf

# Chown conf
RUN chown -R postgres:postgres /etc/postgresql

# Create user/db script
COPY create_rosetta_DB_and_user.sql /
RUN chown postgres:postgres /create_rosetta_DB_and_user.sql

# Prestartup
COPY prestartup_postgres.sh /prestartup/

#------------------------
# Postgres on Supervisor
#------------------------

COPY run_postgres.sh /etc/supervisor/conf.d/
RUN chmod 755 /etc/supervisor/conf.d/run_postgres.sh
COPY supervisord_postgres.conf /etc/supervisor/conf.d/

#------------------------
# Security
#------------------------

# Disable SSH
RUN rm /etc/supervisor/conf.d/supervisord_sshd.conf
Loading