Compare commits
10 Commits
ba7929fd9f
...
dd013322fe
| Author | SHA1 | Date |
|---|---|---|
|
|
dd013322fe | |
|
|
4093940eeb | |
|
|
39e57a95e9 | |
|
|
48da0ccad6 | |
|
|
bc33e14445 | |
|
|
60d48cfda3 | |
|
|
874d2b0d1a | |
|
|
a69899a48d | |
|
|
d811d11ecc | |
|
|
6d105b1c18 |
|
|
@ -7,7 +7,7 @@ build-2:
|
|||
image: docker:24
|
||||
services:
|
||||
- name: docker:24-dind
|
||||
command: ["--insecure-registry=103.31.38.120:8900"]
|
||||
command: ["--insecure-registry=38.47.185.86:8900"]
|
||||
|
||||
variables:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
|
|
@ -15,10 +15,10 @@ build-2:
|
|||
|
||||
script:
|
||||
- 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 tag registry.gitlab.com/hanifsalafi/web-medols-be:dev 103.31.38.120:8900/medols/web-medols-be:dev
|
||||
- docker push 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 38.47.185.86:8900/medols/web-medols-be:dev
|
||||
|
||||
deploy:
|
||||
stage: deploy
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ func (m *Middleware) Register(db *database.Database) {
|
|||
m.App.Use(cors.New(cors.Config{
|
||||
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",
|
||||
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",
|
||||
ExposeHeaders: "Content-Length, Content-Type",
|
||||
AllowCredentials: true,
|
||||
|
|
|
|||
|
|
@ -2,9 +2,10 @@ package config
|
|||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
|
||||
"github.com/minio/minio-go/v7"
|
||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||
"log"
|
||||
)
|
||||
|
||||
// MinioSetup struct
|
||||
|
|
@ -30,26 +31,41 @@ func (_minio *MinioStorage) ConnectMinio() (*minio.Client, error) {
|
|||
bucketName := _minio.Cfg.ObjectStorage.MinioStorage.BucketName
|
||||
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.
|
||||
minioClient, errInit := minio.New(endpoint, &minio.Options{
|
||||
Creds: credentials.NewStaticV4(accessKeyID, secretAccessKey, ""),
|
||||
Secure: useSSL,
|
||||
})
|
||||
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})
|
||||
if err != nil {
|
||||
// Check to see if we already own this bucket (which happens if you run this twice)
|
||||
exists, errBucketExists := minioClient.BucketExists(ctx, bucketName)
|
||||
if errBucketExists == nil && exists {
|
||||
log.Printf("We already own %s\n", bucketName)
|
||||
} else {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
} else {
|
||||
log.Printf("Successfully created %s\n", bucketName)
|
||||
log.Printf("[MinIO] MinIO client initialized successfully. Checking bucket: %s", bucketName)
|
||||
|
||||
// Check if bucket exists first
|
||||
exists, errBucketExists := minioClient.BucketExists(ctx, bucketName)
|
||||
if errBucketExists != nil {
|
||||
log.Printf("[MinIO] ERROR: Failed to check if bucket exists. Bucket: %s, Error: %v", bucketName, errBucketExists)
|
||||
return nil, errBucketExists
|
||||
}
|
||||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
# Configuration vars for cmd/app
|
||||
[app]
|
||||
name = "Fiber starter"
|
||||
host = "http://103.31.38.120"
|
||||
host = "http://38.47.185.86"
|
||||
port = ":8800"
|
||||
domain = "https://dev.mikulnews.com/api"
|
||||
external-port = ":8802"
|
||||
external-port = ":8804"
|
||||
idle-timeout = 5 # As seconds
|
||||
print-routes = false
|
||||
prefork = true
|
||||
prefork = false
|
||||
production = false
|
||||
body-limit = 1048576000 # "100 * 1024 * 1024"
|
||||
|
||||
[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"
|
||||
migrate = true
|
||||
seed = false
|
||||
|
|
@ -27,7 +27,7 @@ prettier = true
|
|||
endpoint = "is3.cloudhost.id"
|
||||
access-key-id = "YRP1RM617986USRU6NN8"
|
||||
secret-access-key = "vfbwQDYb1m7nfzo4LVEz90BIyOWfBMZ6bfGQbqDO"
|
||||
use-ssl = false
|
||||
use-ssl = true
|
||||
bucket-name = "mikulnews"
|
||||
location = "us-east-1"
|
||||
|
||||
|
|
@ -49,8 +49,8 @@ enable = true
|
|||
enable = true
|
||||
|
||||
[middleware.limiter]
|
||||
enable = true
|
||||
max = 20
|
||||
enable = false
|
||||
max = 500
|
||||
expiration_seconds = 60
|
||||
|
||||
[middleware.csrf]
|
||||
|
|
@ -66,7 +66,7 @@ enable = true
|
|||
retention = 30
|
||||
|
||||
[keycloak]
|
||||
endpoint = "http://103.31.38.120:8008"
|
||||
endpoint = "http://38.47.185.86:8008"
|
||||
realm = "medols"
|
||||
client-id = "medols-app"
|
||||
client-secret = "iyonEpZbAUs20quwaNFLMwRX7MUgPRlS"
|
||||
|
|
|
|||
Loading…
Reference in New Issue