emersonmello / docker-fidouafserver

FIDO UAF Demo Server inside Docker container (Apache Tomcat and MySQL)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FIDO UAF Demo Server inside Docker container

This project show how to run eBay FIDO UAF Demo Server inside docker container. This project makes use of Apache Tomcat 8.5 as application server and MySQL as database.

Requirements

Running FIDO UAF Demo Server & MySQL inside docker containers

  1. git clone http://github.com/emersonmello/docker-fidouafserver
  2. cd docker-fidouafserver
  3. docker-compose up
  4. Apache Tomcat's container exposes port 8000 on host machine, so to access FIDO UAF Demo Server, you shall to point to http://host-ip-address:8000/.....

Using mysql client inside a MySQL container

  1. Use docker ps to discovery the container' name of MySQL
    • For example:
    $ docker ps --format "Name: {{.Names}}"
    Name: dockerfidouafserver_tomcat_1
    Name: dockerfidouafserver_db_1
    
  2. Execute MySQL client
    • For example:
    $ docker exec -it dockerfidouafserver_db_1 mysql fido -u fidouaf -pfidoUAF
    

Modifying database connection properties

If you intend to change database connection properties (i.e hostname, port, username, password, database) you should edit tomcat/context.xml file (Current MySQL container hostname is db):

<Resource name="jdbc/fidoDB" auth="Container" type="javax.sql.DataSource"
               maxActive="100" maxIdle="30" maxWait="10000"
               username="fidouaf"
               password="fidoUAF"
               driverClassName="com.mysql.jdbc.Driver"
               url="jdbc:mysql://db:3306/fido"/>

and then:

  1. Remember to update docker-compose.yml:
  2. docker-compose stop
  3. docker-compose build
  4. docker-compose up

Modifying database structure

If you intend to change the database structure (i.e. create a new table, etc.), you should put the respective SQL instructions inside of a file (i.e. mychanges.sql) and:

  1. Copy mychanges.sql to mysql subdirectory of this docker project
  2. Edit mysql/Dockerfile and add the line below:
    • ADD mychanges.sql /docker-entrypoint-initdb.d/
  3. docker-compose stop
  4. docker-compose build
  5. docker-compose up

Modifying FIDO UAF Demo Server code

  1. cd docker-fidouafserver
  2. docker-compose stop
  3. cd ..
  4. git clone https://github.com/emersonmello/UAF.git
  5. cd UAF
  6. Do your changes on FIDO UAF Demo Server code
  7. Build the .WAR file of fidouaf - you can follow Building and Running UAF Server Using Maven (CLI only) instructions
  8. Copy the generated .WAR file (you have to rename it to fidouaf.war) to tomcat subdirectory of this docker project
  9. cd docker-fidouafserver
  10. docker-compose build
  11. docker-compose up

Ps: Database properties stored in fidouaf/src/main/webapp/META-INF/context.xml are overwritten by properties present in tomcat/context.xml

Automatically start container

From docker official documentation:

As of Docker 1.2, restart policies are the built-in Docker mechanism for restarting containers when they exit. If set, restart policies will be used when the Docker daemon starts up, as typically happens after a system boot. Restart policies will ensure that linked containers are started in the correct order.

This project uses docker-compose multiple files concept, so you need to follow these steps:

  1. cd docker-fidouafserver
  2. docker-compose stop
  3. docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d

About

FIDO UAF Demo Server inside Docker container (Apache Tomcat and MySQL)

License:Apache License 2.0