Skip to content

Commit

Permalink
1.3.0
Browse files Browse the repository at this point in the history
* Add script pool support
* Add browserSession context to User
* Add config and sys admin pages
* Add support for proxy protocol
* Add ip geolocation info
* Add challenge group dropdown
* Add student summary
* Add redis content caching
* Add help page
  • Loading branch information
pambrose authored Sep 10, 2020
1 parent ae8b774 commit 0781045
Show file tree
Hide file tree
Showing 104 changed files with 6,507 additions and 3,006 deletions.
5 changes: 5 additions & 0 deletions .gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM gitpod/workspace-full

USER gitpod

RUN brew install kotlin
10 changes: 10 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#tasks:
# - init: ./gradlew build
# - init: echo 'init script'
# command: echo 'start script'
image:
file: .gitpod.Dockerfile
vscode:
extensions:
- mathiasfrohlich.Kotlin@1.7.1:2Uw0hH38NcpgInldjuwF3g==
- fwcd.kotlin@0.2.11:moh8IDanzsIlhtK2IeiLmQ==
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ versioncheck:
./gradlew dependencyUpdates

depends:
./gradlew dependencies
./gradlew dependencies

upgrade-wrapper:
./gradlew wrapper --gradle-version=6.6.1 --distribution-type=bin
10 changes: 8 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id 'java'
id 'application'
id 'maven' // Required for jitpack.io to do a ./gradlew install
id 'org.jetbrains.kotlin.jvm' version '1.4.0-rc'
id 'org.jetbrains.kotlin.jvm' version '1.4.0'
id "com.github.ben-manes.versions" version '0.29.0'
id 'com.github.johnrengelman.shadow' version '6.0.0'
}
Expand Down Expand Up @@ -30,14 +30,15 @@ targetCompatibility = 1.8

description = 'ReadingBat Core'
group 'com.github.readingbat'
version '1.2.0'
version '1.3.0'

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"

implementation "com.github.pambrose.common-utils:core-utils:$utils_version"

implementation "com.github.pambrose.common-utils:ktor-server-utils:$utils_version"
implementation "com.github.pambrose.common-utils:ktor-client-utils:$utils_version"

implementation "com.github.pambrose.common-utils:redis-utils:$utils_version"

