...
(4) MySQL for deployed "productive" HTTP server
- todoinstall MySQL
create database & user and grant rights
(You may choose any database name, user name and of course password. Just remember it later on )Code Block theme RDark language sql 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 tooregami_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 theme RDark language xml title ~/.m2/settings.xml <settings> <profiles> <profile> <id>oregami_prod</id> <properties> <liquibase.url>jdbc:mysql://localhost:3306/oregami_prod?useUnicode=true&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 theme RDark language bash title command 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:
http://localhost:8080/games
- Our REST web app is now running and you are ready for development!
...