[Mayan EDMS: 1705] Mayan in Docker with PostgreSQL

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Mayan EDMS: 1705] Mayan in Docker with PostgreSQL

Jbr SOLUÇÕES
Would anyone have an example of Dockerfile installing Mayan with Postgres ?

I tried with this and it did not work

NameError: name 'TEMPLATES' is not defined

FROM ubuntu:16.04

MAINTAINER Roberto Rosario "[hidden email]"


ENV DEBIAN_FRONTEND noninteractive

ENV MAYAN_USE_POSTGRES True

ENV POSTGRES_DB mayan
ENV POSTGRES_USER mayan
ENV POSTGRES_PASSWORD mayan
ENV POSTGRES_HOST localhost
ENV PORTGRES_PORT 5432

ARG APT_PROXY
# Package caching
RUN if [ "${APT_PROXY}" ]; then echo "Acquire::http { Proxy \"http://${APT_PROXY}\"; };" > /etc/apt/apt.conf.d/01proxy; fi

# Install base Ubuntu libraries
RUN apt-get update && \

apt-get install -y --no-install-recommends \
postgresql \
libpq-dev \
gcc \
ghostscript \
gpgv \
libjpeg-dev \
libmagic1 \
libpng-dev \
libpq-dev \
libreoffice \
libtiff-dev \
nginx \
netcat-openbsd \
poppler-utils \
python-dev \
python-pip \
python-setuptools \
python-wheel \
redis-server \
supervisor \
tesseract-ocr \

&& \

apt-get clean autoclean && \

apt-get autoremove -y && \

