diff --git a/credential/.env.db b/credential/.env.db deleted file mode 100644 index d2bed6b7..00000000 --- a/credential/.env.db +++ /dev/null @@ -1,3 +0,0 @@ -POSTGRES_USER=postgres -POSTGRES_PASSWORD=Postgres@Secure2025! -POSTGRES_DB=db_lti_erp \ No newline at end of file diff --git a/credential/01_init_app_user.sql b/credential/01_init_app_user.sql deleted file mode 100644 index 0587d4c1..00000000 --- a/credential/01_init_app_user.sql +++ /dev/null @@ -1,47 +0,0 @@ --- ============================================================ --- 🧩 INIT SCRIPT: CREATE LIMITED APP USER FOR LTI API --- ============================================================ - --- Buat user aplikasi jika belum ada -DO -$$ -BEGIN - IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = 'app_lti_user') THEN - CREATE ROLE app_lti_user WITH LOGIN PASSWORD 'AppLti@Secure2025!' NOINHERIT NOCREATEROLE NOCREATEDB NOSUPERUSER; - RAISE NOTICE '✅ Role app_lti_user created successfully.'; - ELSE - RAISE NOTICE 'ℹ️ Role app_lti_user already exists.'; - END IF; -END -$$; - --- Buat database jika belum ada -DO -$$ -BEGIN - IF NOT EXISTS (SELECT FROM pg_database WHERE datname = 'db_lti_erp') THEN - CREATE DATABASE db_lti_erp OWNER app_lti_user; - RAISE NOTICE '✅ Database db_lti_erp created and owned by app_lti_user.'; - ELSE - RAISE NOTICE 'ℹ️ Database db_lti_erp already exists.'; - END IF; -END -$$; - -\connect db_lti_erp - --- Beri hak CRUD untuk app_lti_user -GRANT CONNECT ON DATABASE db_lti_erp TO app_lti_user; -GRANT USAGE ON SCHEMA public TO app_lti_user; -GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO app_lti_user; -GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO app_lti_user; - --- Set default privileges agar tabel baru juga bisa diakses -ALTER DEFAULT PRIVILEGES IN SCHEMA public -GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO app_lti_user; - -ALTER DEFAULT PRIVILEGES IN SCHEMA public -GRANT USAGE, SELECT ON SEQUENCES TO app_lti_user; - --- Tampilkan hasil -\du app_lti_user diff --git a/docker-compose.yaml b/docker-compose.yaml deleted file mode 100644 index ab6daeba..00000000 --- a/docker-compose.yaml +++ /dev/null @@ -1,98 +0,0 @@ -services: - dev-api-lti: - build: - context: . - dockerfile: Dockerfile - container_name: dev-api-lti - working_dir: /lti-api - command: ["/bin/sh", "scripts/entrypoint.sh"] - ports: - - "8081:8081" - env_file: - - .env - environment: - # override agar koneksi ke container internal - DB_HOST: dev-postgres-lti - DB_PORT: 5432 - REDIS_URL: redis://dev-redis-lti:6379/0 - volumes: - - .:/lti-api - - ./.air.toml:/lti-api/.air.toml:ro - - ./internal/config/jwtRS256.key:/run/keys/jwtRS256.key - - ./internal/config/jwtRS256.key.pub:/run/keys/jwtRS256.key.pub - depends_on: - - dev-postgres-lti - - dev-redis-lti - networks: - - lti-network - healthcheck: - test: ["CMD-SHELL", "wget -qO- http://localhost:8081/healthz || exit 1"] - interval: 10s - timeout: 3s - retries: 10 - start_period: 10s - deploy: - resources: - limits: - cpus: "2.0" - memory: 2G - reservations: - cpus: "1.0" - memory: 512M - - dev-postgres-lti: - image: postgres:15-alpine - container_name: dev-postgres-lti - restart: always - env_file: - - credential/.env.db - ports: - - "5433:5432" - volumes: - - dev-postgres-lti-data:/var/lib/postgresql/data - - ./credential:/docker-entrypoint-initdb.d:ro - networks: - - lti-network - healthcheck: - test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres} -d ${DB_NAME:-db_lti_erp}"] - interval: 10s - timeout: 5s - retries: 5 - start_period: 5s - deploy: - resources: - limits: - cpus: "1.0" - memory: 2G - reservations: - cpus: "0.5" - memory: 512M - - dev-redis-lti: - image: redis:7-alpine - container_name: dev-redis-lti - restart: always - ports: - - "6380:6379" - networks: - - lti-network - healthcheck: - test: ["CMD", "redis-cli", "ping"] - interval: 10s - timeout: 3s - retries: 10 - deploy: - resources: - limits: - cpus: "0.5" - memory: 512M - reservations: - cpus: "0.2" - memory: 256M - -networks: - lti-network: - driver: bridge - -volumes: - dev-postgres-lti-data: