diff --git a/.env b/.env
index 9fca4d0..f75a9f5 100644
--- a/.env
+++ b/.env
@@ -1,27 +1,25 @@
# Copyright (C) 2010-2017, OpenUp S.A. , http://www.openup.com.uy
# Copyright (C) 2003-2017, e-Evolution Consultants S.A. , http://www.e-evolution.com
# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
+# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-# You should have received a copy of the GNU Affero General Public License
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
# Email: raul.capecce@openupsolutions.com, http://openupsolutions.com , http://github.com/rcapecce
# Email: victor.perez@e-evolution.com, http://www.e-evolution.com , http://github.com/e-Evolution
-#
-ADEMPIERE_VERSION=390LTS
-ADEMPIERE_TENANT=tenant1
-ADEMPIERE_DB_PORT=55432
+COMPOSE_PROJECT_NAME=eevolution
ADEMPIERE_WEB_PORT=8277
-ADEMPIERE_SSL_PORT=4445
-ADEMPIERE_DB_SERVER=10.10.1.122
-ADEMPIERE_APPS_SERVER=
-ADEMPIERE_DB_USER=usertenant1
+ADEMPIERE_SSL_PORT=4444
+ADEMPIERE_DB_PORT=55432
+ADEMPIERE_VERSION=3.9.0
ADEMPIERE_DB_PASSWORD=adempiere
ADEMPIERE_DB_ADMIN_PASSWORD=postgres
+
+# ATENTION If is "Y" it will be replace de actual defined database with a empty ADempiere seed
ADEMPIERE_DB_INIT=Y
\ No newline at end of file
diff --git a/README.md b/README.md
index 2bb87db..c36d280 100644
--- a/README.md
+++ b/README.md
@@ -76,22 +76,42 @@ The adempiere-docker project follows the structure specified below
```
└─ adempiere-docker
- ├─ docker-compose.yml
+ ├─ .env
+ ├─ database.volume.yml
+ ├─ database.yml
+ ├─ adempiere.yml
├─ adempiere-last
- ├─ client1
+ ├─ tenant1
| ├─ Adempiere_390LTS.tar.gz
| ├─ lib
| └─ packages
- └─ client2
+ └─ tenant2
| ├─ Adempiere_390LTS.tar.gz
| ├─ lib
| └─ packages
...
- └─ clientN
+ └─ tenantN
...
```
+#### .env
-#### client1
+This file contains the setting variables to Tenant deployment
+
+```
+COMPOSE_PROJECT_NAME=eevolution
+ADEMPIERE_WEB_PORT=8277
+ADEMPIERE_SSL_PORT=4444
+ADEMPIERE_DB_PORT=55432
+ADEMPIERE_VERSION=3.9.0
+ADEMPIERE_DB_PASSWORD=adempiere
+ADEMPIERE_DB_ADMIN_PASSWORD=postgres
+
+# ATENTION If is "Y" it will be replace de actual defined database with a empty ADempiere seed
+ADEMPIERE_DB_INIT=Y
+
+```
+
+#### tenant1 dierectory
This directory contains the files needed to deploy and start a particular ADempiere instance of a client.
Here we will find:
@@ -99,54 +119,113 @@ Here we will find:
* lib: The files to copy to the lib directory on ADempiere (this directory will contain the customization and zkcustomization of ADempiere.
* packages: The files to copy to the packages directory on ADempiere (this directory will contain the localization of an ADempiere).
-### docker-compose.yml
+
+### database.volume.yml
+
+this file will contain the an external database volume
+
+```
+version: '3'
+services:
+ database:
+ volumes:
+ - database:/var/lib/postgresql/data/
+volumes:
+ database:
+ driver: local
+```
+
+### database.yml
+
+this file will contain the PostgreSQL deployment
+
+```
+version: '3'
+services:
+ database:
+ image: postgres:9.6
+ restart: always
+ ports:
+ - "${ADEMPIERE_DB_PORT}:5432"
+ networks:
+ - custom
+ environment:
+ - POSTGRES_USER:postgres
+ - POSTGRES_PASSWORD:postgres
+ - PGDATA:/var/lib/postgresql/data/pgdata
+ - POSTGRES_INITDB_ARGS:''
+ - POSTGRES_INITDB_XLOGDIR:''
+ networks:
+ custom:
+ external : true
+```
+
+
+
+### adempiere.yml
This file will contain the definition of our ADempiere clients.
For a client we will need to complete the next parametrization.
```
- adempiere-client1: # Name of the ADempiere client for docker
- depends_on:
- - db
- image: adempiere-client1 # Name of the ADempiere client image
- container_name: adempierec-client1 # Name of the ADempiere client container
+version: '3'
+services:
+ adempiere-tenant:
+ networks:
+ - custom
+ external_links:
+ - database:database
+ image: "${COMPOSE_PROJECT_NAME}" # Name of the instance for docker create based on project name
+ container_name: "${COMPOSE_PROJECT_NAME}" # Name of the ADempiere client container
ports:
- - <>:8888 # Port where the web client will be exposed
+ - ${ADEMPIERE_WEB_PORT}:8888 # http port where the web client will be exposed
+ - ${ADEMPIERE_SSL_PORT}:444 # https port where the web client will be exposed
environment:
- ADEMPIERE_DB_INIT: N # ATENTION If is "Y" it will be replace de actual defined database with a empty ADempiere Seed
+ ADEMPIERE_DB_INIT: ${ADEMPIERE_DB_INIT} # ATENTION If is "Y" it will be replace de actual defined database with a empty ADempiere seed
build:
context: .
dockerfile: ./adempiere-last/Dockerfile
args:
- ADEMPIERE_REL: 390LTS
- ADEMPIERE_SRC_DIR: ./client1 # Directory that contain the ADempiere installer, customization and localization
- ADEMPIERE_DB_HOST: <> # Address of the database host
- ADEMPIERE_DB_PORT: <> # Port of the database host
- ADEMPIERE_DB_NAME: <>
- ADEMPIERE_DB_USER: <>
- ADEMPIERE_DB_PASSWORD: <>
- ADEMPIERE_DB_ADMIN_PASSWORD: <>
+ ADEMPIERE_BINARY : ${ADEMPIERE_BINARY}
+ ADEMPIERE_SRC_DIR: "./${COMPOSE_PROJECT_NAME}" # Directory that contain the ADempiere installer, customization and localization
+ ADEMPIERE_DB_HOST: "database"
+ ADEMPIERE_DB_PORT: 5432
+ ADEMPIERE_DB_NAME: "${COMPOSE_PROJECT_NAME}"
+ ADEMPIERE_DB_USER: "${COMPOSE_PROJECT_NAME}"
+ ADEMPIERE_DB_PASSWORD: ${ADEMPIERE_DB_PASSWORD}
+ ADEMPIERE_DB_ADMIN_PASSWORD: ${ADEMPIERE_DB_ADMIN_PASSWORD}
+networks:
+ custom:
+ external: true
```
### Postgres Container
If you don't have an external database server, You can use the postgres server container defined in this composer. As you will not have a database defined in the container, you can first start the database container to mount it, or you can pass the ADEMPIERE_DB_INIT argument with "Y" to load an ADempiere seed, then you only need to parametrice your ADempiere instances with this database configuration.
### Usage
-If you already have configured the docker-compose.yml, you only need to start the dockers container, to do this in terminal we will run the next line:
+
+Edit and define the parameters of your instance
+
+.env
+
+to do this in terminal we will run the next line:
+
```
-cd <>
-docker-compose up -d
+./application up -d
```
-This command will build the images defined in the docker-compose.yml, create the containers and start them. The "-d" parameter will launch the process in background.
+
+
+This command will build the images defined in the .env, create the containers and start them. The "-d" parameter will launch the process in background.
To stop the containers you will run the next command.
```
-docker-compose stop
+./application stop
```
Note that in the above command we use the instruction ```stop``` insted of ```down```, this is because the ```down``` instruction delete the containers to, ```stop``` only shutdown them.
-If you have a new client, you only need to add this client definition to the docker-compose.yml and start up only this image and container.
+If you have a new tenant, you only need to edit and setting the tenant definition to env. and start up only this image and container.
+
```
-docker-compose up -d client3
+./application up -d
```
@@ -156,4 +235,4 @@ look at the [docker compose documentation](https://docs.docker.com/compose)
### Contribution
Contributions are more than welcome. Please log any issue or new feature request in
-adempiere-docker project's repositor
+adempiere-docker project's repository
diff --git a/adempiere-last/Dockerfile b/adempiere-last/Dockerfile
index 8388557..26d6ab7 100644
--- a/adempiere-last/Dockerfile
+++ b/adempiere-last/Dockerfile
@@ -1,8 +1,7 @@
FROM openjdk:8-jdk
-MAINTAINER raul.capecce@openupsolutions.com
+MAINTAINER raul.capecce@openupsolutions.com , victor.perez@e-evolution.com
-
-ARG ADEMPIERE_REL
+ARG ADEMPIERE_BINARY
ARG ADEMPIERE_SRC_DIR
ARG ADEMPIERE_DB_HOST
ARG ADEMPIERE_DB_PORT
@@ -12,7 +11,7 @@ ARG ADEMPIERE_DB_PASSWORD
ARG ADEMPIERE_DB_ADMIN_PASSWORD
ARG ADEMPIERE_WEB_PORT
-ENV ADEMPIERE_REL $ADEMPIERE_REL
+ENV ADEMPIERE_BINARY $ADEMPIERE_BINARY
ENV ADEMPIERE_SRC_DIR $ADEMPIERE_SRC_DIR
ENV ADEMPIERE_DB_HOST $ADEMPIERE_DB_HOST
ENV ADEMPIERE_DB_PORT $ADEMPIERE_DB_PORT
@@ -25,14 +24,14 @@ ENV ADEMPIERE_WEB_PORT $ADEMPIERE_WEB_PORT
ENV ADEMPIERE_HOME /opt/Adempiere
ENV AD_DB_Init $AD_DB_Init
-COPY $ADEMPIERE_SRC_DIR/Adempiere_$ADEMPIERE_REL.tar.gz /tmp
+COPY $ADEMPIERE_SRC_DIR/$ADEMPIERE_BINARY /tmp
COPY $ADEMPIERE_SRC_DIR/lib /tmp/lib
COPY $ADEMPIERE_SRC_DIR/packages /tmp/packages
COPY ./adempiere-last/start-adempiere.sh /root
COPY ./adempiere-last/define-ad-ctl.sh /root
RUN cd /tmp && \
-tar zxvf /tmp/Adempiere_$ADEMPIERE_REL.tar.gz && \
+tar zxvf /tmp/$ADEMPIERE_BINARY && \
mv Adempiere /opt/Adempiere && \
mv lib /opt/Adempiere/lib && \
mv packages /opt/Adempiere/packages && \
diff --git a/adempiere.yml b/adempiere.yml
new file mode 100644
index 0000000..a891838
--- /dev/null
+++ b/adempiere.yml
@@ -0,0 +1,45 @@
+# Copyright (C) 2010-2017, OpenUp S.A. , http://www.openup.com.uy
+# Copyright (C) 2003-2017, e-Evolution Consultants S.A. , http://www.e-evolution.com
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+# Email: raul.capecce@openupsolutions.com, http://openupsolutions.com , http://github.com/rcapecce
+# Email: victor.perez@e-evolution.com, http://www.e-evolution.com , http://github.com/e-Evolution
+#
+
+version: '3'
+services:
+ adempiere-tenant:
+ networks:
+ - custom
+ external_links:
+ - database:database
+ image: "${COMPOSE_PROJECT_NAME}" # Name of the instance for docker create based on project name
+ container_name: "${COMPOSE_PROJECT_NAME}" # Name of the ADempiere client container
+ ports:
+ - ${ADEMPIERE_WEB_PORT}:8888 # http port where the web client will be exposed
+ - ${ADEMPIERE_SSL_PORT}:444 # https port where the web client will be exposed
+ environment:
+ ADEMPIERE_DB_INIT: ${ADEMPIERE_DB_INIT} # ATENTION If is "Y" it will be replace de actual defined database with a empty ADempiere seed
+ build:
+ context: .
+ dockerfile: ./adempiere-last/Dockerfile
+ args:
+ ADEMPIERE_BINARY : ${ADEMPIERE_BINARY}
+ ADEMPIERE_SRC_DIR: "./${COMPOSE_PROJECT_NAME}" # Directory that contain the ADempiere installer, customization and localization
+ ADEMPIERE_DB_HOST: "database"
+ ADEMPIERE_DB_PORT: 5432
+ ADEMPIERE_DB_NAME: "${COMPOSE_PROJECT_NAME}"
+ ADEMPIERE_DB_USER: "${COMPOSE_PROJECT_NAME}"
+ ADEMPIERE_DB_PASSWORD: ${ADEMPIERE_DB_PASSWORD}
+ ADEMPIERE_DB_ADMIN_PASSWORD: ${ADEMPIERE_DB_ADMIN_PASSWORD}
+networks:
+ custom:
+ external: true
diff --git a/application.sh b/application.sh
new file mode 100755
index 0000000..133fa33
--- /dev/null
+++ b/application.sh
@@ -0,0 +1,70 @@
+# Copyright (C) 2003-2017, e-Evolution Consultants S.A. , http://www.e-evolution.com
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+# Email: victor.perez@e-evolution.com, http://www.e-evolution.com , http://github.com/e-Evolution
+
+#!/usr/bin/env bash
+BASE_DIR=$(cd "$(dirname "$0")"; pwd)
+# load environment variables
+. .env
+
+if [ $(docker network inspect -f '{{.Name}}' custom) != "custom" ];
+then
+ echo "Create custom network"
+ docker network create -d bridge custom
+fi
+
+if [ $(docker inspect -f '{{.State.Running}}' postgres96_database_1) = "true" ];
+then
+ echo "Database container is running"
+else
+ echo "Create Database container"
+ docker-compose \
+ -f "$BASE_DIR/database.yml" \
+ -f "$BASE_DIR/database.volume.yml" \
+ "$@" \
+ -p postgres96_database_1
+fi
+
+# Define Adempiere path and binary
+ADEMPIERE_PATH="./$COMPOSE_PROJECT_NAME"
+ADEMPIERE_BINARY=Adempiere_${ADEMPIERE_VERSION//.}"LTS.tar.gz"
+export ADEMPIERE_BINARY;
+URL="https://github.com/adempiere/adempiere/releases/download/"$ADEMPIERE_VERSION"/"$ADEMPIERE_BINARY
+
+echo "Adempiere Path $ADEMPIERE_PATH"
+echo "Adempiere Version $ADEMPIERE_VERSION"
+echo "Adempiere Binary $ADEMPIERE_PATH/$ADEMPIERE_BINARY"
+echo "Download from $URL"
+
+
+if [ -d "$ADEMPIERE_PATH" ]
+then
+ if [ -f "$ADEMPIERE_PATH/$ADEMPIERE_BINARY" ]
+ then
+ echo "Installed based on $ADEMPIERE_PATH/$ADEMPIERE_BINARY"
+ else
+ curl -L $URL > "$ADEMPIERE_PATH/$ADEMPIERE_BINARY"
+ if [ -f "$ADEMPIERE_PATH/$ADEMPIERE_BINARY" ]
+ then
+ echo "Adempiere Binary download successful"
+ else
+ "Adempiere Binary not download"
+ exit
+ fi
+ fi
+ # Execute docker-compose
+ docker-compose \
+ -f "$BASE_DIR/adempiere.yml" \
+ "$@"
+else
+ echo "Project directory not found for : $COMPOSE_PROJECT_NAME "
+fi
\ No newline at end of file
diff --git a/database.volume.yml b/database.volume.yml
new file mode 100644
index 0000000..1e1894b
--- /dev/null
+++ b/database.volume.yml
@@ -0,0 +1,21 @@
+# Copyright (C) 2003-2017, e-Evolution Consultants S.A. , http://www.e-evolution.com
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+# Email: victor.perez@e-evolution.com, http://www.e-evolution.com , http://github.com/e-Evolution
+
+version: '3'
+services:
+ database:
+ volumes:
+ - database:/var/lib/postgresql/data/
+volumes:
+ database:
+ driver: local
\ No newline at end of file
diff --git a/database.yml b/database.yml
new file mode 100644
index 0000000..9e6cc63
--- /dev/null
+++ b/database.yml
@@ -0,0 +1,32 @@
+# Copyright (C) 2003-2017, e-Evolution Consultants S.A. , http://www.e-evolution.com
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+# Email: victor.perez@e-evolution.com, http://www.e-evolution.com , http://github.com/e-Evolution
+#
+
+version: '3'
+services:
+ database:
+ image: postgres:9.6
+ ports:
+ - "${ADEMPIERE_DB_PORT}:5432"
+ networks:
+ - custom
+ environment:
+ - POSTGRES_USER:postgres
+ - POSTGRES_PASSWORD:postgres
+ - PGDATA:/var/lib/postgresql/data/pgdata
+ - POSTGRES_INITDB_ARGS:''
+ - POSTGRES_INITDB_XLOGDIR:''
+
+networks:
+ custom:
+ external : true
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
deleted file mode 100644
index 21ac6b7..0000000
--- a/docker-compose.yml
+++ /dev/null
@@ -1,81 +0,0 @@
-# Copyright (C) 2010-2017, OpenUp S.A. , http://www.openup.com.uy
-# Copyright (C) 2003-2017, e-Evolution Consultants S.A. , http://www.e-evolution.com
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-# Email: raul.capecce@openupsolutions.com, http://openupsolutions.com , http://github.com/rcapecce
-# Email: victor.perez@e-evolution.com, http://www.e-evolution.com , http://github.com/e-Evolution
-#
-
-version: '3'
-services:
- db:
- image: postgres:9.6
- restart: always
- container_name: ADEMPIERE_DB_PG_96
- volumes:
- - data:/var/lib/postgresql/data/
- ports:
- - "${ADEMPIERE_DB_PORT}:5432"
- environment:
- - POSTGRES_USER:postgres
- - POSTGRES_PASSWORD:postgres
- - PGDATA:/var/lib/postgresql/data/pgdata
- - POSTGRES_DB:adempiere
- - POSTGRES_INITDB_ARGS:''
- - POSTGRES_INITDB_XLOGDIR:''
-
- adempiere-tenant:
- depends_on:
- - db
- image: ${ADEMPIERE_TENANT}
- container_name: ${ADEMPIERE_TENANT}
- ports:
- - ${ADEMPIERE_WEB_PORT}:8888
- - ${ADEMPIERE_SSL_PORT}:444
- environment:
- ADEMPIERE_DB_INIT: ${ADEMPIERE_DB_INIT}
- build:
- context: .
- dockerfile: ./adempiere-last/Dockerfile
- args:
- ADEMPIERE_REL: ${ADEMPIERE_VERSION}
- ADEMPIERE_SRC_DIR: "./${ADEMPIERE_TENANT}"
- ADEMPIERE_DB_HOST: ${ADEMPIERE_DB_SERVER}
- ADEMPIERE_DB_PORT: ${ADEMPIERE_DB_PORT}
- ADEMPIERE_DB_NAME: ${ADEMPIERE_TENANT}
- ADEMPIERE_DB_USER: ${ADEMPIERE_DB_USER}
- ADEMPIERE_DB_PASSWORD: ${ADEMPIERE_DB_PASSWORD}
- ADEMPIERE_DB_ADMIN_PASSWORD: ${ADEMPIERE_DB_ADMIN_PASSWORD}
-
- #adempiere-tenant2:
- # depends_on:
- # - db
- # image: adempiere-tenant2
- # container_name: adempiere-tenant2
- # ports:
- # - 8274:8888
- # environment:
- # ADEMPIERE_DB_INIT: Y
- # build:
- # context: .
- # dockerfile: ./adempiere-last/Dockerfile
- # args:
- # ADEMPIERE_REL: 390LTS
- # ADEMPIERE_SRC_DIR: ./tenant2
- # ADEMPIERE_DB_HOST: 10.10.1.122
- # ADEMPIERE_DB_PORT: 54321
- # ADEMPIERE_DB_NAME: dbtenant2
- # ADEMPIERE_DB_USER: usertenant2
- # ADEMPIERE_DB_PASSWORD: postgres
- # ADEMPIERE_DB_ADMIN_PASSWORD: postgres
-
-volumes:
- data: {}