Difference between pages "Creating ADempiere Instances with Docker" and "File:GMFigura24.jpg"

From ADempiere
(Difference between pages)
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.
 
 
Line 1: Line 1:
= Introduction =
+
 
== General ==
+
By: [[User:mar_cal_westf|Mario Calderon]]
+
<br>Docker is an open platform for developers and sysadmins to build, ship, and run applications.
+
<br>With Docker, we can run locally an instance from the latest ADempiere revision directly from the sources, without having to download them or creating a development context.
+
<br>
+
<br>[[User:vpj-cd|Víctor Pérez]] created a Git project, where he configured everything to get ADempiere installed in a Docker container.
+
<br>In the following lines, it will be explained how to get ADempiere running within a Docker container.
+
<br>For Oracle and for Postgres there will be different Docker instances.
+
<br>
+
<br>Docker can be installed on several operating systems; here an example on Suse 13.1 will be shown.
+
<br><b>Docker is not intended to replace building a binary from Eclipse, nor downloading the official binary from SF. It is rather an additional alternative to get ADempiere for testing or demos.</b>
+
<br>
+
<br>As this is -at least for me- a novel tool, it is more than welcome that others try it out and document here their experiences with Docker.
+
== Useful links ==
+
For a detailed explanation of how Docker works, the following links may be useful.
+
*  [https://docs.docker.com/userguide/ Docker User Guide]
+
*  [https://docs.docker.com/installation/ Installation guides for different operating systems]
+
*  [https://docs.docker.com/installation/openSUSE/ Install Docker for OpenSuse]
+
*  [https://docs.docker.com/userguide/dockerimages/ How to manage Docker Docker images]
+
*  [https://docs.docker.com/reference/commandline/cli/ Docker Coomand Line Interface]
+
*  [http://www.slideshare.net/jpetazzo/containerization-new-virtualization-docker-separation-operational-concerns?utm_source=Docker+News&utm_campaign=3432c436f6-Docker_Weekly_November_12th_201411_11_2014&utm_medium=email&utm_term=0_c0995b6e8f-3432c436f6-235896557 Explanatory presentation on containerization]
+
= Installation =
+
== Installing Docker ==
+
Docker can be installed on several operating systems.
+
<br>Please follow the link above to find the operating system where you want to run Docker.
+
<br>Here, it will be shown how to install and run docker on a Suse 13.1.
+
== Install Docker for SUSE 13.1 ==
+
In the links above, you find the installation steps for different operating systems. Here we will follow the steps to install Docker on Suse 13.1
+
<br>The steps were taken directly form the corresponding page.
+
# In console log in as root: ''su -''
+
# ''zypper ar -f http://download.opensuse.org/repositories/Virtualization/openSUSE_13.1/ Virtualization''
+
# ''rpm --import http://download.opensuse.org/repositories/Virtualization/openSUSE_13.1/repodata/repomd.xml.key''
+
# ''zypper in docker''
+
# Start the docker service: ''systemctl start docker''
+
# User to group docker: ''/usr/sbin/usermod -a -G docker <myUserName>''
+
# In case you need it, you can run Docker in a console as root: ''docker run --rm -i -t opensuse /bin/bash'' 
+
# For other operating systems, follow the links stated above.
+
= Clone Docker ADempiere project =
+
Now that Docker is installed, we will clone the ADempiere project locally.
+
Once cloned, we will be able to build the containers and run instances of them.
+
# Open a console as normal user
+
# Create directory for docker project: ''mkdir <myPath>/Adempiere/docker''
+
# Go to this directory: ''cd <myPath>/Adempiere/docker''
+
# Clone project created by [[User:vpj-cd|Víctor Pérez]] : ''git clone https://github.com/adempiere/docker-adempiere.git''
+
= Instances Building =
+
== Build a Postgres instance ==
+
# In a console, log in as root: ''su - root''
+
#  Go to the repository directory for Postgres: ''cd <myPath>/Adempiere/docker/adempiere/dockerizing-adempiere-postgres''
+
# Build the instance and give it a name (in this case adempiere/postgres:v380). Don't forget the "DOT" in the end: ''docker build  -t=adempiere/postgres:v380 .'' 
+
# it takes some minutes
+
# installs Postgres and Adempiere
+
== Build an Oracle instance ==
+
# In a console, log in as root: ''su - root''
+
#  Go to the repository directory for Postgres: ''cd <myPath>/Adempiere/docker/adempiere/dockerizing-adempiere-oracle''
+
# Build the instance and give it a name (in this case adempiere/oracle:v380). Don't forget the "DOT" in the end: ''docker build  -t=adempiere/oracle:v380 .''
+
# it takes some minutes
+
# installs Oracle and Adempiere
+
= Running instances =
+
== Run a Postgres instance ==
+
# Run an instance with ports set manually: ''docker run -d -h adempiere-postgres -p 59160:22 -p 59161:1571 -p 59163:80 -p 59164:443 adempiere/postgres:v380''
+
# Run an instance with ports automatically set: ''docker run -d -h adempiere-postgres -P adempiere/postgres:v380''
+
Result for example
+
* 49173:80 -p 49174:443 adempiere/postgres:v380
+
* f5689692a1902ee9c19e94c8cbdbace29575c502fb66abb03e2de23e7c0c7f50
+
* h, --hostname="Container host name"  here it MUST BE "adempiere-postgres", because it is so defined in Docker
+
* Image: adempiere/postgres:v380
+
*  A memory instance (non-persistence) is created (e.g. c03ed03d76e531fbe144a0eaf7b6ed0fad9aae84369ccc89d23a9ed882f58c91)
+
* Note the local ports have been redirected to the instance. For example, port 59163 goes to the instance's port 80
+
* Adempiere was installed under /data2/app/Adempiere/
+
== Run an Oracle instance ==
+
# Run an instance with ports set manually: ''docker run -d -h adempiere-oracle -p 49160:22 -p 49161:1521 -p 49162:8080 -p 49163:80 -p 49164:443 adempiere/oracle:v380''
+
# Run an instance with ports automatically set: ''docker run -d -h adempiere-oracle -P adempiere/oracle:v380''
+
# -h, --hostname="Container host name"  here it MUST BE "adempiere-oracle", because it is so defined in Docker
+
# Image: adempiere/oracle:v380
+
# A memory instance (non-persistence) is created (e.g. c03ed03d76e531fbe144a0eaf7b6ed0fad9aae84369ccc89d23a9ed882f58c91)
+
# Note the local ports have been redirected to the instance. For example, port 49163 goes to the instance's port 80
+
# Adempiere was installed under /u01/app/Adempiere/
+
<br>To correct Oracle configuration (meanwhile it is not corrected in the Git project)
+
*''cat  /u01/app/oracle/product/11.2.0/xe/network/admin/tnsnames.ora''
+
*''cat /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora''
+
* sed -i -E "s/HOST = [^)]+/HOST = adempiere-oracle/g" /u01/app/oracle/product/11.2.0/xe/network/admin/tnsnames.ora
+
* sed -i -E "s/HOST = [^)]+/HOST = adempiere-oracle/g" /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
+
* sed -i -E "s/-Xms64M/-Duser.timezone=GMT -Xms64M/g" myEnvironment.sh
+
* tnsping XE
+
= Log in into an instance =
+
*Usage: ''ssh root@<IP of instance> -p <forwarded port 22>''
+
**<IP of instance> found by: ''ifconfig'' or ''docker inspect $(docker ps -q) | grep IPA''
+
**<forwarded port 22> set by "docker build ..." and seen with "docker ps"
+
== Log in into a Postgres instance ==
+
*In console: ''ssh root@<IP of instance> -p 59160''
+
*Or (if there is only one instance running): ''ssh root@localhost -p 59160 ''
+
*password of postgres instance: ''adempiere''
+
*start Postgres: ''service postgresql start''
+
== Log in into a Oracle instance ==
+
*In console: ''ssh root@<IP of instance> -p 49160  ''
+
*password of oracle instance: ''admin''
+
*Start Oracle: ''service oracle-xe restart''
+
= Run ADempiere =
+
* First: update database
+
**Postgres: ''cd /data/app/Adempiere/utils''
+
** or Oracle: ''cd /u01/app/Adempiere/utils''
+
**Actual update: ''./RUN_ImportAdempiere.sh''
+
* Delete output file: ''rm nohup.out''
+
* Run Application Server
+
** ''nohup ./RUN_Server2.sh &''
+
** to see output of server: ''cat nohup.out | more''
+
* Test Adempiere
+
** Open a Browser: ''<IP of instance>:<forwarded port 80>''
+
= Images =
+
* Save a snapshot
+
** Usage: ''docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]''
+
**e.g.: ''docker commit -m "Postgres instance" -a "ADempiere team" 13da4fe883a1 adempiere/postgres:v380''
+
** result: a string like "''5fed353ede7c11f787143a0b1f95fbfa024004f1ea81a258e4ad7e86a8b5be1c''"
+
*Start image
+
**Oracle: ''docker start adempiere/oracle:v380''
+
**Postgres: ''docker start adempiere/postgres:v380''
+
= Useful Docker commands =
+
*To see status of instace: d''ocker ps'' 
+
**Example of information displayed
+
***''CONTAINER ID        IMAGE                      COMMAND                CREATED            STATUS              PORTS                                                                                                                    NAMES''
+
***c''03ed03d76e5        adempiere/oracle:v380  "/bin/sh -c '/usr/sb  20 hours ago        Up 20 hours        0.0.0.0:49160->22/tcp, 0.0.0.0:49161->1521/tcp, 0.0.0.0:49162->8080/tcp, 0.0.0.0:49163->80/tcp, 0.0.0.0:49164->443/tcp  agitated_perlman ''
+
*General information of Docker: ''docker info''
+
**output for example
+
***''Containers: 9  ''                                                                                                                                                         
+
***''Images: 129''                                                                                                                                                               
+
***''Storage Driver: devicemapper''                                                                                                                                             
+
***''Pool Name: docker-8:18-3147211-pool''                                                                                                                                     
+
***''Pool Blocksize: 65.54 kB''                                                                                                                                                 
+
***''Data file: /var/lib/docker/devicemapper/devicemapper/data''                                                                                                               
+
***''Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata''                                                                                                       
+
***''Data Space Used: 9.26 GB''                                                                                                                                                 
+
***''Data Space Total: 107.4 GB''                                                                                                                                               
+
***''Metadata Space Used: 9.679 MB''                                                                                                                                           
+
***''Metadata Space Total: 2.147 GB''                                                                                                                                           
+
***''Library Version: 1.03.01 (2011-10-15)''                                                                                                                                   
+
***''Execution Driver: native-0.2''                                                                                                                                             
+
***''Kernel Version: 3.11.10-17-desktop''                                                                                                                                       
+
***''Operating System: openSUSE 13.1 (Bottle) (x86_64) (containerized)''
+
*To find IP of instace: ''docker inspect $(docker ps -q) | grep IPA''
+
**Result: ''"IPAddress": "172.17.0.40",''
+
*Stop docker container: ''docker stop <container_id>'', e.g. ''docker stop 9aad97a1115d''
+
*Start docker container: ''docker start <container_id>'', e.g. ''docker start 13da4fe883a1''
+
*Help: ''docker --help''
+
** Run 'docker COMMAND --help' for more information on a command.
+
**docker run --help
+
**docker build --help
+
* IP of instace: ''docker inspect $(docker ps -q) | grep IPA''
+
**Result similar to ''"IPAddress": "172.17.0.3",''
+

Revision as of 04:28, 27 February 2009