Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

 

Alternative approach for the Github setup when using Windows:

  • download the Windows client and do the basic configuration (e.g. base directory for the local repositories)
  • log into the Github web page, search for the "oregami" repository and choose "oregami/oregami-dropwizard-angularjs"
  • create a fork via the "Fork" button and download your clone of the repository to your local hard drive by clicking "Clone in Windows" (this dynamically opens your Github Windows client)

Database access

For testing and development purposes you can use an embedded HSQL in memory database. You don't have to create a database manually, for every test run and app server start the database is created automatically and filled with some basic values. For running your server application you should use MSQL. Details below.

Configuration matrix

 JUnit-Testslocal development HTTP serverdeployed "productive" HTTP server
embedded HSQL(tick) (1)(tick) (2)(minus)

MySQL

via pom.xml and oregami_dev.yml

(minus)(tick) (3)(minus)

MySQL

via ~/.m2/settings.xml and oregami_prod.yml

(minus)(minus)(tick) (4)

(1) embedded HSQL for JUnit tests

Configuration of this is done in /src/test/resources/oregami_test.yml.

Code Block
themeRDark
title/src/test/resources/oregami_test.yml
databaseConfiguration:
  jpaUnit: dataHsql
  url: jdbc:hsqldb:mem:testdb
  properties:
    hibernate.dialect : org.hibernate.dialect.HSQLDialect
    hibernate.show_sql : true
    hibernate.hbm2ddl.auto : update
    hibernate.archive.autodetection: class, hbm

(2) embedded HSQL for local development HTTP server

You can use embedded HSQL for developing and running the Oregami server application as well. This is preconfigured in /oregami_dev.yml:

Code Block
themeRDark
title/oregami_dev.yml
####### embedded HSQL database ############
databaseConfiguration:
  jpaUnit: dataHsql
  url: jdbc:hsqldb:mem:testdb
  properties:
    hibernate.dialect : org.hibernate.dialect.HSQLDialect
    hibernate.show_sql : true
    hibernate.hbm2ddl.auto : update
    hibernate.archive.autodetection: class, hbm

On application start some basic data is inserted. Every changed data is lost when your application stops.

(3) MySQL for local development HTTP server

...

create database & user and grant rights

Code Block
themeRDark
languagesql
CREATE DATABASE `oregami_dev` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
CREATE USER 'oregami_dev'@'localhost' IDENTIFIED BY 'oregami_dev_pwd';
GRANT ALL PRIVILEGES ON oregami_dev.* TO 'oregami_dev'@'localhost';

activate (remove comment # signs) mysql config in /oregami_dev.yml

Code Block
themeRDark
title/oregami_dev.yml
####### external MySQL database ############
databaseConfiguration:
 jpaUnit: dataMysql
 url: jdbc:mysql://localhost:3306/oregami_dev?useUnicode=true&characterEncoding=UTF-8
 user: oregami_dev
 password: oregami_dev_pwd
 driverClass: com.mysql.jdbc.Driver
 properties:
 hibernate.connection.driver_class : com.mysql.jdbc.Driver
 hibernate.dialect : org.hibernate.dialect.MySQLDialect

...

(4) MySQL for deployed "productive" HTTP server

  • install MySQL
  • create database & user and grant rights
    (You may choose any database name, user name and of course password. Just remember it later on (smile) )

    Code Block
    themeRDark
    languagesql
    CREATE DATABASE `oregami_prod` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
    CREATE USER 'oregami_prod'@'localhost' IDENTIFIED BY 'oregami_prod_pwd';
    GRANT ALL PRIVILEGES ON oregami_prod.* TO 'oregami_prod'@'localhost';
  • copy file /Users/sebastian/git/oregami-server/oregami_prod.tpl.yml from GIT repository to your server (rename it to oregami_prod.yml).
  • fill in correct values for database name (in databaseConfiguration.url), user and password
  • also add this to your ~.m2/settings.xml maven file on the server (user under which the maven command below will run, e.g. your build server) and of course enter the right values for database name, user and password

    Code Block
    themeRDark
    languagexml
    title~/.m2/settings.xml
    <settings>
        <profiles>
          <profile>
            <id>oregami_prod</id>
            <properties>
                <liquibase.url>jdbc:mysql://localhost:3306/oregami_prod?useUnicode=true&amp;characterEncoding=UTF-8</liquibase.url>
                <liquibase.driver>com.mysql.jdbc.Driver</liquibase.driver>
                <liquibase.username>oregami_prod</liquibase.username>
                <liquibase.password>oregami_prod_pwd</liquibase.password>            
            </properties>
          </profile>
        </profiles>
    </settings>
  • run this maven command to create or update the MySQL database with the latest structure:

    Code Block
    themeRDark
    languagebash
    titlecommand
     mvn  process-resources -P oregami_prod

    This will use the values from your maven settings.xml file (mentioned above). If you get an error check the right database, user and password. If you still get an error check the permissions (grants) for the user on your database.

  • Start application (see below).

Oregami-Server

  • thanks to Dropwizard you just need to start a Java class with main method:
    "org.oregami.dropwizard.OregamiApplication" and pass the parameters "server oregami_dev.yml" to it.
    (Use a different oregami.yml file for production, e.g. oregami_prod.yml, which is not stored in the GIT repository.)
  • Open your web browser and enter these urls:
    locally and run the Spring Boot main class org.oregami.OregamiApplication
  • open your browser and go to http://localhost:8080/gamesOur REST web app is now running and you are ready for development!


Development tools

I also suggest you use some kind of "Git client" to see which files are changed/staged and to compare files.
Here are some tool suggestions:

...

There is also a Git plugin for Eclipse called EGit, but I prefer using Git on the command line and GitX or something similar outside of Eclipse.If you would really like to get into development, take a look at how to use branches for feature development.