rm -rf /var/lib/apt/lists/* && \

rm -f /var/cache/apt/archives/*.deb

ENV MAYAN_INSTALL_DIR=/usr/local/lib/python2.7/dist-packages/mayan

# Update to latest version of pip
RUN pip install -U pip

USER postgres
RUN /etc/init.d/postgresql start &&\
psql --command "CREATE USER mayan WITH SUPERUSER PASSWORD 'mayan';" && \
createdb -O mayan mayan;

RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.5/main/pg_hba.conf

RUN echo "listen_addresses='*'" >> /etc/postgresql/9.5/main/postgresql.conf

EXPOSE 5432

USER root

# Install Mayan EDMS, latest production release
COPY mayan-edms-2.2.tar.gz /opt/
RUN pip install /opt/mayan-edms-2.2.tar.gz
# RUN pip install mayan-edms==2.2

# Install Python clients for PostgreSQL, REDIS, librabbitmq and uWSGI
RUN pip install psycopg2 redis uwsgi

# Collect static files
RUN mayan-edms.py collectstatic --noinput

# Setup uWSGI
COPY etc/uwsgi/uwsgi.ini $MAYAN_INSTALL_DIR

# Setup NGINX
COPY /etc/nginx/mayan-edms /etc/nginx/sites-available/mayan-edms
RUN rm /etc/nginx/sites-enabled/default
RUN ln -s /etc/nginx/sites-available/mayan-edms /etc/nginx/sites-enabled/mayan-edms

# Setup supervisor
COPY /etc/supervisor/beat.conf /etc/supervisor/conf.d
COPY /etc/supervisor/nginx.conf /etc/supervisor/conf.d
COPY /etc/supervisor/uwsgi.conf /etc/supervisor/conf.d
COPY /etc/supervisor/redis.conf /etc/supervisor/conf.d
COPY /etc/supervisor/workers.conf /etc/supervisor/conf.d

# Setup Mayan EDMS settings file overrides
COPY etc/mayan/settings.py /local.py
COPY etc/mayan/postgres.py $MAYAN_INSTALL_DIR/settings/postgres.py

# Create the directory for the logs
RUN mkdir /var/log/mayan

RUN mkdir -p $MAYAN_INSTALL_DIR/media/document_storage/

# Fix ownership
RUN chown -R www-data:www-data $MAYAN_INSTALL_DIR

# Make volume symlinks
RUN ln -s $MAYAN_INSTALL_DIR/media /var/lib/mayan
RUN ln -s $MAYAN_INSTALL_DIR/settings /etc/mayan
RUN chown www-data:www-data /var/lib/mayan
RUN chown www-data:www-data /etc/mayan

#TESTES
RUN /etc/init.d/postgresql start && \
mayan-edms.py initialsetup
RUN cat /local.py >> /usr/local/lib/python2.7/dist-packages/mayan/settings/local.py
RUN chown -R www-data:www-data /usr/local/lib/python2.7/dist-packages/mayan/

VOLUME ["/etc/mayan", "/var/lib/mayan"]
VOLUME ["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"]

COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
CMD ["mayan:start"]

--

---
You received this message because you are subscribed to the Google Groups "Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

[Mayan EDMS: 1708] Re: Mayan in Docker with PostgreSQL

Prasanjit Biswas
I think this is not yet possible. issue- https://gitlab.com/mayan-edms/mayan-edms-docker/issues/7

On Friday, 12 May 2017 23:21:12 UTC+5:30, Jbr SOLUÇÕES wrote:
Would anyone have an example of Dockerfile installing Mayan with Postgres ?

I tried with this and it did not work

NameError: name 'TEMPLATES' is not defined

FROM ubuntu:16.04

MAINTAINER Roberto Rosario "<a href="javascript:" target="_blank" gdf-obfuscated-mailto="17MV77o1AAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">roberto...@mayan-edms.com"


ENV DEBIAN_FRONTEND noninteractive

ENV MAYAN_USE_POSTGRES True

ENV POSTGRES_DB mayan
ENV POSTGRES_USER mayan
ENV POSTGRES_PASSWORD mayan
ENV POSTGRES_HOST localhost
ENV PORTGRES_PORT 5432

ARG APT_PROXY
# Package caching
RUN if [ "${APT_PROXY}" ]; then echo "Acquire::http { Proxy \"http://${APT_PROXY}\"; };" > /etc/apt/apt.conf.d/01proxy; fi

# Install base Ubuntu libraries
RUN apt-get update && \

apt-get install -y --no-install-recommends \
postgresql \
libpq-dev \
gcc \
ghostscript \
gpgv \
libjpeg-dev \
libmagic1 \
libpng-dev \
libpq-dev \
libreoffice \
libtiff-dev \
nginx \
netcat-openbsd \
poppler-utils \
python-dev \
python-pip \
python-setuptools \
python-wheel \
redis-server \
supervisor \
tesseract-ocr \

&& \

apt-get clean autoclean && \

apt-get autoremove -y && \

rm -rf /var/lib/apt/lists/* && \

rm -f /var/cache/apt/archives/*.deb

ENV MAYAN_INSTALL_DIR=/usr/local/lib/python2.7/dist-packages/mayan

# Update to latest version of pip
RUN pip install -U pip

USER postgres
RUN /etc/init.d/postgresql start &&\
psql --command "CREATE USER mayan WITH SUPERUSER PASSWORD 'mayan';" && \
createdb -O mayan mayan;

RUN echo "host all all <a href="http://0.0.0.0/0" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F0.0.0.0%2F0\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNETOu60a3HCyMN138-VZlWuvaAA1A&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F0.0.0.0%2F0\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNETOu60a3HCyMN138-VZlWuvaAA1A&#39;;return true;">0.0.0.0/0 md5" >> /etc/postgresql/9.5/main/pg_hba.conf

RUN echo "listen_addresses='*'" >> /etc/postgresql/9.5/main/postgresql.conf

EXPOSE 5432

USER root

# Install Mayan EDMS, latest production release
COPY mayan-edms-2.2.tar.gz /opt/
RUN pip install /opt/mayan-edms-2.2.tar.gz
# RUN pip install mayan-edms==2.2

# Install Python clients for PostgreSQL, REDIS, librabbitmq and uWSGI
RUN pip install psycopg2 redis uwsgi

# Collect static files
RUN mayan-edms.py collectstatic --noinput

# Setup uWSGI
COPY etc/uwsgi/uwsgi.ini $MAYAN_INSTALL_DIR

# Setup NGINX
COPY /etc/nginx/mayan-edms /etc/nginx/sites-available/mayan-edms
RUN rm /etc/nginx/sites-enabled/default
RUN ln -s /etc/nginx/sites-available/mayan-edms /etc/nginx/sites-enabled/mayan-edms

# Setup supervisor
COPY /etc/supervisor/beat.conf /etc/supervisor/conf.d
COPY /etc/supervisor/nginx.conf /etc/supervisor/conf.d
COPY /etc/supervisor/uwsgi.conf /etc/supervisor/conf.d
COPY /etc/supervisor/redis.conf /etc/supervisor/conf.d
COPY /etc/supervisor/workers.conf /etc/supervisor/conf.d

# Setup Mayan EDMS settings file overrides
COPY etc/mayan/settings.py /local.py
COPY etc/mayan/postgres.py $MAYAN_INSTALL_DIR/settings/postgres.py

# Create the directory for the logs
RUN mkdir /var/log/mayan

RUN mkdir -p $MAYAN_INSTALL_DIR/media/document_storage/

# Fix ownership
RUN chown -R www-data:www-data $MAYAN_INSTALL_DIR

# Make volume symlinks
RUN ln -s $MAYAN_INSTALL_DIR/media /var/lib/mayan
RUN ln -s $MAYAN_INSTALL_DIR/settings /etc/mayan
RUN chown www-data:www-data /var/lib/mayan
RUN chown www-data:www-data /etc/mayan

#TESTES
RUN /etc/init.d/postgresql start && \
mayan-edms.py initialsetup
RUN cat /local.py >> /usr/local/lib/python2.7/dist-packages/mayan/settings/local.py
RUN chown -R www-data:www-data /usr/local/lib/python2.7/dist-packages/mayan/

VOLUME ["/etc/mayan", "/var/lib/mayan"]
VOLUME ["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"]

COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
CMD ["mayan:start"]

--

---
You received this message because you are subscribed to the Google Groups "Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

[Mayan EDMS: 1709] Re: Mayan in Docker with PostgreSQL

rosarior
Administrator
Working precisely on this and other improvements at the moment: https://gitlab.com/mayan-edms/mayan-edms-docker/commit/1e523e29c691adc2887f67481d2923b7abf8a804

From the working changelog:

- Allow changing the database backend (postgres working, MySQL untested).
- Allow changing the Celery broker
- Allow changing the Celery results backend
- Add a dedicated image converter worker
- Implement single installation step
- Implement single volume solution
- Increase NGINX max file size to 500 MB
- Increase NGINX file transfer timeout to 600 seconds
- When overrided, the database settings will add the option to keep connections
  alive with a default of 60 seconds. ('CONN_MAX_AGE': 60)

New environment variables:

- MAYAN_DATABASE_DRIVER, default: None
- MAYAN_DATABASE_NAME, default : 'mayan'
- MAYAN_DATABASE_USER, default: 'mayan'
- MAYAN_DATABASE_PASSWORD, default: ''
- MAYAN_DATABASE_HOST, default: None
- MAYAN_DATABASE_PORT, default: None
- MAYAN_BROKER_URL, default: 'redis://127.0.0.1:6379/0'
- MAYAN_CELERY_RESULT_BACKEND, default: 'redis://127.0.0.1:6379/0'

- If the MAYAN_BROKER_URL and MAYAN_CELERY_RESULT_BACKEND are specified the built in
  REDIS server is disabled.

Help with testing needed.

Also would like to add automated testing for the image. Trying out testinfra (https://github.com/philpep/testinfra), but anything like ServerSpec or RSpec is welcomed too.

On Monday, May 15, 2017 at 3:09:59 AM UTC-4, Prasanjit Biswas wrote:
I think this is not yet possible. issue- <a href="https://gitlab.com/mayan-edms/mayan-edms-docker/issues/7" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgitlab.com%2Fmayan-edms%2Fmayan-edms-docker%2Fissues%2F7\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFityPhmfVfOyWra0S5-y9tEIV1eQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgitlab.com%2Fmayan-edms%2Fmayan-edms-docker%2Fissues%2F7\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFityPhmfVfOyWra0S5-y9tEIV1eQ&#39;;return true;">https://gitlab.com/mayan-edms/mayan-edms-docker/issues/7

On Friday, 12 May 2017 23:21:12 UTC+5:30, Jbr SOLUÇÕES wrote:
Would anyone have an example of Dockerfile installing Mayan with Postgres ?

I tried with this and it did not work

NameError: name 'TEMPLATES' is not defined

FROM ubuntu:16.04

MAINTAINER Roberto Rosario "[hidden email]"


ENV DEBIAN_FRONTEND noninteractive

ENV MAYAN_USE_POSTGRES True

ENV POSTGRES_DB mayan
ENV POSTGRES_USER mayan
ENV POSTGRES_PASSWORD mayan
ENV POSTGRES_HOST localhost
ENV PORTGRES_PORT 5432

ARG APT_PROXY
# Package caching
RUN if [ "${APT_PROXY}" ]; then echo "Acquire::http { Proxy \"http://${APT_PROXY}\"; };" > /etc/apt/apt.conf.d/01proxy; fi

# Install base Ubuntu libraries
RUN apt-get update && \

apt-get install -y --no-install-recommends \
postgresql \
libpq-dev \
gcc \
ghostscript \
gpgv \
libjpeg-dev \
libmagic1 \
libpng-dev \
libpq-dev \
libreoffice \
libtiff-dev \
nginx \
netcat-openbsd \
poppler-utils \
python-dev \
python-pip \
python-setuptools \
python-wheel \
redis-server \
supervisor \
tesseract-ocr \

&& \

apt-get clean autoclean && \

apt-get autoremove -y && \

rm -rf /var/lib/apt/lists/* && \

rm -f /var/cache/apt/archives/*.deb

ENV MAYAN_INSTALL_DIR=/usr/local/lib/python2.7/dist-packages/mayan

# Update to latest version of pip
RUN pip install -U pip

USER postgres
RUN /etc/init.d/postgresql start &&\
psql --command "CREATE USER mayan WITH SUPERUSER PASSWORD 'mayan';" && \
createdb -O mayan mayan;

RUN echo "host all all <a href="http://0.0.0.0/0" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F0.0.0.0%2F0\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNETOu60a3HCyMN138-VZlWuvaAA1A&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F0.0.0.0%2F0\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNETOu60a3HCyMN138-VZlWuvaAA1A&#39;;return true;">0.0.0.0/0 md5" >> /etc/postgresql/9.5/main/pg_hba.conf

RUN echo "listen_addresses='*'" >> /etc/postgresql/9.5/main/postgresql.conf

EXPOSE 5432

USER root

# Install Mayan EDMS, latest production release
COPY mayan-edms-2.2.tar.gz /opt/
RUN pip install /opt/mayan-edms-2.2.tar.gz
# RUN pip install mayan-edms==2.2

# Install Python clients for PostgreSQL, REDIS, librabbitmq and uWSGI
RUN pip install psycopg2 redis uwsgi

# Collect static files
RUN mayan-edms.py collectstatic --noinput

# Setup uWSGI
COPY etc/uwsgi/uwsgi.ini $MAYAN_INSTALL_DIR

# Setup NGINX
COPY /etc/nginx/mayan-edms /etc/nginx/sites-available/mayan-edms
RUN rm /etc/nginx/sites-enabled/default
RUN ln -s /etc/nginx/sites-available/mayan-edms /etc/nginx/sites-enabled/mayan-edms

# Setup supervisor
COPY /etc/supervisor/beat.conf /etc/supervisor/conf.d
COPY /etc/supervisor/nginx.conf /etc/supervisor/conf.d
COPY /etc/supervisor/uwsgi.conf /etc/supervisor/conf.d
COPY /etc/supervisor/redis.conf /etc/supervisor/conf.d
COPY /etc/supervisor/workers.conf /etc/supervisor/conf.d

# Setup Mayan EDMS settings file overrides
COPY etc/mayan/settings.py /local.py
COPY etc/mayan/postgres.py $MAYAN_INSTALL_DIR/settings/postgres.py

# Create the directory for the logs
RUN mkdir /var/log/mayan

RUN mkdir -p $MAYAN_INSTALL_DIR/media/document_storage/

# Fix ownership
RUN chown -R www-data:www-data $MAYAN_INSTALL_DIR

# Make volume symlinks
RUN ln -s $MAYAN_INSTALL_DIR/media /var/lib/mayan
RUN ln -s $MAYAN_INSTALL_DIR/settings /etc/mayan
RUN chown www-data:www-data /var/lib/mayan
RUN chown www-data:www-data /etc/mayan

#TESTES
RUN /etc/init.d/postgresql start && \
mayan-edms.py initialsetup
RUN cat /local.py >> /usr/local/lib/python2.7/dist-packages/mayan/settings/local.py
RUN chown -R www-data:www-data /usr/local/lib/python2.7/dist-packages/mayan/

VOLUME ["/etc/mayan", "/var/lib/mayan"]
VOLUME ["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"]

COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
CMD ["mayan:start"]

--

---
You received this message because you are subscribed to the Google Groups "Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.