Skip to content

Instantly share code, notes, and snippets.

View sureshmelvinsigera's full-sized avatar

Suresh Melvin Sigera sureshmelvinsigera

View GitHub Profile

Step by Step guide to install Jenkins on Amazon Linux.

1

Prerequisites:

Minimum hardware requirements:

  • 256 MB of RAM Enough for doing proof of concept (POC).
  • 1 GB of drive space (although 10 GB is a recommended minimum if running Jenkins as a Docker container) Recommended hardware configuration for a small team:
  • 4 GB+ of RAM.
  • 50 GB+ of drive space. Software requirements:

Best Practices to build Java Container

  1. Use explicit and deterministic Docker base image tags
  2. Install only what you need in production in the Java container image
  3. Find and fix security vulnerabilities in your Java Docker image
  4. Use multi-stage builds
  5. Don’t run Java apps as root
  6. Properly handle events to safely terminate a Java application
  7. Gracefully tear down Java applications
  8. Use .dockerignore
@sureshmelvinsigera
sureshmelvinsigera / jwtRS256.sh
Created October 24, 2023 14:48 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
package academy.javapro.demo.model;
import jakarta.persistence.*;
import lombok.*;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.*;
package academy.javapro.demo.repository;
import academy.javapro.demo.model.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
public interface UserRepository extends JpaRepository<User, Long> {
package academy.javapro.demo.repository;
import academy.javapro.demo.model.Role;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface RoleRepository extends JpaRepository<Role, Long> {
boolean existsByName(String name);
package academy.javapro.demo.seed;
import academy.javapro.demo.model.Role;
import academy.javapro.demo.model.User;
import academy.javapro.demo.repository.RoleRepository;
import academy.javapro.demo.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
package com.example.demo.repository;
import com.example.demo.model.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
public interface UserRepository extends JpaRepository<User, Integer> {
package academy.javapro.demo.model;
import jakarta.persistence.*;
import lombok.*;
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@ToString
package com.example.demo.model;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;