Step — 1: Pull Image

Step — 2: Create Container

Parameter Description

--name postgres define container name as postgres

-e POSTGRES_PASSWORD define default password for user postgres

-p 5432:5432 map container port 5432 with local port 5432

-d run container in detach mode

Step — 3: Connect it

host: localhost

port: 5432

username: postgres

password: <password from step 2>

Connect to PostgreSQL container with your favorite Database client like PgAdmin, DBeaver

Make sure that you have Spring Boot DevTools dependency on your pom.xml

Step 1 — Enable “Build project automatically”

Open Settings > Build, Execution, Deployment > Compiler

Step 2 — Open Registry

Press Ctrl + Shift+ A, then search for Registry then press Enter

MapStruct is a one of most powerful library to mapping in Java

Let’s say we have Customer.java and CustomerDTO.java

Customer.java

CustomerDTO.java

Let’s say we need to keep simple Audit data like:

  • create date
  • update date
  • create by
  • update by

Spring Boot is already provided this solution for us.

Step 0 — Make sure you have JPA in your pom.xml

Step 1 — Create Auditor.java

Configure Spring Boot App to work with PostgreSQL is easy.

Step 0 — Make sure you have JPA in your pom.xml

Step 1 — Add PostgreSQL into your pom.xml

Step 2 — Configure your application.yaml

That’s it! Easy?

What’s PodPreset

To enable PodPreset in Microk8s

Step 1 — Edit kube-apiserver

Step 2 — Add PodPreset and settings.k8s.io/v1alpha1=true

Step 3 — Restart Kubernetes API Server

Testing

You should get something like this

What’s next?

Learn how to create simple PodPreset and inject to your pod

I have a CentOS server which running Angular Web App on port 4200, and I want to access this web app with http://MY_SERVER . What should I do?

1. Install Nginx

2. Start Nginx

3. Enable Nginx

4. Add HTTP/HTTPS Firewall

5. Test Nginx

Open URL http://MY_SERVER, and I should see Nginx Welcome Page .

6. Add Proxy Pass to nginx.conf

7. Restart Nginx

8. Test Proxy

Open URL http://MY_SERVER , and I should see my Angular Web App

Natthapon Pinyo

Java Team Leader at Aware Group

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store