Skip to content

Commit

Permalink
Release v0.2.0
Browse files Browse the repository at this point in the history
Merge pull request #34  from blogify-dev/dev
  • Loading branch information
ranile authored Jan 12, 2020
2 parents b99eaae + 29cb2e8 commit 58999ec
Show file tree
Hide file tree
Showing 195 changed files with 8,020 additions and 2,702 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/.gradle
/gradle/wrapper/gradle-wrapper.jar
/.idea
/out
/build
*.iml
*.ipr
*.iws
/gradlew.bat
/gradlew
/resources/frontend/
/resources/frontend/
/config/
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WORKDIR /var/server/

ADD build/dist/jar/blogify-0.1.0-all.jar .

EXPOSE 8080
EXPOSE 5005
EXPOSE 80
EXPOSE 443

CMD ["java", "-server", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseG1GC", "-XX:MaxGCPauseMillis=100", "-XX:+UseStringDeduplication", "-jar", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005", "blogify-0.1.0-all.jar"]
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ Currently, our own (very basic) testing shows that the server can handle upwards

## Building and deploying

The default deploy configuration runs the backend and the database as `docker-compose` services. A functioning, local, test deployment can be achieved by running the `localTestDeploy` gradle task.
The default deploy configuration runs the backend, the database and typesense search engine as `docker-compose` services. A functioning, local, test deployment can be achieved by running the `blogifyDeploy` gradle task.
You need to provide the configuration for database and typesense using `db.yaml` and `ts.yaml` files respectively placed in the root of the project. `*.yaml.example` files have been provided for your guidance.

## Core team

Expand Down
41 changes: 37 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@file:Suppress("SpellCheckingInspection", "PropertyName")

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

val ktor_version: String by project
val kotlin_version: String by project
val logback_version: String by project
Expand All @@ -11,6 +13,7 @@ val spring_security_core_version: String by project
plugins {
application
kotlin("jvm") version "1.3.41"
id("org.jetbrains.kotlin.plugin.serialization") version "1.3.60"

id("com.github.johnrengelman.shadow") version "5.1.0"
id("com.avast.gradle.docker-compose") version "0.9.4"
Expand All @@ -20,7 +23,14 @@ group = "blogify"
version = "0.1.0"

application {
mainClassName = "io.ktor.server.netty.EngineMain"
mainClassName = "io.ktor.server.tomcat.EngineMain"
}

buildscript {
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61")
classpath("org.jetbrains.kotlin:kotlin-serialization:1.3.61")
}
}

repositories {
Expand All @@ -38,9 +48,10 @@ dependencies {

// Ktor

compile("io.ktor:ktor-server-netty:$ktor_version")
compile("io.ktor:ktor-server-tomcat:$ktor_version")
compile("ch.qos.logback:logback-classic:$logback_version")
compile("io.ktor:ktor-server-core:$ktor_version")
compile("io.ktor:ktor-network-tls:$ktor_version")
compile("io.ktor:ktor-locations:$ktor_version")
compile("io.ktor:ktor-auth:$ktor_version")
compile("io.ktor:ktor-auth-jwt:$ktor_version")
Expand All @@ -56,7 +67,8 @@ dependencies {
// Database stuff

compile("org.postgresql:postgresql:$pg_driver_version")
compile("org.jetbrains.exposed:exposed:$exposed_version")
compile("org.jetbrains.exposed:exposed-core:$exposed_version")
compile("org.jetbrains.exposed:exposed-jdbc:$exposed_version")
compile("com.zaxxer:HikariCP:$hikari_version")

// Spring security for hashing
Expand All @@ -82,6 +94,15 @@ dependencies {
runtime("io.jsonwebtoken:jjwt-impl:0.10.7")
runtime("io.jsonwebtoken:jjwt-jackson:0.10.7")

// Config

compile("org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.14.0")
compile("org.jetbrains.kotlinx:kotlinx-serialization-runtime-configparser:0.14.0")

// Testing

implementation("org.junit.jupiter:junit-jupiter:5.5.2")

}

kotlin.sourceSets["main"].kotlin.srcDirs("src")
Expand All @@ -90,6 +111,18 @@ kotlin.sourceSets["test"].kotlin.srcDirs("test")
sourceSets["main"].resources.srcDirs("resources")
sourceSets["test"].resources.srcDirs("testresources")


tasks.test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.jvmTarget = "1.8"
}

// Fat jar

tasks.withType<Jar> {
Expand All @@ -109,7 +142,7 @@ dockerCompose {

projectName = "blogify"

waitForTcpPorts = true
waitForTcpPorts = false
stopContainers = true
}

Expand Down
31 changes: 0 additions & 31 deletions docker-compose.yml

This file was deleted.

10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ktor_version = 1.2.3
ktor_version = 1.2.6
kotlin.code.style = official
kotlin_version = 1.3.50
kotlin_version = 1.3.61
logback_version = 1.2.1
pg_driver_version = 42.2.6
exposed_version = 0.17.1
hikari_version = 3.3.1
pg_driver_version = 42.2.9
exposed_version = 0.20.1
hikari_version = 3.4.1
spring_security_core_version = 5.1.6.RELEASE
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
172 changes: 172 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
#!/usr/bin/env sh

##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn () {
echo "$*"
}

die () {
echo
echo "$*"
echo
exit 1
}

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi

# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option

if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
Loading

0 comments on commit 58999ec

Please sign in to comment.