Skip to content

JPro

Serverless Relational Databases

Here are some services I should look into that would likely end up costing a lot less than something like RDS.

Service Compute Pricing Storage Pricing Ideal For
Amazon Aurora Serverless Billed per ACU per second. $0.10 per GB-month. Variable workloads with MySQL/PostgreSQL compatibility.
Azure SQL Database Serverless Billed per vCore per second; e.g., ~$0.5218 per vCore-hour for Gen5. Billed separately per GB. Intermittent workloads with auto-scaling and pausing capabilities.
Google Cloud SQL On-demand and committed use pricing; e.g., ~$0.0825 per hour for 1 vCPU instance. $0.17 per GB per month for SSD. Managed relational databases with automated scaling.
PlanetScale Free tier available; paid plans based on resource consumption. Included in usage-based pricing. MySQL-compatible databases with serverless scaling and modern development features.
CockroachDB Serverless Free tier available; usage-based pricing beyond free tier. Included in usage-based pricing. PostgreSQL-compatible distributed SQL databases requiring high availability and global scaling.

Creating a working JavaFX demo in the web

I did this working in my BasicDemo app.

I created my own Dockerfile and docker-compose.yml like the following

Dockerfile
FROM amazoncorretto:21
# Update yum and install dependencies
RUN yum update -y && yum install -y \
    pango \
    cairo \
    freetype \
    fontconfig && \
    yum clean all
# Set the working directory and configure the CMD
WORKDIR /jproserver
CMD ["sh", "-c", "cd /jproserver && ./bin/restart.sh"]

The installations are necessary to run the project in Docker.

Then the docker-compose.yml file:

docker-compose.yml
services:
  jpro-demo:
    container_name: jpro-demo
    build:
      context: .  # Directory where Dockerfile is located
      dockerfile: Dockerfile
    ports:
      - "7080:8080"
    volumes:
      - .:/jproserver
    restart: always

In my build.gradle I used an ssh plugin to deploy and run my application id 'org.hidetake.ssh' version '2.11.2'

I created two tasks cleanAll and deployHome to basically clean the build directory, down the docker app, and remove the persisted storage of the build. Then the deployHome moves the build zip, unzips it, then unpacks the parent folder.

plugins {
    id 'java'
    id 'application'
    id 'org.javamodularity.moduleplugin' version '1.8.12'
    id 'org.openjfx.javafxplugin' version '0.0.13'
    id 'org.beryx.jlink' version '2.25.0'
    id 'jpro-gradle-plugin'
    id 'org.hidetake.ssh' version '2.11.2'
}

/**
More Stuff...
*/

ssh.settings {
    knownHosts = file("${System.env.USERPROFILE}/.ssh/known_hosts")
//    knownHosts = allowAnyHosts
}

remotes {
    homeServer {
        host = home_ip // Replace with your instance IP
        user = home_user // Replace with your SSH username
        identity = file(home_pk) // Replace with the path to your private SSH key
    }
}

task cleanAll(dependsOn: 'clean') {
    doLast {
        ssh.run {
            session(remotes.homeServer) {
                // delete everything in the jpro folder
                execute 'docker compose -f /home/thomas/docker/jpro/docker-compose.yml down -v'
                execute 'rm -rf /home/thomas/docker/jpro/*'
            }
        }
    }
}

task deployHome(dependsOn: 'jproRelease') {
    doLast {
        ssh.run {
            session(remotes.homeServer) {
                put from: project.file("build/distributions/BasicDemo-jpro.zip"), into: '/home/thomas/docker/jpro/' // Replace with remote path
                // unzip the file on the remote server
                execute 'unzip /home/thomas/docker/jpro/BasicDemo-jpro.zip -d /home/thomas/docker/jpro/' // Replace with your actual service name

                // delete the zip file
                execute 'rm /home/thomas/docker/jpro/BasicDemo-jpro.zip'

                // Unpack and overwrite all the contents of the BasicDemo-jpro folder into the jpro folder
                execute 'cp -r /home/thomas/docker/jpro/BasicDemo-jpro/* /home/thomas/docker/jpro/' // Replace with your actual service name


                put from: project.file("Dockerfile"), into: '/home/thomas/docker/jpro/' // Replace with remote path
                put from: project.file("docker-compose.yml"), into: '/home/thomas/docker/jpro/' // Replace with remote path
                // Restart the service on the remote server
                execute 'docker compose -f /home/thomas/docker/jpro/docker-compose.yml up -d --build' // Replace with your actual service name
            }
        }
    }
}