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

Various fixes to run phppgadmin in docker #3

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# dockerfiles

[![Circle CI](https://circleci.com/gh/jacksoncage/dockerfiles/tree/master.svg?style=svg)](https://circleci.com/gh/jacksoncage/dockerfiles/tree/master)
[![Circle CI](https://circleci.com/gh/arymkus/dockerfiles/tree/master.svg?style=svg)](https://circleci.com/gh/arymkus/dockerfiles/tree/master) [![Travis CI](https://travis-ci.org/arymkus/dockerfiles.svg)](https://travis-ci.org/arymkus/dockerfiles)

Combined repo for all collected dockerfiles that I use regularly. All docker images are built and hosted on both, TBD [Docker Hub](https://hub.docker.com/u/rymkus/)

Combined repo for all collected dockerfiles that I use regularly. All docker images are built and hosted on both [Docker Hub](https://hub.docker.com/u/jacksoncage/) and [Quay.io](https://quay.io/user/jacksoncage)
31 changes: 31 additions & 0 deletions pgadmin4/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM alpine:latest
MAINTAINER Anton Rymkus <[email protected]>

ENV PGADMIN_VERSION=1.0 \
PGADMIN_SUFFIX=ReleaseCandidate1 \
PGADMIN_SUFFIX_MINI=rc1

RUN apk add --update \
wget bash postgresql-dev \
python python-dev py-pip py-crypto
RUN apk add py-psycopg2 --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/main/ --allow-untrusted

ADD config_local.py /usr/lib/python2.7/site-packages/pgadmin4/config_local.py
ADD LICENSE /usr/lib/python2.7/site-packages/pgadmin4/LICENSE

# Download
RUN wget -nv --no-check-certificate --tries=5 https://ftp.postgresql.org/pub/pgadmin3/pgadmin4/v1.0-rc1/pip/pgadmin4-1.0rc1-py2-none-any.whl -O /pgadmin4-1.0rc1-py2-none-any.whl
#ADD pgadmin4-1.0rc1-py2-none-any.whl /pgadmin4-1.0rc1-py2-none-any.whl

RUN pip install /pgadmin4-1.0rc1-py2-none-any.whl

RUN apk del wget bash \
&& rm -rf /var/cache/apk/* ;\
rm -rfv /pgadmin4-1.0rc1-py2-none-any.whl
# bash

EXPOSE 8080


CMD [ "python", "/usr/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py" ]

20 changes: 20 additions & 0 deletions pgadmin4/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
pgAdmin 4

Copyright (c) 2013 - 2016, The pgAdmin Development Team

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose, without fee, and without a written agreement is
hereby granted, provided that the above copyright notice and this paragraph and
the following two paragraphs appear in all copies.

IN NO EVENT SHALL THE PGADMIN DEVELOPMENT TEAM BE LIABLE TO ANY PARTY FOR
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST
PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
THE PGADMIN DEVELOPMENT TEAM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

THE PGADMIN DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND
THE PGADMIN DEVELOPMENT TEAM HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

232 changes: 232 additions & 0 deletions pgadmin4/config_local.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
# -*- coding: utf-8 -*-

##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2016, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
# config.py - Core application configuration settings
#
##########################################################################

from logging import *
import os

##########################################################################
# Application settings
##########################################################################

# Name of the application to display in the UI
APP_NAME = 'pgAdmin 4'
APP_ICON = 'icon-postgres-alt'

# Application version number components
APP_RELEASE = 1
APP_REVISION = 0

# Application version suffix, e.g. 'beta1', 'dev'. Usually an empty string
# for GA releases.
APP_SUFFIX = 'rc1'

# Copyright string for display in the app
APP_COPYRIGHT = 'Copyright 2013 - 2016, The pgAdmin Development Team'

# Path to the online help.
HELP_PATH = '../../../docs/en_US/_build/html/'

# Languages we support in the UI
LANGUAGES = {
'en': 'English',
'fr': 'Français'
}

# DO NOT CHANGE!
# The application version string, constructed from the components
APP_VERSION = '%s.%s-%s' % (APP_RELEASE, APP_REVISION, APP_SUFFIX)

# DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING!
# List of modules to skip when dynamically loading
MODULE_BLACKLIST = ['test']

# DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING!
# List of treeview browser nodes to skip when dynamically loading
NODE_BLACKLIST = []

##########################################################################
# Log settings
##########################################################################

# Debug mode?
DEBUG = False

# Application log level - one of:
# CRITICAL 50
# ERROR 40
# WARNING 30
# SQL 25
# INFO 20
# DEBUG 10
# NOTSET 0
CONSOLE_LOG_LEVEL = WARNING
FILE_LOG_LEVEL = INFO

# Log file name
LOG_FILE = '/dev/stdout'

##########################################################################
# Server settings
##########################################################################

# The server mode determines whether or not we're running on a web server
# requiring user authentication, or desktop mode which uses an automatic
# default login.
#
# DO NOT DISABLE SERVER MODE IF RUNNING ON A WEBSERVER!!
SERVER_MODE = False

# User ID (email address) to use for the default user in desktop mode.
# The default should be fine here, as it's not exposed in the app.
DESKTOP_USER = '[email protected]'

# This configuration otion allows the user to host the application on a LAN
# Default hosting is on localhost (DEFAULT_SERVER='localhost').
# To host pgAdmin4 over LAN set DEFAULT_SERVER='0.0.0.0' (or a specific
# adaptor address.
#
# NOTE: This is NOT recommended for production use, only for debugging
# or testing. Production installations should be run as a WSGI application
# behind Apache HTTPD.
DEFAULT_SERVER = '0.0.0.0'

# The default port on which the app server will listen if not set in the
# environment by the runtime
DEFAULT_SERVER_PORT = 8080

# Enable CSRF protection?
CSRF_ENABLED = True

# Secret key for signing CSRF data. Override this in config_local.py if
# running on a web server
CSRF_SESSION_KEY = 'SuperSecret1'

# Secret key for signing cookies. Override this in config_local.py if
# running on a web server
SECRET_KEY = 'SuperSecret2'

# Salt used when hashing passwords. Override this in config_local.py if
# running on a web server
SECURITY_PASSWORD_SALT = 'SuperSecret3'

# Hashing algorithm used for password storage
SECURITY_PASSWORD_HASH = 'pbkdf2_sha512'

# Should HTML be minified on the fly when not in debug mode?
MINIFY_HTML = True


##########################################################################
# Server Connection Driver Settings
##########################################################################

# The default driver used for making connection with PostgreSQL
PG_DEFAULT_DRIVER = 'psycopg2'

# Maximum allowed idle time in minutes before which releasing the connection
# for the particular session. (in minutes)
MAX_SESSION_IDLE_TIME = 60

##########################################################################
# User account and settings storage
##########################################################################

# The schema version number for the configuration database
# DO NOT CHANGE UNLESS YOU ARE A PGADMIN DEVELOPER!!
SETTINGS_SCHEMA_VERSION = 11

# The default path to the SQLite database used to store user accounts and
# settings. This default places the file in the same directory as this
# config file, but generates an absolute path for use througout the app.
SQLITE_PATH = '/pgadmin/config/pgadmin4.db'

# SQLITE_TIMEOUT will define how long to wait before throwing the error -
# OperationError due to database lock.
# (Default: 500 milliseconds)
SQLITE_TIMEOUT = 500

##########################################################################
# Server-side session storage path
#
# SESSION_DB_PATH (Default: $HOME/.pgadmin4/sessions)
##########################################################################
#
# We use SQLite for server-side session storage. There will be one
# SQLite database object per session created.
#
# Specify the path used to store your session objects.
#
# If the specified directory does not exist, the setup script will create
# it with permission mode 700 to keep the session database secure.
#
# On certain systems, you can use shared memory (tmpfs) for maximum
# scalability, for example, on Ubuntu:
#
# SESSION_DB_PATH = '/run/shm/pgAdmin4_session'
#
##########################################################################
SESSION_DB_PATH = '/run/shm/pgAdmin4_session'

SESSION_COOKIE_NAME = 'pga4_session'

##########################################################################
# Mail server settings
##########################################################################

# These settings are used when running in web server mode for confirming
# and resetting passwords etc.
MAIL_SERVER = 'smtp.gmail.com'
MAIL_PORT = 465
MAIL_USE_SSL = True
MAIL_USERNAME = 'username'
MAIL_PASSWORD = 'SuperSecret'

##########################################################################
# Mail content settings
##########################################################################

# These settings define the content of password reset emails
SECURITY_EMAIL_SUBJECT_PASSWORD_RESET = "Password reset instructions for %s" \
% APP_NAME
SECURITY_EMAIL_SUBJECT_PASSWORD_NOTICE = "Your %s password has been reset" \
% APP_NAME
SECURITY_EMAIL_SUBJECT_PASSWORD_CHANGE_NOTICE = \
"Your password for %s has been changed" % APP_NAME

##########################################################################
# Upgrade checks
##########################################################################

# Check for new versions of the application?
UPGRADE_CHECK_ENABLED = False

# Where should we get the data from?
UPGRADE_CHECK_URL = 'https://www.pgadmin.org/versions.json'

##########################################################################
# Storage Manager storage url config settings
# If user sets STORAGE_DIR to empty it will show all volumes if platform
# is Windows, '/' if it is Linux, Mac or any other unix type system.

# For example:
# 1. STORAGE_DIR = get_drive("C") or get_drive() # return C:/ by default
# where C can be any drive character such as "D", "E", "G" etc
# 2. Set path manually like
# STORAGE_DIR = "/path/to/directory/"
##########################################################################
STORAGE_DIR = '/pgadmin/config/storage'

##########################################################################
# Allows flask application to response to the each request asynchronously
##########################################################################
THREADED_MODE = True
10 changes: 10 additions & 0 deletions pgadmin4/readme
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'''
IMPORTANT: NOT FOR PRODUCTION USE!
authorization is disabled (pgadmin runs in the "desktop" mode)

Dockerfile and requirements for run the pgadmin4 release candidate in docker container.
Based on Alpine Linux image to lower disk usage as possible.

See https://www.pgadmin.org/

'''
8 changes: 6 additions & 2 deletions phppgadmin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

FROM debian:jessie
MAINTAINER Love Nyberg "[email protected]"
ENV REFRESHED_AT 2015-12-11
ENV REFRESHED_AT 2016-07-22

# Update the package repository
RUN DEBIAN_FRONTEND=noninteractive apt-get update -qq && \
Expand All @@ -31,8 +31,12 @@ RUN echo "deb http://packages.dotdeb.org jessie all" >> /etc/apt/sources.list.d/

# Fix phppgadmin
COPY ./phppgadmin.conf /etc/apache2/conf.d/phppgadmin
COPY ./phppgadmin.conf /etc/apache2/conf-available/phppgadmin.conf
COPY ./config.inc.php /usr/share/phppgadmin/conf/config.inc.php
COPY ./config.inc.php /etc/phppgadmin/config.inc.php
RUN sed -i 's/variables_order = "GPCS"/variables_order = "EGPCS"/g' /etc/php5/apache2/php.ini
# Fix phppgadmin's code which produces too many errors in apache's error.log
RUN sed -i "s/\$plugins = \$conf\['plugins'\]\;/\$plugins = \!empty(\$conf\['plugins'\])\?\$conf\['plugins'\]:\[\]\;/g" /usr/share/phppgadmin/classes/PluginManager.php

# Clean image
RUN apt-get -yqq clean && \
Expand All @@ -49,7 +53,7 @@ ENV APACHE_RUN_DIR /var/run/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_SERVERADMIN admin@localhost
ENV APACHE_SERVERNAME localhost
ENV POSTGRES_DEFAULTDB defaultdb
ENV POSTGRES_DEFAULTDB postgres
ENV POSTGRES_HOST localhost
ENV POSTGRES_PORT 5432

Expand Down
17 changes: 12 additions & 5 deletions phppgadmin/phppgadmin.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@ ServerName ${APACHE_SERVERNAME}
DirectoryIndex index.php
AllowOverride None

order deny,allow
deny from all
allow from 127.0.0.0/255.0.0.0 ::1/128
allow from all
<IfVersion >= 2.4>
Require local
# comment prev.line and uncomment next line to enable access from anyone
#Require all granted
</IfVersion>
<IfVersion < 2.4>
order deny,allow
deny from all
allow from 127.0.0.0/255.0.0.0 ::1/128
allow from all
</IfVersion>

<IfModule mod_php5.c>
php_flag magic_quotes_gpc Off
Expand All @@ -30,4 +37,4 @@ allow from all
</IfModule>
</IfModule>

</Directory>
</Directory>
2 changes: 1 addition & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e

# this is kind of an expensive check, so let's not do this twice if we
# are running more than one validate bundlescript
VALIDATE_REPO='https://github.com/jacksoncage/dockerfiles.git'
VALIDATE_REPO='https://github.com/arymkus/dockerfiles.git'
VALIDATE_BRANCH='master'

VALIDATE_HEAD="$(git rev-parse --verify HEAD)"
Expand Down