Visma Hackathon is a simple application used to register and manage hackathons.
You need a few things to be able to build and run the application locally:
Java 8MavenDocker- Optional:
docker-compose
Once everything is installed, you can follow these steps:
Set up a new OAuth2 application screen here: https://console.cloud.google.com/apis/credentials/oauthclient/
- Select "Web Application"
- Name: anything
- Authorised JavaScript origins:
http://localhost:8081http://localhost:8080(if you're usingwebpack-dev-server)
- Authorised redirect URIs:
http://localhost:8081/login/oauth2/code/googlehttp://localhost:8080/login/oauth2/code/google(if you're usingwebpack-dev-server)
- Save, and take note of the Client ID and Client secret
Set the following environment variable, using valid credentials for Google OAuth2.
export SPRING_APPLICATION_JSON='{
"security": {
"oauth2": {
"client": {
"registration": {
"google": {
"client-id": GOOGLE_AUTH_ID,
"client-secret": GOOGLE_AUTH_SECRET
}
}
}
}
}
}
}'You may either use docker compose:
$ docker-compose upor use Docker directly:
$ docker run -p 5432:5432 -e POSTGRES_USER=vismahackathon -e POSTGRES_PASSWORD=hackathonpass -e POSTGRES_DB=hackathon postgresYou may either run the application from your favourite IDE (e.g. IntelliJ or Eclipse), or from the command line using maven:
$ mvn spring-boot:run -PnodeThe application should then be available on http://localhost:8081 (note port 8081)
For rapid frontend development, it is recommended to start the webpack-dev-server plugin as well. This can be done by running npm start from the client folder:
$ cd client
$ npm startThis will start up a separate server on http://localhost:8080 (note port 8080), proxying API calls to the backend.
The following configuration properties are required to run the application:
- Database:
spring.datasource.urlspring.datasource.usernamespring.datasource.password
- Google OAuth2:
spring.security.oauth2.client.registration.google.client-idspring.security.oauth2.client.registration.google.client-secret
- Redis session store:
spring.redis.hostspring.redis.passwordspring.redis.port
They may be configured using the environment variable SPRING_APPLICATION_JSON as such:
export SPRING_APPLICATION_JSON='{
"spring": {
"datasource": {
"url": DB_URL,
"username": DB_USERNAME,
"password": DB_PASSWORD
},
"redis": {
"host": REDIS_HOST,
"password": REDIS_PASSWORD,
"port": REDIS_PORT
},
"security": {
"oauth2": {
"client": {
"registration": {
"google": {
"client-id": GOOGLE_AUTH_ID,
"client-secret": GOOGLE_AUTH_SECRET
}
}
}
}
}
}
}'