Skip to content

Commit

Permalink
Merge branch 'release/v1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
abelidze committed Jul 21, 2019
2 parents 50c15e9 + 8ce3efb commit 33540d8
Show file tree
Hide file tree
Showing 123 changed files with 9,181 additions and 771 deletions.
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**Steps to reproduce**
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,14 @@ out/
dev/
*.sublime-*
*.onsave

*.sqlite

app/memory

app/src/main/resources/service_account\.json
app/src/test/resources/service_account\.json

# H2 db files
*.mv.db
*.trace.db
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
sudo: true

webhooks: https://fathomless-fjord-24024.herokuapp.com/notify

git:
depth: 2

language: java
jdk: openjdk8
before_install:
- openssl aes-256-cbc -K $encrypted_e664fa697fe4_key -iv $encrypted_e664fa697fe4_iv
-in service_account.json.enc -out app/src/test/resources/service_account.json -d
- chmod +x app/gradlew

script:
- cd app
- ./gradlew clean check
1,186 changes: 735 additions & 451 deletions PROTOCOL.RU.md

Large diffs are not rendered by default.

132 changes: 129 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,133 @@
# Planer-Server
Planner-Server
==============

API-reference [[ru](PROTOCOL.RU.md) | [en](PROTOCOL.EN.md)]
[![Build Status](https://travis-ci.org/abelidze/planner-server.svg?branch=develop)](https://travis-ci.org/abelidze/planner-server)

Planner-Server is an API-server for calendar / planner apps built on top of Spring Boot Framework.

It follows iCalendar (RFC 5545) specification with some assumptions (some stuff depends on a user of the API).

API-reference [[ru](PROTOCOL.RU.md) | [en](PROTOCOL.EN.md) | [swagger](http://planner.skillmasters.ga/docs)]

All about recurrence: [recurrence-overview.md](https://github.com/bmoeskau/Extensible/blob/master/recurrence-overview.md)

![iCal specification](ICalendarSpecification.png "iCalendar")

Installation
------------

> **Latest**
Download project as '.zip' archive and extract it to whatever you like directory or use `git`:
```sh
$ git clone https://github.com/abelidze/planner-server.git
```

> **Release**
Visit [releases page](https://github.com/abelidze/planner-server/releases) and check it for the latest release.


Requirements
------------

* JDK 1.8


Database
--------

API-server comes with two JDBC dependencies: SQLite for development and PostgreSQL for production.

Assuming that it provides two different profiles:
- development: application.properties [default]
- production: application-prod.properties

To choose one of that profiles you can use standart Spring's command-line argument setting, e.g.:

```sh
java -jar -Dspring.profiles.active=prod server.jar`
```


Configuration
------------

Before running you must do some work with configs.

Planner-Server uses Firebase for authentication and you have to configure it on your own.

You can find more information [here](https://firebase.google.com/docs/admin/setup#initialize_the_sdk).

1. Create new Firebase project.
More information [here](https://firebase.google.com/docs/android/setup#create-firebase-project).
2. Retrieve .json service account key, rename it to `service_account.json` and place to one of locations:
- environment variable `GOOGLE_APPLICATION_CREDENTIALS`, e.g. `export GOOGLE_APPLICATION_CREDENTIALS=<path_to_json>`
- `{project_path}/{src}/main/resources` and `{project_path}/{src}/test/resources`
- near compiled `server-{VERSION}.jar` binary in the same directory
3. After that you can add your applications to Firebase.
More information [here](https://firebase.google.com/docs/android/setup#register-app).


Running
-------

> **Gradle / Gradle Wrapper**

```sh
# Assuming you are in repo root directory
cd app && gradlew bootRun
```

> **Production**

```sh
# Assuming you are in repo root directory
cd app && gradlew clean bootJar
java -jar -Dspring.profiles.active=prod ./build/libs/server-{VERSION}.jar` # replace {VERSION} with builded version
```

> **Docker-Compose**
```sh
# Development
docker-compose up -d --force-recreate --remove-orphans --build

# Production
docker-compose -f docker-compose.production.yml up -d --force-recreate --remove-orphans --build

# Shutdown
docker-compose down --remove-orphans
```


Documentation / Swagger
-----------------------

Basic PROTOCOL description and information about authorization can be found there: [ [ru](PROTOCOL.RU.md) | [en](PROTOCOL.EN.md) ]

When server is running it provides autogenerated API-documentation with Swagger-UI.

For local development it can be accessed with:

```
http://localhost:8080/swagger-ui.html
# or
http://localhost/swagger-ui.html
```


Contact
-------

Developers on Telegram:

[![https://t.me/Abelidze](https://img.shields.io/badge/%E2%9E%[email protected]?style=flat-square&&colorA=2D233B)](https://t.me/Abelidze)


License
-------
Planner-Server is open-sourced software licensed under the [MIT License](https://opensource.org/licenses/MIT).

#### Disclaimer

This program is provided "AS IS" without warranty of any kind.
128 changes: 120 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent

plugins {
id 'org.springframework.boot' version '2.1.3.RELEASE'
id 'java'
id 'java-library'
id 'io.spring.dependency-management' version '1.0.7.RELEASE'
id 'io.dcow.sublime' version '0.9.2'
id 'io.franzbecker.gradle-lombok' version '2.1'
id 'net.ltgt.apt' version '0.18'
id 'jacoco'
}

group = 'com.skillmasters'
version = '0.0.1'
sourceCompatibility = 1.8
targetCompatibility = 1.8
version = '1.0.0'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'

configurations {
developmentOnly
Expand All @@ -19,14 +26,119 @@ configurations {

repositories {
jcenter()
maven { url 'https://jitpack.io' }
}

dependencies {
compile 'javax.persistence:persistence-api:1.0'
compile 'io.springfox:springfox-swagger2:2.9.2'
compile 'io.springfox:springfox-swagger-ui:2.9.2'
compile 'org.springframework.boot:spring-boot-starter-web'
// implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
compile 'com.querydsl:querydsl-core:4.2.1'
compile 'com.querydsl:querydsl-jpa:4.2.1'
compileOnly 'org.projectlombok:lombok:1.18.6'
annotationProcessor(
'com.querydsl:querydsl-apt:4.2.1:jpa',
'org.springframework.boot:spring-boot-starter-data-jpa',
'org.springframework.boot:spring-boot-starter-jdbc',
'org.projectlombok:lombok:1.18.6'
)

// implementation 'javax.persistence:persistence-api:1.0'
implementation 'com.querydsl:querydsl-jpa:4.2.1'
implementation 'com.google.guava:guava:27.1-jre'

implementation 'io.springfox:springfox-swagger-ui:2.9.2'
implementation ('io.springfox:springfox-swagger2:2.9.2') {
exclude module: 'swagger-annotations'
exclude module: 'swagger-models'
}
implementation 'io.swagger:swagger-annotations:1.5.21'
implementation 'io.swagger:swagger-models:1.5.21'

implementation 'javax.xml.bind:jaxb-api:2.3.0'
implementation 'org.javassist:javassist'
implementation 'net.sf.biweekly:biweekly:0.6.3'
implementation 'com.aventrix.jnanoid:jnanoid:2.0.0'
implementation 'com.google.firebase:firebase-admin:6.8.1'

implementation 'org.springframework.boot:spring-boot-starter-web'
// implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
// implementation 'org.springframework.boot:spring-boot-starter-data-rest'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
testImplementation 'org.springframework.boot:spring-boot-starter-test'

// runtimeOnly 'org.xerial:sqlite-jdbc:3.28.0'
runtimeOnly 'com.github.Txture:sqlite-jdbc:10cb68a'
runtimeOnly 'com.h2database:h2:1.4.199'
runtimeOnly 'org.postgresql:postgresql:42.2.6'

}

// compileJava {
// options.encoding = 'UTF-8'
// options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
// }

// bootRun {
// args = ["--spring.profiles.active=prod"]
// }

test {
include "com/skillmasters/server/suites/TestServiceSuite.class"
include "com/skillmasters/server/suites/TestGettersSettersSuite.class"
include "com/skillmasters/server/suites/TestControllersSuite.class"
// failFast = true
}

jacocoTestReport {
reports {
html.enabled true
html.destination file("${buildDir}/jacocoHtml")
}


afterEvaluate {
classDirectories.from = files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
'springfox/documentation/service/**',
])
})
}
}

//fancy test output
tasks.withType(Test) {
testLogging {
// set options for log level LIFECYCLE
events TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED
// TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
showExceptions true
showCauses true
showStackTraces true

// set options for log level DEBUG and INFO
debug {
events TestLogEvent.STARTED,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat

afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
}
Loading

0 comments on commit 33540d8

Please sign in to comment.