supaldubey / blog-server

Code for supersonic Java Blog

Home Page:https://scalejava.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scale Java Blog Project

The idea is to build a toy blog site running on Java using native images. This started as an experiment but seemed good enough to be shared with other good folks of open source world.

Running it on a server

Steps

Get postgres

Download and install postgres, else use docker-compose file from within the repository to set up.

Run

You can grab the latest version from Github Packages.

Download the executable runner file (JAR), current version has the name cube-blog-1.0.1-runner.jar

Use below command to override the local defaults

java -Dquarkus.datasource.password=no-one-knows \
    -Dquarkus.datasource.username=probably-few-know \
    -Dquarkus.datasource.jdbc.url=jdbc:postgresql://my-blog-host:5432/my-awesome-db \
    -Djwt.secret=My-Super-Secret-String \
    -jar cube-blog-1.0.1-runner.jar \

This project uses Quarkus.

If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ .

Running the application in dev mode

You can run your application in dev mode that enables live coding using:

./mvnw quarkus:dev

Packaging and running the application

The application can be packaged using ./mvnw package. It produces the cube-blog-1.0.0-SNAPSHOT-runner.jar file in the /target directory.

The jar produced is an uber-jar, and this can be changed by updating property in application.properties file.

The application is now runnable using java -jar target/cube-blog-1.0.0-SNAPSHOT-runner.jar.

Creating a native executable

You can create a native executable using: ./mvnw package -Pnative. This step requires GraalVM, the project uses Java 11 specific JDK.

Or, if you don't have GraalVM installed, you can run the native executable build in a container using: ./mvnw package -Pnative -Dquarkus.native.container-build=true.

You can then execute your native executable with: ./target/cube-blog-1.0.0-SNAPSHOT-runner

If you want to learn more about building native executables, please consult https://quarkus.io/guides/building-native-image.

About

Code for supersonic Java Blog

https://scalejava.com

License:GNU General Public License v3.0


Languages

Language:Java 66.8%Language:HTML 21.9%Language:CSS 11.3%