Expand All @@ -54,11 +55,16 @@ dependencies {

implementation "io.prometheus:simpleclient:$prometheus_version"

implementation "ch.obermuhlner:java-scriptengine:$java_script_version"

implementation "org.jetbrains:kotlin-css:$css_version"
implementation "org.jetbrains:kotlin-css-jvm:$css_version"

implementation "io.ktor:ktor-server-core:$ktor_version"
implementation "io.ktor:ktor-server-cio:$ktor_version"
implementation "io.ktor:ktor-client-core:$ktor_version"
implementation "io.ktor:ktor-client-cio:$ktor_version"

implementation "io.ktor:ktor-server-sessions:$ktor_version"
implementation "io.ktor:ktor-html-builder:$ktor_version"
implementation "io.ktor:ktor-locations:$ktor_version"
Expand Down
30 changes: 28 additions & 2 deletions docs/notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,40 @@ Setup:
* Program Arguments: -config=src/main/resources/application-dev.conf
* Environment Variables: SENDGRID_API_KEY=**value**

## Heroku Notes
* Switch shell to Java8
## Heroku
* Switch shell to Java8 to get jvisualvm to work on an OSX client
* Create connection with: `heroku java:visualvm --app readingbat`
* Connect to shell with: `heroku ps:exec --app readingbat`
* hprof files are put in */tmp*
* Copy hprof file with: `heroku ps:copy /tmp/filename --app readingbat`
* Open in jvisualvm with file: File->Load...
* https://devcenter.heroku.com/articles/exec#using-java-debugging-tools

## Prometheus
* Edit /etc/prometheus/prometheus.yml
* Resart with: `systemctl restart prometheus`
* Reset with: sudo systemctl reload prometheus.service
* Digital Ocean notes: https://marketplace.digitalocean.com/apps/prometheus?ipAddress=167.172.200.129#getting-started
* Prometheus admin: http://metrics.readingbat.com:9090/graph


## Grafana
* JVM dashboard is here: https://grafana.com/grafana/dashboards/8563
* World map: https://grafana.com/grafana/plugins/grafana-worldmap-panel
* Config file is: `/etc/grafana/grafana.ini`
* Log file is: `/var/log/grafana/grafana.log`

## PrismJs
* Look in .js files to find URLs to load css and js files

## JMX Exporter
* https://github.com/prometheus/jmx_exporter

## Setting up builds on Linux
* https://sdkman.io/install
* apt-get install unzip zip make
* curl -s "https://get.sdkman.io" | bash
* sdk install java
* sdk install kotlin
* sdk install gradle
* docker login
15 changes: 7 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,22 @@ org.gradle.daemon=true
org.gradle.configureondemand=true
org.gradle.parallel=true
org.gradle.caching=true
#org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
commons_version=1.9
#css_version=1.0.0-pre.110-kotlin-1.3.72
css_version=1.0.0-pre.110-kotlin-1.4.0-rc
css_version=1.0.0-pre.112-kotlin-1.4.0
flexmark_version=0.62.2
github_api_version=1.116
gson_version=2.8.6
guava_version=29.0-jre
java_script_version=2.0.0
junit_version=5.6.1
kluent_version=1.61
#ktor_version=1.3.1
ktor_version=1.3.2-1.4.0-rc
ktor_version=1.4.0
logback_version=1.2.3
logging_version=1.8.3
prometheus_version=0.9.0
proxy_version=35fb52f
proxy_version=1.8.5
redis_version=3.3.0
#selenium_version=4.0.0-alpha-6
sendgrid_version=4.6.3
utils_version=081a177
sendgrid_version=4.6.4
utils_version=8a9b883
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; 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
Expand Down
21 changes: 3 additions & 18 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand All @@ -54,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
Expand All @@ -64,29 +64,14 @@ echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
12 changes: 12 additions & 0 deletions jmx/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
jmx:
default_beans:
- query: "java.lang:type=Memory"
attributes:
- HeapMemoryUsage
- NonHeapMemoryUsage
- query: "java.lang:type=GarbageCollector,*"
attributes:
- name: "CollectionCount"
type: "counter"
- name: "CollectionTime"
type: "counter"
20 changes: 20 additions & 0 deletions src/main/kotlin/Content.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import com.github.pambrose.common.util.FileSystemSource
import com.github.pambrose.common.util.OwnerType.Organization
import com.github.pambrose.common.util.OwnerType.User
import com.github.readingbat.dsl.GitHubContent
import com.github.readingbat.dsl.eval
import com.github.readingbat.dsl.readingBatContent
Expand Down Expand Up @@ -67,9 +68,27 @@ val content =
include(GitHubContent(Organization, "readingbat", "readingbat-python-content", srcPath = "src").eval(this).python)
include(GitHubContent(Organization, "readingbat", "readingbat-java-content").eval(this).kotlin)
*/
/*
kotlin {
group("Infinite Loop") {
packageName = "com.github.readingbat.test_content"
challenge("InfiniteLoop") {
returnType = ReturnType.BooleanType
}
}
}
*/

include(GitHubContent(Organization, "readingbat", "readingbat-java-content").eval(this).java)

include(GitHubContent(Organization, "readingbat", "readingbat-java-content").eval(this).kotlin, "Athenian: ")

include(GitHubContent(Organization, "readingbat", "readingbat-python-content", srcPath = "src").eval(this).python)
include(GitHubContent(User, "maleich", "ReadingBat-content").eval(this).python, "Athenian: ")

/*
java {
group("test1") {
packageName = "kgroup1"
Expand All @@ -86,4 +105,5 @@ val content =
""".trimMargin()
}
}
*/
}
Loading

0 comments on commit 0781045

Please sign in to comment.