Compare commits

..

10 Commits

Author SHA1 Message Date
Anang Yusman dd013322fe update 2026-01-13 13:21:23 +08:00
Anang Yusman 4093940eeb update 2026-01-05 15:13:28 +08:00
Anang Yusman 39e57a95e9 update 2026-01-05 14:45:12 +08:00
Anang Yusman 48da0ccad6 update 2026-01-05 14:43:25 +08:00
hanif salafi bc33e14445 fix: disable limiter 2026-01-05 13:36:30 +07:00
Anang Yusman 60d48cfda3 update 2026-01-02 18:07:41 +08:00
Anang Yusman 874d2b0d1a update 2026-01-02 18:06:38 +08:00
hanif salafi a69899a48d feat: update config minio 2026-01-02 16:58:45 +07:00
Anang Yusman d811d11ecc update 2025-12-30 12:46:25 +08:00
Anang Yusman 6d105b1c18 update 2025-12-28 18:45:48 +08:00
4 changed files with 43 additions and 27 deletions

View File

@ -7,7 +7,7 @@ build-2:
image: docker:24 image: docker:24
services: services:
- name: docker:24-dind - name: docker:24-dind
command: ["--insecure-registry=103.31.38.120:8900"] command: ["--insecure-registry=38.47.185.86:8900"]
variables: variables:
DOCKER_HOST: tcp://docker:2375 DOCKER_HOST: tcp://docker:2375
@ -15,10 +15,10 @@ build-2:
script: script:
- docker version - docker version
- docker login -u $DEPLOY_USERNAME -p $DEPLOY_TOKEN 103.31.38.120:8900 - docker login -u $DEPLOY_USERNAME -p $DEPLOY_TOKEN 38.47.185.86:8900
- docker build -t registry.gitlab.com/hanifsalafi/web-medols-be:dev . - docker build -t registry.gitlab.com/hanifsalafi/web-medols-be:dev .
- docker tag registry.gitlab.com/hanifsalafi/web-medols-be:dev 103.31.38.120:8900/medols/web-medols-be:dev - docker tag registry.gitlab.com/hanifsalafi/web-medols-be:dev 38.47.185.86:8900/medols/web-medols-be:dev
- docker push 103.31.38.120:8900/medols/web-medols-be:dev - docker push 38.47.185.86:8900/medols/web-medols-be:dev
deploy: deploy:
stage: deploy stage: deploy

View File

