You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.7 KiB

Local Debugging Setup (Advance)

  • IntelliJ IDEAS

  • To bypass Spring Security to troubleshoot resource module independently, use this annotation

    • remove @EnableResourceServer
    • add exclusion exclude={SecurityAutoConfiguration.class}
    @SpringBootApplication(exclude={SecurityAutoConfiguration.class})
    @RestController
    //@EnableResourceServer
    //@EnableScheduling
    public class ResourceApplication {
    ...
    }
    
  • Setup debugger environment

    • for remote db.
      • Note : For authserver, not able to launch if remote db is Read-Only replica as the code will execute schema.sql against uaa table, which required write access
    DATABASE_SERVER_HOST=127.0.0.1;DATABASE=razerpay-malaysia-product;DATABASE_SERVER_USERNAME=tenghieyik;DATABASE_SERVER_PASSWORD=Razer*3ngF0RlIF32
    
    • for local db (according to your local db setup)
    DATABASE_SERVER_HOST=127.0.0.1;DATABASE=razerpay-malaysia-product;DATABASE_SERVER_USERNAME=razerpay;DATABASE_SERVER_PASSWORD=razerpay-singapore
    
  • Happy debugging !!!!

Remote DB connection via tunnel (Malaysia)

  • SSH tunnel setup at local computer

    • Connect to Malaysia VPN

    • Setup SSH Tunnel to an authorised EC2 for connecting to Malaysia sql sb.

      $ ssh -L 3306:rr-zf81fzm6ija52q623.mysql.kualalumpur.rds.aliyuncs.com:3306 tenghieyik@172.22.4.252
      
    • Test tunnel setup connection using MySQL Workbench to connect localhost:3306

    • Setup IntelliJ setting to connect DB via localhost:3306

For docker container setup

  • Connect remote db from docker container via docker host SSH tunnel

    • SSH tunnel

      $ ssh -L host.docker.internal:3306:rr-zf81fzm6ija52q623.mysql.kualalumpur.rds.aliyuncs.com:3306 tenghieyik@172.22.4.252
      
      // grab the host.docker.internal IP Address
      $ ping host.docker.internal
      
      Pinging host.docker.internal [192.168.0.132] with 32 bytes of data:
      Reply from 192.168.0.132: bytes=32 time<1ms TTL=128
      Reply from 192.168.0.132: bytes=32 time<1ms TTL=128
      ...
      
    • docker-compose.yml

      version: '2.1'
      services:
      
        resource:
          image: registry-intl.ap-southeast-3.aliyuncs.com/razerpay-report-malaysia/resource:latest 
          # restart: always
          mem_limit: 2048m
          mem_reservation: 1024m
          ports:
            - "9000:9000"
          environment:
            - JAVA_TOOL_OPTIONS=-Xmx1024M
            - DATABASE_SERVER_HOST=192.168.0.132
            - DATABASE_SERVER_USERNAME=tenghieyik
            - DATABASE_SERVER_PASSWORD=Razer*3ngF0RlIF32
            - DATABASE=razerpay-malaysia-product
            - MAIL_SERVER_USERNAME=
            - MAIL_SERVER_PASSWORD=
          logging:
            options:
              max-size: "50m"