Skip to content

debueb/pro-padel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

pro-padel

This repository contains the source code for the padel club managment software behind walls.de and pro-padel.de

technologies used

  • Maven - Java dependency managment and build process
  • webpack - Javascript minification and bundling
  • Spring Boot - excellent backend framework
  • Hibernate - object relational mapper
  • MySQL - relational database
  • sparkpost - mail relay service
  • LessCSS - CSS pre processor
  • BugSnag - bug tracking platform
  • Cloudflare - CDN with excellent API
  • Node - JS Runtime used during build process
  • NPM - Node Package Manager

setup instructions

  • clone this repo
  • install MySQL v5.7 or higher
  • create a new MySQL user and db
  • install your favorite JDK v8 or higher (Oracle or OpenJDK)
  • install Maven v3.5.0 or higher
  • install your favorite Java IDE and import the Maven project
  • sign up with BugSnag
  • sign up with SparkPost
  • sign up with Cloudflare

setup environment variables

export BUGSNAG_API_KEY=[BUGSNAG API KEY]
export SPARKPOST_DEFAULT_SENDER=[SPARKPOST DEFAULT SENDER]
export SPARKPOST_API_KEY=[SPARKPOST API KEY]
export CLOUDFLARE_API_EMAIL=[CLOUDFLARE API EMAIL]
export CLOUDFLARE_API_KEY=[CLOUDFLARE API KEY]
export SPRING_DATASOURCE_PASSWORD=[DB PASS]
export SPRING_DATASOURCE_URL=[jdbc:mysql://host:port/dbName]
export SPRING_DATASOURCE_USERNAME=[DB USER]

run tests

mvn clean test

run on command line

mvn clean package -DskipTests spring-boot:run

keeping js up to date during development

  • install node
  • install npm
  • run npm run watch to have webpack create your bundled resources and resource maps after editing any of the javascript source files

deployment instructions

mvn clean package

this will generate two war files in the target/ directory

  • ROOT.war - this is a runnable Spring Boot war file. Start it with java -jar ROOT.war
  • ROOT.war.original - this is a regular war file that you can deploy to an existing servlet container

AWS - manual deployment

  • due to an issue [1, 2] with jsp files in runnable jar Spring Boot (ROOT.war) apps on Amazon Web Services, the app must be deployed in a regular Tomcat instance (ROOT.war.original)
  • setting up AWS is fairly straighforward
    • create an AWS account. you will need a credit card and a phone number
    • on the AWS console first change the region of the datacenter (top right)
    • Elastic Beanstalk
      • Create New Application -> Web Server Environment -> Platform: Tomcat -> Application code: Root.war.original -> Configure more options -> Database Modify -> Engine: mysql, Retention: Delete -> wait for AWS to provision machines
      • All Applications / Application / Application Environment -> Configuration -> RDS Endpoint -> Details tab -> Security Groups -> Actions -> Edit inbound rules -> Type: Custom TCP, Port 3306, Source: My IP - Connect to MySQL using your favorite MySQL client and import DB as necessary
      • All Applications / Application / Application Environment -> Configuration -> Software Configuration -> Setup Environment Properties as described above
      • All Applications / Application / Application Environment -> Upload and Deploy new war.original file

AWS - automatic deployment

  • automatic deployment to AWS is done via travis-ci.org elasticbeanstalk provider
  • SSL on the AWS instance is required because the application uses the request URL to build URLS
  • if SSL is terminated on Cloudflare with Flexible SSL (essentially requesting the app via http://) the constructed http:// redirects will fail in the browser
  • in order to support SSL on the AWS single instance we could use letsencrypt with certbot-auto
  • however, certbot-auto requires that a) it is accessible on port 80 in order to confirm domain ownership or b) using the --webroot that an existing Apache config can serve .well-known files
  • both a) and b) are not compatible with http:// to https:// page rule redirects on Cloudflare
  • therefore, we set Cloudflare to Full SSL (non strict), which allows self signed certificates
  • the self signed certificate is installed from environment variables

Backup

  • A MySQL backup script is installed during AWS deploy
  • the script uploads the generated .sql into a Dropbox folder using Dropbox-Uploader
  • Dropbox-Uploader Token must be stored in an environment variable named DROPBOX_UPLOADER_TOKEN

About

This repository contains the source code for the padel club management software behind walls.de and pro-padel.de

Resources

Stars

Watchers

Forks

Packages

No packages published