@ -59,7 +59,7 @@ func (m *Middleware) Register(db *database.Database) {
m.App.Use(cors.New(cors.Config{ m.App.Use(cors.New(cors.Config{
Next: utilsSvc.IsEnabled(m.Cfg.Middleware.Cors.Enable), Next: utilsSvc.IsEnabled(m.Cfg.Middleware.Cors.Enable),
AllowOrigins: "http://localhost:3000, http://localhost:4000, https://dev.mikulnews.com, https://n8n.qudoco.com, https://narasiahli.com, https://dev.asuransiaman.com, https://dev.beritabumn.com, https://dev.kabarharapan.com, https://dev.kebaikanindonesia.com, https://dev.isukini.com, https://dev.bhayangkarakita.com, https://dev.infokreasi.com, https://dev.milenialbersuara.com, https://dev2.fokusaja.com, https://dev.arahnegeri.com, https://dev.wargabicara.com", AllowOrigins: "http://localhost:3000, http://localhost:4000, https://dev.mikulnews.com, https://n8n.qudoco.com, https://narasiahli.com, https://dev.asuransiaman.com, https://dev.beritabumn.com, https://dev.kabarharapan.com, https://dev.kebaikanindonesia.com, https://dev.isukini.com, https://dev.bhayangkarakita.com, https://dev.infokreasi.com, https://dev.milenialbersuara.com, https://dev2.fokusaja.com, https://dev.arahnegeri.com, https://dev.wargabicara.com",
AllowMethods: "HEAD, GET, POST, PUT, DELETE, OPTION, PATCH", AllowMethods: "HEAD, GET, POST, PUT, DELETE, OPTIONS, PATCH",
AllowHeaders: "Origin, Content-Type, Accept, Accept-Language, Authorization, X-Requested-With, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Origin, Access-Control-Allow-Credentials, X-Csrf-Token, Cookie, Set-Cookie, X-Client-Key", AllowHeaders: "Origin, Content-Type, Accept, Accept-Language, Authorization, X-Requested-With, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Origin, Access-Control-Allow-Credentials, X-Csrf-Token, Cookie, Set-Cookie, X-Client-Key",
ExposeHeaders: "Content-Length, Content-Type", ExposeHeaders: "Content-Length, Content-Type",
AllowCredentials: true, AllowCredentials: true,

View File

@ -2,9 +2,10 @@ package config
import ( import (
"context" "context"
"log"
"github.com/minio/minio-go/v7" "github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials" "github.com/minio/minio-go/v7/pkg/credentials"
"log"
) )
// MinioSetup struct // MinioSetup struct
@ -30,26 +31,41 @@ func (_minio *MinioStorage) ConnectMinio() (*minio.Client, error) {
bucketName := _minio.Cfg.ObjectStorage.MinioStorage.BucketName bucketName := _minio.Cfg.ObjectStorage.MinioStorage.BucketName
location := _minio.Cfg.ObjectStorage.MinioStorage.Location location := _minio.Cfg.ObjectStorage.MinioStorage.Location
// Log connection attempt
log.Printf("[MinIO] Attempting to connect to MinIO at endpoint: %s (SSL: %v)", endpoint, useSSL)
// Initialize minio client object. // Initialize minio client object.
minioClient, errInit := minio.New(endpoint, &minio.Options{ minioClient, errInit := minio.New(endpoint, &minio.Options{
Creds: credentials.NewStaticV4(accessKeyID, secretAccessKey, ""), Creds: credentials.NewStaticV4(accessKeyID, secretAccessKey, ""),
Secure: useSSL, Secure: useSSL,
}) })
if errInit != nil { if errInit != nil {
log.Fatalln(errInit) log.Printf("[MinIO] ERROR: Failed to initialize MinIO client. Endpoint: %s, SSL: %v, Error: %v", endpoint, useSSL, errInit)
return nil, errInit
} }
err := minioClient.MakeBucket(ctx, bucketName, minio.MakeBucketOptions{Region: location}) log.Printf("[MinIO] MinIO client initialized successfully. Checking bucket: %s", bucketName)
if err != nil {
// Check to see if we already own this bucket (which happens if you run this twice) // Check if bucket exists first
exists, errBucketExists := minioClient.BucketExists(ctx, bucketName) exists, errBucketExists := minioClient.BucketExists(ctx, bucketName)
if errBucketExists == nil && exists { if errBucketExists != nil {
log.Printf("We already own %s\n", bucketName) log.Printf("[MinIO] ERROR: Failed to check if bucket exists. Bucket: %s, Error: %v", bucketName, errBucketExists)
} else { return nil, errBucketExists
log.Fatalln(err)
}
} else {
log.Printf("Successfully created %s\n", bucketName)
} }
return minioClient, errInit
if exists {
log.Printf("[MinIO] Bucket '%s' already exists and is accessible", bucketName)
} else {
// Try to create the bucket
log.Printf("[MinIO] Bucket '%s' does not exist. Attempting to create it in location: %s", bucketName, location)
err := minioClient.MakeBucket(ctx, bucketName, minio.MakeBucketOptions{Region: location})
if err != nil {
log.Printf("[MinIO] ERROR: Failed to create bucket. Bucket: %s, Location: %s, Error: %v", bucketName, location, err)
return nil, err
}
log.Printf("[MinIO] Successfully created bucket '%s' in location '%s'", bucketName, location)
}
log.Printf("[MinIO] Successfully connected to MinIO and bucket '%s' is ready", bucketName)
return minioClient, nil
} }

View File

@ -1,18 +1,18 @@
# Configuration vars for cmd/app # Configuration vars for cmd/app
[app] [app]
name = "Fiber starter" name = "Fiber starter"
host = "http://103.31.38.120" host = "http://38.47.185.86"
port = ":8800" port = ":8800"
domain = "https://dev.mikulnews.com/api" domain = "https://dev.mikulnews.com/api"
external-port = ":8802" external-port = ":8804"
idle-timeout = 5 # As seconds idle-timeout = 5 # As seconds
print-routes = false print-routes = false
prefork = true prefork = false
production = false production = false
body-limit = 1048576000 # "100 * 1024 * 1024" body-limit = 1048576000 # "100 * 1024 * 1024"
[db.postgres] [db.postgres]
dsn = "postgresql://medols_user:MedolsDB@2025@157.10.161.198:5432/medols_db" # <driver>://<username>:<password>@<host>:<port>/<database> dsn = "postgresql://medols_user:MedolsDB@2025@38.47.185.79:5432/medols_db" # <driver>://<username>:<password>@<host>:<port>/<database>
log-mode = "ERROR" log-mode = "ERROR"
migrate = true migrate = true
seed = false seed = false
@ -27,7 +27,7 @@ prettier = true
endpoint = "is3.cloudhost.id" endpoint = "is3.cloudhost.id"
access-key-id = "YRP1RM617986USRU6NN8" access-key-id = "YRP1RM617986USRU6NN8"
secret-access-key = "vfbwQDYb1m7nfzo4LVEz90BIyOWfBMZ6bfGQbqDO" secret-access-key = "vfbwQDYb1m7nfzo4LVEz90BIyOWfBMZ6bfGQbqDO"
use-ssl = false use-ssl = true
bucket-name = "mikulnews" bucket-name = "mikulnews"
location = "us-east-1" location = "us-east-1"
@ -49,8 +49,8 @@ enable = true
enable = true enable = true
[middleware.limiter] [middleware.limiter]
enable = true enable = false
max = 20 max = 500
expiration_seconds = 60 expiration_seconds = 60
[middleware.csrf] [middleware.csrf]
@ -66,7 +66,7 @@ enable = true
retention = 30 retention = 30
[keycloak] [keycloak]
endpoint = "http://103.31.38.120:8008" endpoint = "http://38.47.185.86:8008"
realm = "medols" realm = "medols"
client-id = "medols-app" client-id = "medols-app"
client-secret = "iyonEpZbAUs20quwaNFLMwRX7MUgPRlS" client-secret = "iyonEpZbAUs20quwaNFLMwRX7MUgPRlS"