[ADD][WIP]Frappé/ERPNext own images (not finished)
This commit is contained in:
parent
ede9cee570
commit
da5b752014
17
frappe/Dockerfile.erpnext7
Normal file
17
frappe/Dockerfile.erpnext7
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
FROM lukptr/ubuntu:16.04-23112016
|
||||||
|
MAINTAINER lukptr <lukptr@ridhosribumi.com>
|
||||||
|
|
||||||
|
ENV FRAPPE_USER=frappe \
|
||||||
|
MYSQL_PASSWORD=12345678 \
|
||||||
|
ADMIN_PASSWORD=12345678 \
|
||||||
|
DEBIAN_FRONTEND=noninteractive
|
||||||
|
RUN useradd $FRAPPE_USER && mkdir /home/$FRAPPE_USER && chown -R $FRAPPE_USER.$FRAPPE_USER /home/$FRAPPE_USER
|
||||||
|
WORKDIR /home/$FRAPPE_USER
|
||||||
|
RUN wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py && sed -i "s/'', ''/'$MYSQL_PASSWORD', '$ADMIN_PASSWORD'/g" install.py && \
|
||||||
|
apt update && python install.py --production --user $FRAPPE_USER
|
||||||
|
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/ /home/$FRAPPE_USER/.cache
|
||||||
|
COPY production.conf /etc/supervisor/conf.d/
|
||||||
|
WORKDIR /home/$FRAPPE_USER/frappe-bench
|
||||||
|
EXPOSE 80 25
|
||||||
|
|
||||||
|
CMD ["/usr/bin/supervisord","-n"]
|
47
frappe/base.yml
Normal file
47
frappe/base.yml
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
version: '2.2'
|
||||||
|
services:
|
||||||
|
|
||||||
|
frappebase:
|
||||||
|
init: true
|
||||||
|
build: ./frappe
|
||||||
|
image: registry.yaltik.net/frappe:yaltik
|
||||||
|
environment:
|
||||||
|
FRAPPE_USER: frappe
|
||||||
|
MYSQL_PASSWORD: somethingToChange
|
||||||
|
ADMIN_PASSWORD: somethingToChange
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
|
||||||
|
frappedev:
|
||||||
|
extends:
|
||||||
|
service: frappebase
|
||||||
|
build:
|
||||||
|
context: ./frappe
|
||||||
|
dockerfile: Dockerfile.dev
|
||||||
|
image: registry.yaltik.net/frappe:yaltikdev
|
||||||
|
ports:
|
||||||
|
- 8000:8000
|
||||||
|
- 9000:9000
|
||||||
|
- 6787:6787
|
||||||
|
- 8001:80
|
||||||
|
|
||||||
|
frappeprod:
|
||||||
|
extends:
|
||||||
|
service: frappebase
|
||||||
|
build:
|
||||||
|
context: ./frappe
|
||||||
|
dockerfile: Dockerfile.prod
|
||||||
|
image: registry.yaltik.net/frappe:yaltikprod
|
||||||
|
ports:
|
||||||
|
- 8000:8000
|
||||||
|
- 9000:9000
|
||||||
|
- 6787:6787
|
||||||
|
- 80:80
|
||||||
|
|
||||||
|
# erpnext:
|
||||||
|
# erinit: true
|
||||||
|
# erbuild: ./erpnext
|
||||||
|
# erimage: registry.yaltik.net/eprnext:yaltik
|
||||||
|
# erenvironment:
|
||||||
|
# er POSTGRES_USER: odoo
|
||||||
|
# er POSTGRES_PASSWORD: somethingToChange
|
25
frappe/frappe/Dockerfile
Normal file
25
frappe/frappe/Dockerfile
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
FROM ubuntu:16.04
|
||||||
|
MAINTAINER Yaltik - Fabien Bourgeois <fabien@yaltik.com>
|
||||||
|
|
||||||
|
# Environment variables
|
||||||
|
ENV FRAPPE_USER=frappe \
|
||||||
|
MYSQL_PASSWORD=somethingToChange \
|
||||||
|
ADMIN_PASSWORD=somethingToChange
|
||||||
|
|
||||||
|
# Global dependencies
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y sudo curl
|
||||||
|
# Frappe dependencies
|
||||||
|
RUN apt-get install -y python-minimal build-essential python-setuptools
|
||||||
|
|
||||||
|
# Create frappe user
|
||||||
|
RUN useradd $FRAPPE_USER -m
|
||||||
|
# RUN usermod -aG sudo $FRAPPE_USER
|
||||||
|
RUN echo "$FRAPPE_USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/frappe
|
||||||
|
WORKDIR /home/$FRAPPE_USER
|
||||||
|
|
||||||
|
# Install frappe
|
||||||
|
RUN curl -LO https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
|
||||||
|
|
||||||
|
# Volumes : data dir
|
||||||
|
VOLUME /home/$FRAPPE_USER/
|
11
frappe/frappe/Dockerfile.dev
Normal file
11
frappe/frappe/Dockerfile.dev
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
FROM registry.yaltik.net/frappe:yaltik
|
||||||
|
MAINTAINER Yaltik - Fabien Bourgeois <fabien@yaltik.com>
|
||||||
|
|
||||||
|
# Frappe development setup
|
||||||
|
|
||||||
|
RUN python install.py --develop --user $FRAPPE_USER --mysql-root-password $MYSQL_PASSWORD --admin-password $ADMIN_PASSWORD
|
||||||
|
USER frappe
|
||||||
|
WORKDIR /home/$FRAPPE_USER/frappe-bench
|
||||||
|
|
||||||
|
EXPOSE 8000 9000 6787
|
||||||
|
|
51
frappe/frappe/Dockerfile.manual
Normal file
51
frappe/frappe/Dockerfile.manual
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
FROM ubuntu:16.04
|
||||||
|
MAINTAINER Yaltik - Fabien Bourgeois <fabien@yaltik.com>
|
||||||
|
|
||||||
|
# Environment variables
|
||||||
|
ENV FRAPPE_USER=frappe \
|
||||||
|
MYSQL_PASSWORD=somethingToChange \
|
||||||
|
ADMIN_PASSWORD=somethingToChange
|
||||||
|
|
||||||
|
# Global dependencies
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y sudo curl wget
|
||||||
|
RUN apt-get install -y git build-essential python-setuptools python-pip python-dev libffi-dev libssl-dev
|
||||||
|
RUN apt-get install -y python-minimal build-essential python-setuptools
|
||||||
|
RUN pip install --upgrade setuptools pip
|
||||||
|
|
||||||
|
# Create frappe user
|
||||||
|
RUN useradd $FRAPPE_USER -m
|
||||||
|
# RUN usermod -aG sudo $FRAPPE_USER
|
||||||
|
RUN echo "$FRAPPE_USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/frappe
|
||||||
|
WORKDIR /home/$FRAPPE_USER
|
||||||
|
|
||||||
|
# Ubuntu package install
|
||||||
|
RUN apt-get install -y build-essential redis-server software-properties-common libxrender1 libxext6 xfonts-75dpi xfonts-base libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev python-tk apt-transport-https libsasl2-dev libldap2-dev libtiff5-dev tcl8.6-dev tk8.6-dev
|
||||||
|
|
||||||
|
# NodeJS external repository
|
||||||
|
RUN echo "deb [arch=amd64,i386] https://deb.nodesource.com/node_6.x xenial main" \
|
||||||
|
> /etc/apt/sources.list.d/nodesource.list \
|
||||||
|
&& curl 'https://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0x1655A0AB68576280' | apt-key add -
|
||||||
|
RUN apt-get update && apt-get install -y nodejs
|
||||||
|
|
||||||
|
# WKHTMLTOPDF
|
||||||
|
RUN curl -L 'https://github.com/frappe/wkhtmltopdf/raw/master/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz' > /tmp/wkhtmltox.tar.xz
|
||||||
|
RUN cd /tmp/ && tar Jxf wkhtmltox.tar.xz \
|
||||||
|
&& cp /tmp/wkhtmltox/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf \
|
||||||
|
&& chmod +x /usr/local/bin/wkhtmltopdf
|
||||||
|
|
||||||
|
# MariaDb
|
||||||
|
RUN echo "deb [arch=amd64,i386] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.1/ubuntu xenial main" \
|
||||||
|
> /etc/apt/sources.list.d/mariadb.list \
|
||||||
|
&& curl 'https://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0xF1656F24C74CD1D8' | apt-key add -
|
||||||
|
RUN export DEBIAN_FRONTEND=noninteractive && apt-get update \
|
||||||
|
&& apt-get install -y mariadb-server mariadb-client mariadb-common libmariadbclient-dev
|
||||||
|
RUN pip install mysql-python==1.2.5
|
||||||
|
COPY simple_mariadb_config.cnf /etc/mysql/conf.d/frappe.cnf
|
||||||
|
RUN mysqladmin -u root password $MYSQL_PASSWORD
|
||||||
|
|
||||||
|
# Install frappe
|
||||||
|
# RUN curl -LO https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
|
||||||
|
|
||||||
|
# Volumes : data dir
|
||||||
|
VOLUME /home/$FRAPPE_USER/
|
49
frappe/frappe/Dockerfile.manual.wip
Normal file
49
frappe/frappe/Dockerfile.manual.wip
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
FROM debian:jessie
|
||||||
|
MAINTAINER Yaltik - Fabien Bourgeois <fabien@yaltik.com>
|
||||||
|
|
||||||
|
# Global dependencies
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y sudo curl wget rlwrap
|
||||||
|
RUN apt-get install -y iputils-ping
|
||||||
|
RUN apt-get install -y git build-essential python-setuptools python-pip python-dev libffi-dev libssl-dev
|
||||||
|
RUN apt-get install -y redis-tools software-properties-common libxrender1 libxext6 xfonts-75dpi xfonts-base
|
||||||
|
RUN apt-get install -y libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev python-tk apt-transport-https libsasl2-dev libldap2-dev libtiff5-dev tcl8.6-dev tk8.6-dev
|
||||||
|
RUN apt-get install -y libmysqlclient-dev mariadb-client mariadb-common
|
||||||
|
RUN pip install --upgrade setuptools pip
|
||||||
|
# NodeJS
|
||||||
|
RUN curl -LO https://nodejs.org/dist/v6.11.3/node-v6.11.3-linux-x64.tar.xz && tar xJf node-v6.11.3-linux-x64.tar.xz && ln -s node-v6.11.3-linux.x64/bin/node /usr/bin/ && ln -s node-v6.11.3-linux.x64/bin/npm /usr/bin/
|
||||||
|
# WKHTMLTOPDF
|
||||||
|
RUN apt-get install -y wkhtmltopdf
|
||||||
|
|
||||||
|
# Environment variables
|
||||||
|
ENV FRAPPE_USER=frappe \
|
||||||
|
MYSQL_PASSWORD=somethingToChange \
|
||||||
|
ADMIN_PASSWORD=somethingToChange
|
||||||
|
|
||||||
|
# Create frappe user
|
||||||
|
RUN useradd $FRAPPE_USER -m
|
||||||
|
# RUN usermod -aG sudo $FRAPPE_USER
|
||||||
|
RUN echo "$FRAPPE_USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/frappe
|
||||||
|
|
||||||
|
# Install frappe
|
||||||
|
RUN git clone --depth 1 https://github.com/frappe/bench bench_repo
|
||||||
|
RUN pip install -e bench-repo
|
||||||
|
RUN curl -LO https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
|
||||||
|
RUN python install.py --production --user $FRAPPE_USER --mysql-root-password $MYSQL_PASSWORD --admin-password $ADMIN_PASSWORD
|
||||||
|
# Supervidor production configuration
|
||||||
|
# COPY production.conf /etc/supervisor/conf.d/
|
||||||
|
|
||||||
|
WORKDIR /home/$FRAPPE_USER
|
||||||
|
USER frappe
|
||||||
|
|
||||||
|
# Cleanup (to move on production)
|
||||||
|
# RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/ /home/$FRAPPE_USER/.cache
|
||||||
|
|
||||||
|
WORKDIR /home/$FRAPPE_USER/frappe-bench
|
||||||
|
# Default ports
|
||||||
|
EXPOSE 80 25
|
||||||
|
|
||||||
|
# Volumes : data dir
|
||||||
|
VOLUME /opt/odoo/data
|
||||||
|
|
||||||
|
# CMD ["/usr/bin/supervisord","-n"]
|
22
frappe/frappe/Dockerfile.prod
Normal file
22
frappe/frappe/Dockerfile.prod
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
FROM registry.yaltik.net/frappe:yaltik
|
||||||
|
MAINTAINER Yaltik - Fabien Bourgeois <fabien@yaltik.com>
|
||||||
|
|
||||||
|
# Frappe production setup
|
||||||
|
|
||||||
|
RUN python install.py --production --user $FRAPPE_USER --mysql-root-password $MYSQL_PASSWORD --admin-password $ADMIN_PASSWORD
|
||||||
|
|
||||||
|
# Supervisor configuration
|
||||||
|
COPY production.conf /etc/supervisor/conf.d/
|
||||||
|
# Cleanup
|
||||||
|
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/
|
||||||
|
|
||||||
|
# Frappe local production setup
|
||||||
|
USER frappe
|
||||||
|
WORKDIR /home/$FRAPPE_USER/frappe-bench
|
||||||
|
RUN bench setup production
|
||||||
|
|
||||||
|
# Default ports
|
||||||
|
EXPOSE 80 25
|
||||||
|
|
||||||
|
# Default command
|
||||||
|
CMD ["/usr/bin/supervisord","-n"]
|
26
frappe/frappe/production.conf
Normal file
26
frappe/frappe/production.conf
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
[program:mysqld]
|
||||||
|
command=/usr/bin/pidproxy /var/mysqld/mysqld.pid /usr/bin/mysqld_safe --pid-file=/var/run/mysqld/mysqld.pid
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
user=root
|
||||||
|
|
||||||
|
[program:crond]
|
||||||
|
command=/usr/sbin/cron -f
|
||||||
|
process_name=cron
|
||||||
|
numprocs=1
|
||||||
|
directory=/tmp
|
||||||
|
umask=022
|
||||||
|
priority=999
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
startsecs=10
|
||||||
|
startretries=3
|
||||||
|
exitcodes=0,2
|
||||||
|
stopsignal=TERM
|
||||||
|
stopwaitsecs=10
|
||||||
|
user=root
|
||||||
|
|
||||||
|
[program:nginx]
|
||||||
|
command=/usr/sbin/nginx -g "daemon off;"
|
||||||
|
stdout_events_enabled=true
|
||||||
|
stderr_events_enabled=true
|
11
frappe/frappe/simple_mariadb_config.cnf
Normal file
11
frappe/frappe/simple_mariadb_config.cnf
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[mysqld]
|
||||||
|
innodb-file-format=barracuda
|
||||||
|
innodb-file-per-table=1
|
||||||
|
innodb-large-prefix=1
|
||||||
|
character-set-client-handshake = FALSE
|
||||||
|
character-set-server = utf8mb4
|
||||||
|
collation-server = utf8mb4_unicode_ci
|
||||||
|
max_allowed_packet=64M
|
||||||
|
|
||||||
|
[mysql]
|
||||||
|
default-character-set = utf8mb4
|
30
frappe/frappe_docker-master/.travis.yml
Normal file
30
frappe/frappe_docker-master/.travis.yml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
language: python
|
||||||
|
python:
|
||||||
|
- "2.7"
|
||||||
|
env:
|
||||||
|
- DOCKER_COMPOSE_VERSION: 1.8.0
|
||||||
|
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
install:
|
||||||
|
- docker-compose build
|
||||||
|
- docker-compose up -d
|
||||||
|
- docker exec -it -u root frappe bash -c "cd /home/frappe && chown -R frappe:frappe ./*"
|
||||||
|
- docker exec -i frappe bash -c "cd .. && bench init frappe-bench --skip-bench-mkdir --skip-redis-config-generation && cd frappe-bench"
|
||||||
|
- docker exec -i frappe bash -c "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json"
|
||||||
|
- docker exec -i frappe bash -c "bench new-site site1.local"
|
||||||
|
- docker exec -i frappe bash -c "bench get-app erpnext https://github.com/frappe/erpnext"
|
||||||
|
- docker exec -i frappe bash -c "bench --site site1.local install-app erpnext"
|
||||||
|
- docker exec -i -u root frappe bash -c "echo 127.0.0.1 site1.local >> /etc/hosts"
|
||||||
|
- sudo su -c 'echo 127.0.0.1 site1.local >> /etc/hosts'
|
||||||
|
- pip3 install requests
|
||||||
|
|
||||||
|
script:
|
||||||
|
- docker-compose ps | grep -i frappe
|
||||||
|
- docker-compose ps | grep -i redis-cache
|
||||||
|
- docker-compose ps | grep -i redis-queue
|
||||||
|
- docker-compose ps | grep -i redis-socketio
|
||||||
|
- docker-compose ps | grep -i mariadb
|
||||||
|
- python3 test.py
|
||||||
|
- docker-compose stop
|
40
frappe/frappe_docker-master/Dockerfile
Normal file
40
frappe/frappe_docker-master/Dockerfile
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
|
||||||
|
#bench Dockerfile
|
||||||
|
|
||||||
|
FROM ubuntu:16.04
|
||||||
|
MAINTAINER Vishal Seshagiri
|
||||||
|
|
||||||
|
USER root
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y iputils-ping
|
||||||
|
RUN apt-get install -y git build-essential python-setuptools python-dev libffi-dev libssl-dev
|
||||||
|
RUN apt-get install -y redis-tools software-properties-common libxrender1 libxext6 xfonts-75dpi xfonts-base
|
||||||
|
RUN apt-get install -y libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev python-tk apt-transport-https libsasl2-dev libldap2-dev libtiff5-dev tcl8.6-dev tk8.6-dev
|
||||||
|
RUN apt-get install -y wget
|
||||||
|
RUN wget https://bootstrap.pypa.io/get-pip.py && python get-pip.py
|
||||||
|
RUN pip install --upgrade setuptools pip
|
||||||
|
RUN useradd -ms /bin/bash frappe
|
||||||
|
RUN apt-get install -y curl
|
||||||
|
RUN apt-get install -y rlwrap
|
||||||
|
RUN apt-get install redis-tools
|
||||||
|
RUN apt-get install -y nano
|
||||||
|
|
||||||
|
|
||||||
|
#nodejs
|
||||||
|
RUN apt-get install curl
|
||||||
|
RUN curl https://deb.nodesource.com/node_6.x/pool/main/n/nodejs/nodejs_6.7.0-1nodesource1~xenial1_amd64.deb > node.deb \
|
||||||
|
&& dpkg -i node.deb \
|
||||||
|
&& rm node.deb
|
||||||
|
RUN apt-get install -y wkhtmltopdf
|
||||||
|
|
||||||
|
USER frappe
|
||||||
|
WORKDIR /home/frappe
|
||||||
|
RUN git clone -b develop https://github.com/vishalseshagiri/bench.git bench-repo
|
||||||
|
|
||||||
|
USER root
|
||||||
|
RUN pip install -e bench-repo
|
||||||
|
RUN apt-get install -y libmysqlclient-dev mariadb-client mariadb-common
|
||||||
|
RUN chown -R frappe:frappe /home/frappe/*
|
||||||
|
|
||||||
|
USER frappe
|
||||||
|
WORKDIR /home/frappe/frappe-bench
|
21
frappe/frappe_docker-master/LICENSE.md
Normal file
21
frappe/frappe_docker-master/LICENSE.md
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2017 Frappe Technologies Pvt. Ltd.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
180
frappe/frappe_docker-master/README.md
Normal file
180
frappe/frappe_docker-master/README.md
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
# frappe_docker
|
||||||
|
[![Build Status](https://travis-ci.org/frappe/frappe_docker.svg?branch=master)](https://travis-ci.org/frappe/frappe_docker)
|
||||||
|
|
||||||
|
- [Docker](https://docker.com/) is an open source project to pack, ship and run any Linux application in a lighter weight, faster container than a traditional virtual machine.
|
||||||
|
|
||||||
|
- Docker makes it much easier to deploy [frappe](https://github.com/frappe/frappe) on your servers.
|
||||||
|
|
||||||
|
- This container uses [bench](https://github.com/frappe/bench) to install frappe.
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
[Docker](https://www.docker.com/)
|
||||||
|
|
||||||
|
[Docker Compose](https://docs.docker.com/compose/overview/)
|
||||||
|
|
||||||
|
### Container Configuration
|
||||||
|
|
||||||
|
#### ports:
|
||||||
|
|
||||||
|
```
|
||||||
|
ports:
|
||||||
|
- "3307:3307" mariadb-port
|
||||||
|
- "8000:8000" webserver-port
|
||||||
|
- "11000:11000" redis-cache
|
||||||
|
- "12000:12000" redis-queue
|
||||||
|
- "13000:13000" redis-socketio
|
||||||
|
- "9000:9000" socketio-port
|
||||||
|
- "6787:6787" file-watcher-port
|
||||||
|
```
|
||||||
|
|
||||||
|
Expose port 3307 inside the container on port 3307 on ALL local host interfaces. In order to bind to only one interface, you may specify the host's IP address as `([<host_interface>:[host_port]])|(<host_port>):<container_port>[/udp]` as defined in the [docker port binding documentation](http://docs.docker.com/userguide/dockerlinks/). The port 3307 of the mariadb container and port 8000 of the frappe container is exposed to the host machine and other containers.
|
||||||
|
|
||||||
|
#### volumes:
|
||||||
|
|
||||||
|
```
|
||||||
|
volumes:
|
||||||
|
- ./frappe-bench:/home/frappe/frappe-bench
|
||||||
|
- ./conf/mariadb-conf.d:/etc/mysql/conf.d
|
||||||
|
- ./redis-conf/redis_socketio.conf:/etc/conf.d/redis.conf
|
||||||
|
- ./redis-conf/redis_queue.conf:/etc/conf.d/redis.conf
|
||||||
|
- ./redis-conf/redis_cache.conf:/etc/conf.d/redis.conf
|
||||||
|
```
|
||||||
|
Exposes a directory inside the host to the container.
|
||||||
|
|
||||||
|
#### links:
|
||||||
|
|
||||||
|
```
|
||||||
|
links:
|
||||||
|
- redis-cache
|
||||||
|
- redis-queue
|
||||||
|
- redis-socketio
|
||||||
|
- mariadb
|
||||||
|
```
|
||||||
|
|
||||||
|
Links allow you to define extra aliases by which a service is reachable from another service.
|
||||||
|
|
||||||
|
#### depends_on:
|
||||||
|
|
||||||
|
```
|
||||||
|
depends_on:
|
||||||
|
- mariadb
|
||||||
|
- redis-cache
|
||||||
|
- redis-queue
|
||||||
|
- redis-socketio
|
||||||
|
```
|
||||||
|
Express dependency between services, which has two effects:
|
||||||
|
|
||||||
|
1. docker-compose up will start services in dependency order. In the following example, mariadb and redis will be started before frappe.
|
||||||
|
|
||||||
|
2. docker-compose up SERVICE will automatically include SERVICE’s dependencies. In the following example, docker-compose up docker_frappe will also create and start mariadb and redis.
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
#### 1. Installation Pre-requisites
|
||||||
|
|
||||||
|
- Install [Docker](https://docs.docker.com/engine/installation) Community Edition
|
||||||
|
|
||||||
|
- Install [Docker Compose](https://docs.docker.com/compose/install/) (only for Linux users). Docker for Mac, Docker for Windows, and Docker Toolbox include Docker Compose
|
||||||
|
|
||||||
|
#### 2. Build the container and install bench
|
||||||
|
|
||||||
|
* Build the container and install bench inside the container.
|
||||||
|
|
||||||
|
1.Build the 5 linked containers frappe, mariadb, redis-cache, redis-queue and redis-socketio using this command. Make sure your current working directory is frappe_docker which contains the docker-compose.yml and Dockerfile.
|
||||||
|
It creates a user, frappe inside the frappe container, whose working directory is /home/frappe. It also clones
|
||||||
|
the bench-repo from [here](https://github.com/frappe/bench)
|
||||||
|
|
||||||
|
docker-compose up -d
|
||||||
|
|
||||||
|
Note: Please do not remove the bench-repo directory the above commands will create
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Basic Usage
|
||||||
|
1. Starting docker containers
|
||||||
|
|
||||||
|
This command can be used to start containers
|
||||||
|
|
||||||
|
docker-compose start
|
||||||
|
|
||||||
|
2. Accessing the frappe container via CLI
|
||||||
|
|
||||||
|
docker exec -i -u root frappe bash -c "cd /home/frappe && chown -R frappe:frappe ./*"
|
||||||
|
docker exec -it frappe bash
|
||||||
|
|
||||||
|
3. Create a new bench
|
||||||
|
|
||||||
|
The init command will create a bench directory with frappe framework
|
||||||
|
installed. It will be setup for periodic backups and auto updates once
|
||||||
|
a day.
|
||||||
|
|
||||||
|
cd .. && bench init frappe-bench --skip-bench-mkdir --skip-redis-config-generation && cd frappe-bench
|
||||||
|
mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json
|
||||||
|
|
||||||
|
4. Set the db host for bench (points bench to the mariadb container) since the 3 containers are linked
|
||||||
|
|
||||||
|
bench set-mariadb-host mariadb
|
||||||
|
|
||||||
|
5. Add a site (make sure your current path is /home/frappe/frappe-bench)
|
||||||
|
|
||||||
|
Frappe apps are run by frappe sites and you will have to create at least one
|
||||||
|
site. The new-site command allows you to do that.
|
||||||
|
|
||||||
|
bench new-site site1.local
|
||||||
|
|
||||||
|
6. Add apps (make sure your current path is /home/frappe/frappe-bench)
|
||||||
|
|
||||||
|
The get-app command gets remote frappe apps from a remote git repository and installs them. Example: [erpnext](https://github.com/frappe/erpnext)
|
||||||
|
|
||||||
|
bench get-app erpnext https://github.com/frappe/erpnext
|
||||||
|
|
||||||
|
7. Install apps (make sure your current path is /home/frappe/frappe-bench)
|
||||||
|
|
||||||
|
To install an app on your new site, use the bench `install-app` command.
|
||||||
|
|
||||||
|
bench --site site1.local install-app erpnext
|
||||||
|
|
||||||
|
8. Start bench (make sure your current path is /home/frappe/frappe-bench)
|
||||||
|
|
||||||
|
To start using the bench, use the `bench start` command
|
||||||
|
|
||||||
|
bench start
|
||||||
|
|
||||||
|
9. Exiting the frappe container and stopping all the containers gracefully.
|
||||||
|
|
||||||
|
exit
|
||||||
|
docker-compose stop
|
||||||
|
|
||||||
|
10. Removing docker containers
|
||||||
|
|
||||||
|
docker-compose rm
|
||||||
|
|
||||||
|
11. Removing dangling volumes
|
||||||
|
|
||||||
|
The volume frappe on your local machine is shared by the host(your local machine) and the frappe container.
|
||||||
|
Please do not delete this volume from your local machine. Any changes made in this directory will reflect on both
|
||||||
|
the container and the host. The below command specifies how to remain dangling volumes which may be taking up
|
||||||
|
unecessary space on your host.
|
||||||
|
|
||||||
|
docker volume rm $(docker volume ls -f dangling=true -q)
|
||||||
|
|
||||||
|
To login to Frappe / ERPNext, open your browser and go to `[your-external-ip]:8000`, probably `localhost:8000`
|
||||||
|
|
||||||
|
The default username is "Administrator" and password is what you set when you created the new site.
|
||||||
|
|
||||||
|
## Built With
|
||||||
|
|
||||||
|
* [Docker](https://www.docker.com/)
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Feel free to contribute to this project and make the container better
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
|
32
frappe/frappe_docker-master/conf/mariadb-conf.d/my.cnf
Normal file
32
frappe/frappe_docker-master/conf/mariadb-conf.d/my.cnf
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# MariaDB-specific config file.
|
||||||
|
# Read by /etc/mysql/my.cnf
|
||||||
|
|
||||||
|
[client]
|
||||||
|
# Default is Latin1, if you need UTF-8 set this (also in server section)
|
||||||
|
#default-character-set = utf8
|
||||||
|
|
||||||
|
[mysqld]
|
||||||
|
#
|
||||||
|
# * Character sets
|
||||||
|
#
|
||||||
|
# Default is Latin1, if you need UTF-8 set all this (also in client section)
|
||||||
|
#
|
||||||
|
#character-set-server = utf8
|
||||||
|
#collation-server = utf8_general_ci
|
||||||
|
#character_set_server = utf8
|
||||||
|
#collation_server = utf8_general_ci
|
||||||
|
# Import all .cnf files from configuration directory
|
||||||
|
bind-address = 0.0.0.0
|
||||||
|
!includedir /etc/mysql/mariadb.conf.d/
|
||||||
|
|
||||||
|
|
||||||
|
[mysqld]
|
||||||
|
innodb-file-format=barracuda
|
||||||
|
innodb-file-per-table=1
|
||||||
|
innodb-large-prefix=1
|
||||||
|
character-set-client-handshake = FALSE
|
||||||
|
character-set-server = utf8mb4
|
||||||
|
collation-server = utf8mb4_unicode_ci
|
||||||
|
|
||||||
|
[mysql]
|
||||||
|
default-character-set = utf8mb4
|
@ -0,0 +1,2 @@
|
|||||||
|
[mysql]
|
||||||
|
|
@ -0,0 +1,4 @@
|
|||||||
|
[mysqld_safe]
|
||||||
|
skip_log_error
|
||||||
|
syslog
|
||||||
|
|
@ -0,0 +1,5 @@
|
|||||||
|
[mysqldump]
|
||||||
|
quick
|
||||||
|
quote-names
|
||||||
|
max_allowed_packet = 16M
|
||||||
|
|
42
frappe/frappe_docker-master/dbench
Executable file
42
frappe/frappe_docker-master/dbench
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
display_usage() {
|
||||||
|
echo "$(basename "$0") [-h] [-c \"<command to be executed inside container>\"]"
|
||||||
|
echo ''
|
||||||
|
echo 'where:'
|
||||||
|
echo ' -h show this help text'
|
||||||
|
echo ' -c execute a command inside docker using docker exec'
|
||||||
|
echo ' -s adds site-names to /etc/hosts file in the container to facilitate multisite access'
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ $# -eq 0 ]]; then
|
||||||
|
docker exec -it frappe bash
|
||||||
|
else
|
||||||
|
while getopts ':hsc:' option; do
|
||||||
|
case "$option" in
|
||||||
|
h)
|
||||||
|
display_usage
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
c)
|
||||||
|
docker exec frappe bash -c "bench $OPTARG"
|
||||||
|
;;
|
||||||
|
s)
|
||||||
|
a=$(cd frappe-bench && ls sites/*/site_config.json | grep -o '/.\+/')
|
||||||
|
a="${a//$'\n'/ }"
|
||||||
|
a=$(echo $a | tr -d / )
|
||||||
|
result="127.0.0.1 ${a}"
|
||||||
|
echo $result
|
||||||
|
docker exec -u root -i frappe bash -c "echo ${result} | tee --append /etc/hosts"
|
||||||
|
;;
|
||||||
|
\?)
|
||||||
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
:)
|
||||||
|
echo "Option -$OPTARG requires an argument." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
64
frappe/frappe_docker-master/docker-compose.yml
Normal file
64
frappe/frappe_docker-master/docker-compose.yml
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
version: '2'
|
||||||
|
services:
|
||||||
|
mariadb:
|
||||||
|
image: "mariadb"
|
||||||
|
environment:
|
||||||
|
- MYSQL_ROOT_PASSWORD=123
|
||||||
|
- MYSQL_USER=root
|
||||||
|
volumes:
|
||||||
|
- ./conf/mariadb-conf.d:/etc/mysql/conf.d
|
||||||
|
ports:
|
||||||
|
- "3307:3307" #mariadb-port
|
||||||
|
container_name: mariadb
|
||||||
|
|
||||||
|
redis-cache:
|
||||||
|
image: redis:alpine
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- ./redis-conf/redis_cache.conf:/etc/conf.d/redis.conf
|
||||||
|
|
||||||
|
command: ["redis-server","/etc/conf.d/redis.conf"]
|
||||||
|
|
||||||
|
container_name: redis-cache
|
||||||
|
|
||||||
|
redis-queue:
|
||||||
|
image: redis:alpine
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- ./redis-conf/redis_queue.conf:/etc/conf.d/redis.conf
|
||||||
|
|
||||||
|
command: ["redis-server","/etc/conf.d/redis.conf"]
|
||||||
|
|
||||||
|
container_name: redis-queue
|
||||||
|
|
||||||
|
redis-socketio:
|
||||||
|
image: redis:alpine
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- ./redis-conf/redis_socketio.conf:/etc/conf.d/redis.conf
|
||||||
|
|
||||||
|
command: ["redis-server","/etc/conf.d/redis.conf"]
|
||||||
|
|
||||||
|
container_name: redis-socketio
|
||||||
|
|
||||||
|
frappe:
|
||||||
|
volumes:
|
||||||
|
- ./frappe-bench:/home/frappe/frappe-bench
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- "8000:8000" #webserver_port
|
||||||
|
- "9000:9000" #socketio_port
|
||||||
|
- "6787:6787" #file_watcher_port
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
links:
|
||||||
|
- redis-cache
|
||||||
|
- redis-queue
|
||||||
|
- redis-socketio
|
||||||
|
- mariadb
|
||||||
|
depends_on:
|
||||||
|
- mariadb
|
||||||
|
- redis-cache
|
||||||
|
- redis-queue
|
||||||
|
- redis-socketio
|
||||||
|
container_name: frappe
|
8
frappe/frappe_docker-master/frappe-bench/Procfile_docker
Normal file
8
frappe/frappe_docker-master/frappe-bench/Procfile_docker
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
web: bench serve --port 8000
|
||||||
|
|
||||||
|
socketio: /usr/bin/node apps/frappe/socketio.js
|
||||||
|
watch: bench watch
|
||||||
|
schedule: bench schedule
|
||||||
|
worker_short: bench worker --queue short
|
||||||
|
worker_long: bench worker --queue long
|
||||||
|
worker_default: bench worker --queue default
|
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"auto_update": false,
|
||||||
|
"background_workers": 1,
|
||||||
|
"db_host": "mariadb",
|
||||||
|
"file_watcher_port": 6787,
|
||||||
|
"frappe_user": "frappe",
|
||||||
|
"gunicorn_workers": 4,
|
||||||
|
"rebase_on_pull": false,
|
||||||
|
"redis_cache": "redis://redis-cache:13000",
|
||||||
|
"redis_queue": "redis://redis-queue:11000",
|
||||||
|
"redis_socketio": "redis://redis-socketio:12000",
|
||||||
|
"restart_supervisor_on_update": false,
|
||||||
|
"root_password": "123",
|
||||||
|
"serve_default_site": true,
|
||||||
|
"shallow_clone": true,
|
||||||
|
"socketio_port": 9000,
|
||||||
|
"update_bench_on_update": true,
|
||||||
|
"webserver_port": 8000,
|
||||||
|
"admin_password": "admin"
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
20
|
@ -0,0 +1 @@
|
|||||||
|
24
|
@ -0,0 +1 @@
|
|||||||
|
29
|
8
frappe/frappe_docker-master/redis-conf/redis_cache.conf
Normal file
8
frappe/frappe_docker-master/redis-conf/redis_cache.conf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
dbfilename redis_cache.rdb
|
||||||
|
bind 0.0.0.0
|
||||||
|
port 13000
|
||||||
|
maxmemory 292mb
|
||||||
|
maxmemory-policy allkeys-lru
|
||||||
|
appendonly no
|
||||||
|
|
||||||
|
save ""
|
3
frappe/frappe_docker-master/redis-conf/redis_queue.conf
Normal file
3
frappe/frappe_docker-master/redis-conf/redis_queue.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
dbfilename redis_queue.rdb
|
||||||
|
bind 0.0.0.0
|
||||||
|
port 11000
|
@ -0,0 +1,3 @@
|
|||||||
|
dbfilename redis_socketio.rdb
|
||||||
|
bind 0.0.0.0
|
||||||
|
port 12000
|
29
frappe/frappe_docker-master/test.py
Normal file
29
frappe/frappe_docker-master/test.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import subprocess, requests, datetime, _thread, time, os, signal
|
||||||
|
start_time = datetime.datetime.now().time()
|
||||||
|
bench_start = 'docker exec -i frappe bash -c "bench start"'
|
||||||
|
process = subprocess.Popen(bench_start, stdout=subprocess.PIPE , shell=True)
|
||||||
|
|
||||||
|
|
||||||
|
def print_out(val,delay):
|
||||||
|
while 1:
|
||||||
|
time.sleep(delay)
|
||||||
|
if val == 1:
|
||||||
|
result,error = process.communicate()
|
||||||
|
print(result)
|
||||||
|
elif val == 2:
|
||||||
|
try:
|
||||||
|
global r
|
||||||
|
r = requests.get("http://site1.local:8000")
|
||||||
|
print(r)
|
||||||
|
except requests.exceptions.ConnectionError as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
_thread.start_new_thread(print_out, (1, 1))
|
||||||
|
#result, error = process.communicate()
|
||||||
|
_thread.start_new_thread(print_out, (2, 1))
|
||||||
|
|
||||||
|
time.sleep(30)
|
||||||
|
|
||||||
|
process.kill()
|
||||||
|
|
||||||
|
assert '<title> Login </title>' in str(r.content)
|
26
frappe/production.conf.erpnext7
Normal file
26
frappe/production.conf.erpnext7
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
[program:mysqld]
|
||||||
|
command=/usr/bin/pidproxy /var/mysqld/mysqld.pid /usr/bin/mysqld_safe --pid-file=/var/run/mysqld/mysqld.pid
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
user=root
|
||||||
|
|
||||||
|
[program:crond]
|
||||||
|
command=/usr/sbin/cron -f
|
||||||
|
process_name=cron
|
||||||
|
numprocs=1
|
||||||
|
directory=/tmp
|
||||||
|
umask=022
|
||||||
|
priority=999
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
startsecs=10
|
||||||
|
startretries=3
|
||||||
|
exitcodes=0,2
|
||||||
|
stopsignal=TERM
|
||||||
|
stopwaitsecs=10
|
||||||
|
user=root
|
||||||
|
|
||||||
|
[program:nginx]
|
||||||
|
command=/usr/sbin/nginx -g "daemon off;"
|
||||||
|
stdout_events_enabled=true
|
||||||
|
stderr_events_enabled=true
|
Loading…
Reference in New Issue
Block a user