Tech Tip #66 showed how to run a Java EE 7 application using WildFly and MySQL in two separate containers. It required to explicitly start the two containers, and link them using --link
. This defining and controlling a multi-container service is a common design pattern in order to get an application up and going.
Meet Fig – Docker Orchestration Tool.
Fig allows to:
- Define multiple containers in a single configuration file
- Create dependencies between two containers by creating links between them
- Start containers in the right sequence
Let’s get started!
- Install Fig as:
123curl -L https://github.com/docker/fig/releases/download/1.0.1/fig-`uname-s`-`uname -m` > /usr/local/bin/fig; chmod +x /usr/local/bin/fig - Entry point to Fig is a configuration file that defines the containers and their dependencies. The equivalent configuration file from Tech Tip #65 is:
123456789101112131415mysqldb:image: mysql:latestenvironment:MYSQL_DATABASE: sampleMYSQL_USER: mysqlMYSQL_PASSWORD: mysqlMYSQL_ROOT_PASSWORD: supersecretmywildfly:image: arungupta/wildfly-mysql-javaee7links:- mysqldb:dbports:- 8080:8080
This YML-based configuration file has:- Two containers defined by the name “mysqldb” and “mywildfly”
- Image names are defined using “image”
- Environment variables for the MySQL container are defined in “environment”
- MySQL container is linked with WildFly container using “links”
- Port forwarding is achieved using “ports”
- All the containers can be started, in detached mode, by giving the command:
123fig up -d
The output is shown as:
1234Creating wildflymysqljavaee7_mysqldb_1...Creating wildflymysqljavaee7_mywildfly_1...
Fig commands allow to monitor and update the status of the containers:- Logs can be seen as:
123fig logs - Container status can be seen by giving the command:
123fig ps
to show the output as:
123456Name Command State Ports-----------------------------------------------------------------------------------------------------------wildflymysqljavaee7_mysqldb_1 /entrypoint.sh mysqld --da ... Up 3306/tcpwildflymysqljavaee7_mywildfly_1 /opt/jboss/wildfly/customi ... Up 0.0.0.0:8080->8080/tcp, 9990/tcp - Containers can be stopped as:
123fig stop - Alternatively, containers can be started in foreground by giving the command:
123fig up
and the output is seen as:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292wildfly-mysql-javaee7> fig upCreating wildflymysqljavaee7_mysqldb_1...Creating wildflymysqljavaee7_mywildfly_1...Attaching to wildflymysqljavaee7_mysqldb_1, wildflymysqljavaee7_mywildfly_1mywildfly_1 | => Starting WildFly servermywildfly_1 | => Waiting for the server to bootmysqldb_1 | 2014-12-23 18:28:10 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).mysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: Using atomics to ref count buffer pool pagesmysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: The InnoDB memory heap is disabledmysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtinsmysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: Memory barrier is not usedmysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: Compressed tables use zlib 1.2.3mysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: Using Linux native AIOmysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: Not using CPU crc32 instructionsmysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: Initializing buffer pool, size = 128.0Mmysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: Completed initialization of buffer poolmysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!mysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: Setting file ./ibdata1 size to 12 MBmysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: Database physically writes the file full: wait...mysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MBmysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MBmysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0mysqldb_1 | 2014-12-23 18:28:10 12 [Warning] InnoDB: New log files created, LSN=45781mysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: Doublewrite buffer not found: creating newmysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: Doublewrite buffer createdmysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: 128 rollback segment(s) are active.mysqldb_1 | 2014-12-23 18:28:10 12 [Warning] InnoDB: Creating foreign key constraint system tables.mysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: Foreign key constraint system tables createdmysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: Creating tablespace and datafile system tables.mysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: Tablespace and datafile system tables created.mysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: Waiting for purge to startmysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: 5.6.22 started; log sequence number 0mywildfly_1 | =========================================================================mywildfly_1 |mywildfly_1 | JBoss Bootstrap Environmentmywildfly_1 |mywildfly_1 | JBOSS_HOME: /opt/jboss/wildflymywildfly_1 |mywildfly_1 | JAVA: /usr/lib/jvm/java/bin/javamywildfly_1 |mywildfly_1 | JAVA_OPTS: -server -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=truemywildfly_1 |mywildfly_1 | =========================================================================mywildfly_1 |mysqldb_1 | 2014-12-23 18:28:10 12 [Note] Binlog endmysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: FTS optimize thread exiting.mysqldb_1 | 2014-12-23 18:28:10 12 [Note] InnoDB: Starting shutdown...mywildfly_1 | 18:28:11,257 INFO [org.jboss.modules] (main) JBoss Modules version 1.3.3.Finalmywildfly_1 | 18:28:11,543 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.2.Finalmywildfly_1 | 18:28:11,631 INFO [org.jboss.as] (MSC service thread 1-6) JBAS015899: WildFly 8.2.0.Final "Tweek" startingmysqldb_1 | 2014-12-23 18:28:12 12 [Note] InnoDB: Shutdown completed; log sequence number 1625977mywildfly_1 | 18:28:12,621 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)mywildfly_1 | 18:28:12,642 INFO [org.xnio] (MSC service thread 1-10) XNIO version 3.3.0.Finalmywildfly_1 | 18:28:12,652 INFO [org.xnio.nio] (MSC service thread 1-10) XNIO NIO Implementation Version 3.3.0.Finalmywildfly_1 | 18:28:12,697 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 32) JBAS010280: Activating Infinispan subsystem.mywildfly_1 | 18:28:12,698 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 31) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processorsmywildfly_1 | 18:28:12,880 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)mywildfly_1 | 18:28:12,917 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 40) JBAS011800: Activating Naming Subsystemmywildfly_1 | 18:28:12,987 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 46) JBAS010153: Node identifier property is set to the default value. Please make sure it is unique.mywildfly_1 | 18:28:13,002 INFO [org.jboss.as.security] (ServerService Thread Pool -- 45) JBAS013171: Activating Security Subsystemmywildfly_1 | 18:28:13,082 INFO [org.jboss.as.connector.logging] (MSC service thread 1-7) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.9.Final)mywildfly_1 | 18:28:13,084 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 38) JBAS012615: Activated the following JSF Implementations: [main]mywildfly_1 | 18:28:13,088 INFO [org.jboss.as.security] (MSC service thread 1-15) JBAS013170: Current PicketBox version=4.0.21.Finalmywildfly_1 | 18:28:13,097 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017502: Undertow 1.1.0.Final startingmywildfly_1 | 18:28:13,098 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) JBAS017502: Undertow 1.1.0.Final startingmywildfly_1 | 18:28:13,109 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) JBAS010417: Started Driver service with driver-name = h2mywildfly_1 | 18:28:13,132 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extensionmywildfly_1 | 18:28:13,355 INFO [org.jboss.remoting] (MSC service thread 1-10) JBoss Remoting version 4.0.6.Finalmywildfly_1 | 18:28:13,502 INFO [org.jboss.as.naming] (MSC service thread 1-13) JBAS011802: Starting Naming Servicemywildfly_1 | 18:28:13,503 INFO [org.jboss.as.mail.extension] (MSC service thread 1-4) JBAS015400: Bound mail session [java:jboss/mail/Default]mysqldb_1 | OKmysqldb_1 |mywildfly_1 | 18:28:14,161 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017527: Creating file handler for path /opt/jboss/wildfly/welcome-contentmysqldb_1 | Filling help tables...2014-12-23 18:28:14 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).mysqldb_1 | 2014-12-23 18:28:14 35 [Note] InnoDB: Using atomics to ref count buffer pool pagesmysqldb_1 | 2014-12-23 18:28:14 35 [Note] InnoDB: The InnoDB memory heap is disabledmysqldb_1 | 2014-12-23 18:28:14 35 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtinsmysqldb_1 | 2014-12-23 18:28:14 35 [Note] InnoDB: Memory barrier is not usedmysqldb_1 | 2014-12-23 18:28:14 35 [Note] InnoDB: Compressed tables use zlib 1.2.3mysqldb_1 | 2014-12-23 18:28:14 35 [Note] InnoDB: Using Linux native AIOmysqldb_1 | 2014-12-23 18:28:14 35 [Note] InnoDB: Not using CPU crc32 instructionsmysqldb_1 | 2014-12-23 18:28:14 35 [Note] InnoDB: Initializing buffer pool, size = 128.0Mmywildfly_1 | 18:28:14,190 INFO [org.wildfly.extension.undertow] (MSC service thread 1-9) JBAS017525: Started server default-server.mysqldb_1 | 2014-12-23 18:28:14 35 [Note] InnoDB: Completed initialization of buffer poolmysqldb_1 | 2014-12-23 18:28:14 35 [Note] InnoDB: Highest supported file format is Barracuda.mysqldb_1 | 2014-12-23 18:28:14 35 [Note] InnoDB: 128 rollback segment(s) are active.mysqldb_1 | 2014-12-23 18:28:14 35 [Note] InnoDB: Waiting for purge to startmywildfly_1 | 18:28:14,271 INFO [org.wildfly.extension.undertow] (MSC service thread 1-16) JBAS017531: Host default-host startingmysqldb_1 | 2014-12-23 18:28:14 35 [Note] InnoDB: 5.6.22 started; log sequence number 1625977mywildfly_1 | 18:28:14,366 INFO [org.wildfly.extension.undertow] (MSC service thread 1-9) JBAS017519: Undertow HTTP listener default listening on /0.0.0.0:8080mysqldb_1 | 2014-12-23 18:28:14 35 [Note] Binlog endmysqldb_1 | 2014-12-23 18:28:14 35 [Note] InnoDB: FTS optimize thread exiting.mysqldb_1 | 2014-12-23 18:28:14 35 [Note] InnoDB: Starting shutdown...mywildfly_1 | 18:28:14,548 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-7) JBAS015012: Started FileSystemDeploymentService for directory /opt/jboss/wildfly/standalone/deploymentsmywildfly_1 | 18:28:14,584 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-14) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]mywildfly_1 | 18:28:14,697 INFO [org.jboss.ws.common.management] (MSC service thread 1-15) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.3.2.Finalmywildfly_1 | 18:28:14,766 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/managementmywildfly_1 | 18:28:14,766 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990mywildfly_1 | 18:28:14,768 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.2.0.Final "Tweek" started in 3852ms - Started 184 of 234 services (82 services are lazy, passive or on-demand)mywildfly_1 | => Executing the commandsmywildfly_1 | => MYSQL_HOST:mywildfly_1 | => MYSQL_PORT:mywildfly_1 | => MYSQL (host): 172.17.0.4mywildfly_1 | => MYSQL (port): 3306mysqldb_1 | 2014-12-23 18:28:16 35 [Note] InnoDB: Shutdown completed; log sequence number 1625987mywildfly_1 | [standalone@localhost:9990 /] batchmywildfly_1 | [standalone@localhost:9990 / #]mywildfly_1 | [standalone@localhost:9990 / #] # Add MySQL modulemywildfly_1 | [standalone@localhost:9990 / #] module add --name=com.mysql --resources=/opt/jboss/wildfly/customization/mysql-connector-java-5.1.31-bin.jar --dependencies=javax.api,javax.transaction.apimywildfly_1 | [standalone@localhost:9990 / #]mywildfly_1 | [standalone@localhost:9990 / #] # Add MySQL drivermywildfly_1 | [standalone@localhost:9990 / #] /subsystem=datasources/jdbc-driver=mysql:add(driver-name=mysql,driver-module-name=com.mysql,driver-xa-datasource-class-name=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource)mywildfly_1 | [standalone@localhost:9990 / #]mywildfly_1 | [standalone@localhost:9990 / #] # Add the datasourcemywildfly_1 | [standalone@localhost:9990 / #] #data-source add --name=mysqlDS --driver-name=mysql --jndi-name=java:jboss/datasources/ExampleMySQLDS --connection-url=jdbc:mysql://:/sample?useUnicode=true&characterEncoding=UTF-8 --user-name=mysql --password=mysql --use-ccm=false --max-pool-size=25 --blocking-timeout-wait-millis=5000 --enabled=truemywildfly_1 | [standalone@localhost:9990 / #]mywildfly_1 | [standalone@localhost:9990 / #] data-source add --name=mysqlDS --driver-name=mysql --jndi-name=java:jboss/datasources/ExampleMySQLDS --connection-url=jdbc:mysql://172.17.0.4:3306/sample?useUnicode=true&characterEncoding=UTF-8 --user-name=mysql --password=mysql --use-ccm=false --max-pool-size=25 --blocking-timeout-wait-millis=5000 --enabled=truemywildfly_1 | [standalone@localhost:9990 / #]mywildfly_1 | [standalone@localhost:9990 / #] # Execute the batchmywildfly_1 | [standalone@localhost:9990 / #] run-batchmywildfly_1 | 18:28:16,957 INFO [org.jboss.as.connector.subsystems.datasources] (management-handler-thread - 4) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)mywildfly_1 | 18:28:16,963 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-11) JBAS010417: Started Driver service with driver-name = mysqlmywildfly_1 | 18:28:16,976 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-5) JBAS010400: Bound data source [java:jboss/datasources/ExampleMySQLDS]mywildfly_1 | The batch executed successfullymywildfly_1 | [standalone@localhost:9990 /]mywildfly_1 | => Shutting down WildFlymysqldb_1 | OKmysqldb_1 |mysqldb_1 | To start mysqld at boot time you have to copymysqldb_1 | support-files/mysql.server to the right place for your systemmysqldb_1 |mysqldb_1 | PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !mysqldb_1 | To do so, start the server, then issue the following commands:mysqldb_1 |mysqldb_1 | ./bin/mysqladmin -u root password 'new-password'mysqldb_1 | ./bin/mysqladmin -u root -h 8aca3b20ca40 password 'new-password'mysqldb_1 |mysqldb_1 | Alternatively you can run:mysqldb_1 |mysqldb_1 | ./bin/mysql_secure_installationmysqldb_1 |mysqldb_1 | which will also give you the option of removing the testmysqldb_1 | databases and anonymous user created by default. This ismysqldb_1 | strongly recommended for production servers.mysqldb_1 |mysqldb_1 | See the manual for more instructions.mysqldb_1 |mysqldb_1 | You can start the MySQL daemon with:mysqldb_1 |mysqldb_1 | cd . ; ./bin/mysqld_safe &mysqldb_1 |mysqldb_1 | You can test the MySQL daemon with mysql-test-run.plmysqldb_1 |mysqldb_1 | cd mysql-test ; perl mysql-test-run.plmysqldb_1 |mysqldb_1 | Please report any problems at http://bugs.mysql.com/mysqldb_1 |mysqldb_1 | The latest information about MySQL is available on the web atmysqldb_1 |mysqldb_1 | http://www.mysql.commysqldb_1 |mysqldb_1 | Support MySQL by buying support/licenses at http://shop.mysql.commysqldb_1 |mysqldb_1 | New default config file was created as ./my.cnf andmysqldb_1 | will be used by default by the server when you start it.mysqldb_1 | You may edit this file to change server settingsmysqldb_1 |mysqldb_1 | 2014-12-23 18:28:17 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).mysqldb_1 | 2014-12-23 18:28:17 1 [Note] Plugin 'FEDERATED' is disabled.mysqldb_1 | 2014-12-23 18:28:17 1 [Note] InnoDB: Using atomics to ref count buffer pool pagesmysqldb_1 | 2014-12-23 18:28:17 1 [Note] InnoDB: The InnoDB memory heap is disabledmysqldb_1 | 2014-12-23 18:28:17 1 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtinsmysqldb_1 | 2014-12-23 18:28:17 1 [Note] InnoDB: Memory barrier is not usedmysqldb_1 | 2014-12-23 18:28:17 1 [Note] InnoDB: Compressed tables use zlib 1.2.3mysqldb_1 | 2014-12-23 18:28:17 1 [Note] InnoDB: Using Linux native AIOmysqldb_1 | 2014-12-23 18:28:17 1 [Note] InnoDB: Not using CPU crc32 instructionsmysqldb_1 | 2014-12-23 18:28:17 1 [Note] InnoDB: Initializing buffer pool, size = 128.0Mmysqldb_1 | 2014-12-23 18:28:17 1 [Note] InnoDB: Completed initialization of buffer poolmysqldb_1 | 2014-12-23 18:28:17 1 [Note] InnoDB: Highest supported file format is Barracuda.mysqldb_1 | 2014-12-23 18:28:17 1 [Note] InnoDB: 128 rollback segment(s) are active.mysqldb_1 | 2014-12-23 18:28:17 1 [Note] InnoDB: Waiting for purge to startmysqldb_1 | 2014-12-23 18:28:17 1 [Note] InnoDB: 5.6.22 started; log sequence number 1625987mysqldb_1 | 2014-12-23 18:28:17 1 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 76e25b07-8ad1-11e4-9167-0242ac110004.mysqldb_1 | 2014-12-23 18:28:17 1 [Note] Server hostname (bind-address): '*'; port: 3306mysqldb_1 | 2014-12-23 18:28:17 1 [Note] IPv6 is available.mysqldb_1 | 2014-12-23 18:28:17 1 [Note] - '::' resolves to '::';mysqldb_1 | 2014-12-23 18:28:17 1 [Note] Server socket created on IP: '::'.mysqldb_1 | 2014-12-23 18:28:17 1 [Note] Event Scheduler: Loaded 0 eventsmysqldb_1 | 2014-12-23 18:28:17 1 [Note] Execution of init_file '/tmp/mysql-first-time.sql' started.mysqldb_1 | 2014-12-23 18:28:17 1 [Note] Execution of init_file '/tmp/mysql-first-time.sql' ended.mysqldb_1 | 2014-12-23 18:28:17 1 [Note] mysqld: ready for connections.mysqldb_1 | Version: '5.6.22' socket: '/tmp/mysql.sock' port: 3306 MySQL Community Server (GPL)mywildfly_1 | {"outcome" => "success"}mywildfly_1 | => Restarting WildFlymywildfly_1 | 18:28:17,931 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-15) JBAS010409: Unbound data source [java:jboss/datasources/ExampleMySQLDS]mywildfly_1 | 18:28:17,931 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-11) JBAS010409: Unbound data source [java:jboss/datasources/ExampleDS]mywildfly_1 | 18:28:17,942 INFO [org.wildfly.extension.undertow] (MSC service thread 1-5) JBAS017532: Host default-host stoppingmywildfly_1 | 18:28:17,946 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-11) JBAS010418: Stopped Driver service with driver-name = mysqlmywildfly_1 | 18:28:17,956 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) JBAS010418: Stopped Driver service with driver-name = h2mywildfly_1 | 18:28:17,981 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) JBAS017521: Undertow HTTP listener default suspendingmywildfly_1 | 18:28:18,004 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) JBAS017520: Undertow HTTP listener default stopped, was bound to /0.0.0.0:8080mywildfly_1 | 18:28:18,007 INFO [org.wildfly.extension.undertow] (MSC service thread 1-5) JBAS017506: Undertow 1.1.0.Final stoppingmywildfly_1 | =========================================================================mywildfly_1 |mywildfly_1 | JBoss Bootstrap Environmentmywildfly_1 |mywildfly_1 | JBOSS_HOME: /opt/jboss/wildflymywildfly_1 |mywildfly_1 | JAVA: /usr/lib/jvm/java/bin/javamywildfly_1 |mywildfly_1 | JAVA_OPTS: -server -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=truemywildfly_1 |mywildfly_1 | =========================================================================mywildfly_1 |mywildfly_1 | 18:28:18,082 INFO [org.jboss.as] (MSC service thread 1-10) JBAS015950: WildFly 8.2.0.Final "Tweek" stopped in 148msmywildfly_1 | 18:28:18,438 INFO [org.jboss.modules] (main) JBoss Modules version 1.3.3.Finalmywildfly_1 | 18:28:18,691 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.2.Finalmywildfly_1 | 18:28:18,769 INFO [org.jboss.as] (MSC service thread 1-7) JBAS015899: WildFly 8.2.0.Final "Tweek" startingmywildfly_1 | 18:28:19,737 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)mywildfly_1 | 18:28:19,756 INFO [org.xnio] (MSC service thread 1-12) XNIO version 3.3.0.Finalmywildfly_1 | 18:28:19,765 INFO [org.xnio.nio] (MSC service thread 1-12) XNIO NIO Implementation Version 3.3.0.Finalmywildfly_1 | 18:28:19,798 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 32) JBAS010280: Activating Infinispan subsystem.mywildfly_1 | 18:28:19,802 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 31) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processorsmywildfly_1 | 18:28:19,834 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 40) JBAS011800: Activating Naming Subsystemmywildfly_1 | 18:28:19,837 INFO [org.jboss.as.security] (ServerService Thread Pool -- 45) JBAS013171: Activating Security Subsystemmywildfly_1 | 18:28:19,843 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 46) JBAS010153: Node identifier property is set to the default value. Please make sure it is unique.mywildfly_1 | 18:28:19,846 INFO [org.jboss.as.security] (MSC service thread 1-9) JBAS013170: Current PicketBox version=4.0.21.Finalmywildfly_1 | 18:28:19,868 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 38) JBAS012615: Activated the following JSF Implementations: [main]mywildfly_1 | 18:28:19,892 INFO [org.jboss.as.connector.logging] (MSC service thread 1-10) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.9.Final)mywildfly_1 | 18:28:19,902 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extensionmywildfly_1 | 18:28:19,943 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017502: Undertow 1.1.0.Final startingmywildfly_1 | 18:28:19,943 INFO [org.wildfly.extension.undertow] (MSC service thread 1-15) JBAS017502: Undertow 1.1.0.Final startingmywildfly_1 | 18:28:19,969 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)mywildfly_1 | 18:28:19,980 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) JBAS010417: Started Driver service with driver-name = h2mywildfly_1 | 18:28:20,027 INFO [org.jboss.as.mail.extension] (MSC service thread 1-3) JBAS015400: Bound mail session [java:jboss/mail/Default]mywildfly_1 | 18:28:20,027 INFO [org.jboss.as.naming] (MSC service thread 1-1) JBAS011802: Starting Naming Servicemywildfly_1 | 18:28:20,139 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)mywildfly_1 | 18:28:20,141 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-13) JBAS010417: Started Driver service with driver-name = mysqlmywildfly_1 | 18:28:20,155 INFO [org.jboss.remoting] (MSC service thread 1-12) JBoss Remoting version 4.0.6.Finalmywildfly_1 | 18:28:20,391 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017527: Creating file handler for path /opt/jboss/wildfly/welcome-contentmywildfly_1 | 18:28:20,408 INFO [org.wildfly.extension.undertow] (MSC service thread 1-14) JBAS017525: Started server default-server.mywildfly_1 | 18:28:20,429 INFO [org.wildfly.extension.undertow] (MSC service thread 1-14) JBAS017531: Host default-host startingmywildfly_1 | 18:28:20,560 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) JBAS017519: Undertow HTTP listener default listening on /0.0.0.0:8080mywildfly_1 | 18:28:20,696 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-13) JBAS015012: Started FileSystemDeploymentService for directory /opt/jboss/wildfly/standalone/deploymentsmywildfly_1 | 18:28:20,697 INFO [org.jboss.as.server.deployment] (MSC service thread 1-16) JBAS015876: Starting deployment of "temp.war" (runtime-name: "temp.war")mywildfly_1 | 18:28:20,701 INFO [org.jboss.as.server.deployment] (MSC service thread 1-15) JBAS015876: Starting deployment of "employees.war" (runtime-name: "employees.war")mywildfly_1 | 18:28:20,719 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) JBAS010400: Bound data source [java:jboss/datasources/ExampleMySQLDS]mywildfly_1 | 18:28:20,720 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]mywildfly_1 | 18:28:20,815 INFO [org.jboss.as.jpa] (MSC service thread 1-6) JBAS011401: Read persistence.xml for MyPUmywildfly_1 | 18:28:20,867 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 50) JBAS011409: Starting Persistence Unit (phase 1 of 2) Service 'employees.war#MyPU'mywildfly_1 | 18:28:20,880 INFO [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 50) HHH000204: Processing PersistenceUnitInfo [mywildfly_1 | name: MyPUmywildfly_1 | ...]mywildfly_1 | 18:28:20,959 INFO [org.jboss.ws.common.management] (MSC service thread 1-10) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.3.2.Finalmywildfly_1 | 18:28:20,980 INFO [org.hibernate.Version] (ServerService Thread Pool -- 50) HHH000412: Hibernate Core {4.3.7.Final}mywildfly_1 | 18:28:20,984 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 50) HHH000206: hibernate.properties not foundmywildfly_1 | 18:28:20,986 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 50) HHH000021: Bytecode provider name : javassistmywildfly_1 | 18:28:21,081 INFO [org.jboss.weld.deployer] (MSC service thread 1-9) JBAS016002: Processing weld deployment employees.warmywildfly_1 | 18:28:21,127 INFO [org.hibernate.validator.internal.util.Version] (MSC service thread 1-9) HV000001: Hibernate Validator 5.1.3.Finalmywildfly_1 | 18:28:21,180 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) JBAS017534: Registered web context: /tempmywildfly_1 | 18:28:21,264 INFO [org.jboss.weld.deployer] (MSC service thread 1-13) JBAS016005: Starting Services for CDI deployment: employees.warmywildfly_1 | 18:28:21,298 INFO [org.jboss.weld.Version] (MSC service thread 1-13) WELD-000900: 2.2.6 (Final)mywildfly_1 | 18:28:21,310 INFO [org.jboss.weld.deployer] (MSC service thread 1-10) JBAS016008: Starting weld service for deployment employees.warmywildfly_1 | 18:28:21,452 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 50) JBAS011409: Starting Persistence Unit (phase 2 of 2) Service 'employees.war#MyPU'mywildfly_1 | 18:28:21,521 INFO [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 50) HCANN000001: Hibernate Commons Annotations {4.0.4.Final}mysqldb_1 | 2014-12-23 18:28:21 1 [Warning] IP address '172.17.0.5' could not be resolved: Name or service not knownmywildfly_1 | 18:28:21,845 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 50) HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialectmywildfly_1 | 18:28:21,940 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 50) HHH000397: Using ASTQueryTranslatorFactorymywildfly_1 | 18:28:22,276 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 50) HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialectmywildfly_1 | 18:28:22,282 INFO [stdout] (ServerService Thread Pool -- 50) Hibernate: drop table if exists EMPLOYEE_SCHEMAmywildfly_1 | 18:28:22,289 INFO [stdout] (ServerService Thread Pool -- 50) Hibernate: drop table if exists hibernate_sequencemywildfly_1 | 18:28:22,290 INFO [stdout] (ServerService Thread Pool -- 50) Hibernate: create table EMPLOYEE_SCHEMA (id integer not null, name varchar(40), primary key (id))mywildfly_1 | 18:28:22,300 INFO [stdout] (ServerService Thread Pool -- 50) Hibernate: create table hibernate_sequence ( next_val bigint )mywildfly_1 | 18:28:22,310 INFO [stdout] (ServerService Thread Pool -- 50) Hibernate: insert into hibernate_sequence values ( 1 )mywildfly_1 | 18:28:22,312 INFO [stdout] (ServerService Thread Pool -- 50) Hibernate: INSERT INTO EMPLOYEE_SCHEMA(ID, NAME) VALUES (1, 'Penny')mywildfly_1 | 18:28:22,314 INFO [stdout] (ServerService Thread Pool -- 50) Hibernate: INSERT INTO EMPLOYEE_SCHEMA(ID, NAME) VALUES (2, 'Sheldon')mywildfly_1 | 18:28:22,317 INFO [stdout] (ServerService Thread Pool -- 50) Hibernate: INSERT INTO EMPLOYEE_SCHEMA(ID, NAME) VALUES (3, 'Amy')mywildfly_1 | 18:28:22,320 INFO [stdout] (ServerService Thread Pool -- 50) Hibernate: INSERT INTO EMPLOYEE_SCHEMA(ID, NAME) VALUES (4, 'Leonard')mywildfly_1 | 18:28:22,323 INFO [stdout] (ServerService Thread Pool -- 50) Hibernate: INSERT INTO EMPLOYEE_SCHEMA(ID, NAME) VALUES (5, 'Bernadette')mywildfly_1 | 18:28:22,324 INFO [stdout] (ServerService Thread Pool -- 50) Hibernate: INSERT INTO EMPLOYEE_SCHEMA(ID, NAME) VALUES (6, 'Raj')mywildfly_1 | 18:28:22,328 INFO [stdout] (ServerService Thread Pool -- 50) Hibernate: INSERT INTO EMPLOYEE_SCHEMA(ID, NAME) VALUES (7, 'Howard')mywildfly_1 | 18:28:22,330 INFO [stdout] (ServerService Thread Pool -- 50) Hibernate: INSERT INTO EMPLOYEE_SCHEMA(ID, NAME) VALUES (8, 'Priya')mywildfly_1 | 18:28:23,361 INFO [org.jboss.resteasy.spi.ResteasyDeployment] (MSC service thread 1-1) Deploying javax.ws.rs.core.Application: class org.javaee7.samples.employees.MyApplicationmywildfly_1 | 18:28:23,396 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) JBAS017534: Registered web context: /employeesmywildfly_1 | 18:28:23,433 INFO [org.jboss.as.server] (ServerService Thread Pool -- 28) JBAS018559: Deployed "employees.war" (runtime-name : "employees.war")mywildfly_1 | 18:28:23,434 INFO [org.jboss.as.server] (ServerService Thread Pool -- 28) JBAS018559: Deployed "temp.war" (runtime-name : "temp.war")mywildfly_1 | 18:28:23,452 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/managementmywildfly_1 | 18:28:23,453 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990mywildfly_1 | 18:28:23,453 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.2.0.Final "Tweek" started in 5330ms - Started 344 of 404 services (102 services are lazy, passive or on-demand)mywildfly_1 | 18:28:30,954 INFO [stdout] (default task-1) Hibernate: select employee0_.id as id1_0_, employee0_.name as name2_0_ from EMPLOYEE_SCHEMA employee0_
- Logs can be seen as:
- Find out the IP address using
boot2docker ip
and access the app as:
1234curl http://192.168.59.103:8080/employees/resources/employees<?xml version="1.0" encoding="UTF-8" standalone="yes"?><collection><employee><id>1</id><name>Penny</name></employee><employee><id>2</id><name>Sheldon</name></employee><employee><id>3</id><name>Amy</name></employee><employee><id>4</id><name>Leonard</name></employee><employee><id>5</id><name>Bernadette</name></employee><employee><id>6</id><name>Raj</name></employee><employee><id>7</id><name>Howard</name></employee><employee><id>8</id><name>Priya</name></employee></collection>
Complete list of Fig commands can be seen by typing fig
:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
Commands:
build Build or rebuild services
help Get help on a command
kill Kill containers
logs View output from containers
port Print the public port for a port binding
ps List containers
pull Pulls service images
rm Remove stopped containers
run Run a one-off command
scale Set number of containers for a service
start Start services
stop Stop services
restart Restart services
up Create and start containers
|
Particularly interesting is scale
command, and we’ll take a look at it in a subsequent blog.
File issues on github.
Enjoy!