Commit 4cd9d0b5 authored by Gerrit Hübbers's avatar Gerrit Hübbers 🃏
Browse files

Set up staging profile

parent 1ebb59ce
......@@ -26,6 +26,18 @@ Bower is used to manage CSS and JavaScript dependencies used in this application
specifying a newer version in `bower.json`. You can also run `bower update` and `bower install` to manage dependencies.
Add the `-h` flag on any command to see how you can use it. For example, `bower update -h`.
## Staging
### Initial setup
The staging environment shall be as close as possible to the production environment. DDA uses MySQL in its staging environment. Assuming a MySQL server is running, and the `mysql` client tool exists, run the following commands in order to set up the DDA MySQL database in a state as expected by DDA's `staging` profile:
```
mysql --user=root --password --host=localhost --port=3306 --protocol=TCP --verbose --execute="create database if not exists dda character set utf8 collate utf8_general_ci;"
mysql --user=root --password --host=localhost --port=3306 --protocol=TCP --verbose --execute="create user 'dda'@'localhost' identified by 'dda';"
mysql --user=root --password --host=localhost --port=3306 --protocol=TCP --verbose --execute="grant all privileges on dda.* to 'dda'@'localhost'; flush privileges;"
```
### Running DDA with the `staging` profile on a development machine
To build a staging version on your development machine, run `mvn package -Pstaging -DskipTests=true`. To run this staging version on your development machine, run `java -jar target/dda-wizard.war --spring.profiles.active=staging`.
# Building for production
To optimize the DDA client for production, run:
......@@ -41,15 +53,15 @@ To ensure everything worked, run:
Then navigate to [http://localhost:8080](http://localhost:8080) in your browser.
# Testing
## Testing
Unit tests are run by [Karma][] and written with [Jasmine][]. They're located in `src/test/javascript` and can be run with:
grunt test
# Development
## Development methodology
#### Fixing bugs and building features on dedicated branches
## Development
### Development methodology
##### Fixing bugs and building features on dedicated branches
It is a best practice to fix a bug and develop a new feature on a dedicated git branch, then, after finishing that task, merging the made changes back into the *master* branch.
* For the whole development group, this helps in maintaining a working DDA Wizard version in the *master* branch - it will never contain a half-baked version.
* For the individual developer(s) working on the branch, it helps to develop on their task with a known DDA Wizard git project state, and changes on the *master* made concurrently by others won't interfere with their work.
......@@ -107,13 +119,13 @@ git push
# make a final quality assurance test on svko-dda-test, and make sure that both your new changes and all previously developed features and bugfixes work smoothly together...
```
## In-memory database
### In-memory database
You can interact with the h2 in-memory database by visiting its web interface at [http://localhost:8080/h2-console](http://localhost:8080/h2-console). As *JDBC URL*, provide `jdbc:h2:mem:dda`. As *User Name*, provide DDA. Keep *Password* empty.
## Debugging
### Debugging
The `dev` profile activates Java debugging capability. You can connect a client debugger by pointing it to `localhost:5005`.
## Project source filesystem layout
### Project source filesystem layout
/ <--- development- and build- relevant files, including this README.MD, pom.xml, package.json, Gruntfile.js ... not part of the final build artifact
|- src/
|- main/
......@@ -122,23 +134,6 @@ The `dev` profile activates Java debugging capability. You can connect a client
|- scss/ <--- Gruntfile.js configures the grunt-sass task to process SASS stylesheets in this directory
|- webapp/ <--- in the final build artifact, its content will land in /. This content will be served out as files via HTTP!
# Continuous Integration
To setup this project in Jenkins, use the following configuration:
* Project name: `DDA`
* Source Code Management
* Git Repository: `git@github.com:xxxx/DDA.git`
* Branches to build: `*/master`
* Additional Behaviours: `Wipe out repository & force clone`
* Build Triggers
* Poll SCM / Schedule: `H/5 * * * *`
* Build
* Invoke Maven / Tasks: `-Pprod clean package`
* Post-build Actions
* Publish JUnit test result report / Test Report XMLs: `build/test-results/*.xml`
[JHipster]: https://jhipster.github.io/
[Node.js]: https://nodejs.org/
[Bower]: http://bower.io/
......
# this file is used for configuring dda-wizard for startup with SysV init.d.
# See http://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html#deployment-script-customization-conf-file
JAVA_OPTS="-Dspring.profiles.active=prod"
JAVA_OPTS="-Dspring.profiles.active=staging"
......@@ -789,6 +789,72 @@
<logback.loglevel>INFO</logback.loglevel>
</properties>
</profile>
<profile>
<id>staging</id>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>com.github.trecloux</groupId>
<artifactId>yeoman-maven-plugin</artifactId>
<version>0.4</version>
<executions>
<execution>
<id>run-frontend-build</id>
<phase>generate-resources</phase>
<goals>
<goal>build</goal> <!-- here, "build" as in "bind yeoman-maven-plugin's 'build' goal to the 'generate-resources' phase -->
</goals>
<configuration>
<buildTool>grunt</buildTool>
<buildArgs>build --no-color</buildArgs> <!-- calls the grunt "build" task -->
</configuration>
</execution>
</executions>
<configuration>
<yeomanProjectDirectory>${project.basedir}</yeomanProjectDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<filesets>
<fileset>
<directory>src/main/webapp/dist</directory>
</fileset>
<fileset>
<directory>.tmp</directory>
</fileset>
<fileset>
<directory>node_modules</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
<arguments>
<argument>--spring.profiles.active=staging</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<!-- log configuration -->
<logback.loglevel>INFO</logback.loglevel>
</properties>
</profile>
</profiles>
<reporting>
......
# ===================================================================
# Spring Boot configuration for the "dev" profile.
# Spring Boot configuration for the "prod" profile.
#
# This configuration overrides the application.yml file.
# ===================================================================
......
# ===================================================================
# Spring Boot configuration for the "staging" profile.
#
# This configuration overrides the application.yml file.
# ===================================================================
# ===================================================================
# Standard Spring Boot properties.
# Full reference is available at:
# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
# ===================================================================
spring:
profiles:
active: prod
devtools:
restart:
enabled: false
livereload:
enabled: false
datasource:
driver-class-name: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
url: jdbc:mysql://localhost/dda
name:
username: dda
password: dda
h2:
console:
enabled: false
jpa:
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
show_sql: true
properties:
hibernate.cache.use_second_level_cache: true
hibernate.cache.use_query_cache: false
hibernate.generate_statistics: true
hibernate.cache.region.factory_class: org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
mail:
host: localhost
port: 25
username:
password:
messages:
cache-seconds: 1
thymeleaf:
cache: false
liquibase:
contexts: prod
server:
port: 8085
compression:
enabled: true
mime-types: text/html,text/xml,text/plain,text/css, application/javascript, application/json
# ===================================================================
# JHipster specific properties
# ===================================================================
jhipster:
http:
cache: # Used by the CachingHttpHeadersFilter
timeToLiveInDays: 31
cache: # Hibernate 2nd level cache, used by CacheConfiguration
timeToLiveSeconds: 3600
ehcache:
maxBytesLocalHeap: 256M
mail: # specific JHipster mail property, for standard properties see MailProperties
from: DDA@localhost
metrics: # DropWizard Metrics configuration, used by MetricsConfiguration
jmx.enabled: true
spark:
enabled: false
host: localhost
port: 9999
graphite:
enabled: false
host: localhost
port: 2003
prefix: DDA
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment