Commit 08928861 authored by Yohanes Seandy Sunjoko's avatar Yohanes Seandy Sunjoko 💬

#1 init

parent 63b22fa5
...@@ -2,8 +2,8 @@ APP_NAME=jaga ...@@ -2,8 +2,8 @@ APP_NAME=jaga
APP_ENV=local APP_ENV=local
APP_KEY= APP_KEY=
APP_DEBUG=true APP_DEBUG=true
APP_HOST=localhost
APP_URL=http://localhost APP_URL=http://localhost
APP_PORT=80
APP_LOCALE=en APP_LOCALE=en
APP_FALLBACK_LOCALE=en APP_FALLBACK_LOCALE=en
...@@ -44,7 +44,7 @@ CACHE_PREFIX=jaga_ ...@@ -44,7 +44,7 @@ CACHE_PREFIX=jaga_
#MEMCACHED_HOST=127.0.0.1 #MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1 REDIS_HOST=jaga-be.redis
REDIS_PASSWORD=null REDIS_PASSWORD=null
REDIS_PORT=6379 REDIS_PORT=6379
...@@ -64,3 +64,12 @@ AWS_BUCKET= ...@@ -64,3 +64,12 @@ AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}" VITE_APP_NAME="${APP_NAME}"
DOCKER_RESTART_POLICY=no
TRAEFIK_PORT=91
TRAEFIK_PORT_HTTPS=443
WWWUSER=1000
WWWGROUP=1000
SAIL_XDEBUG_MODE=off
\ No newline at end of file
...@@ -157,7 +157,7 @@ return [ ...@@ -157,7 +157,7 @@ return [
'host' => env('REDIS_HOST', '127.0.0.1'), 'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'), 'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'), 'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'), 'port' => '6379',
'database' => env('REDIS_DB', '0'), 'database' => env('REDIS_DB', '0'),
'max_retries' => env('REDIS_MAX_RETRIES', 3), 'max_retries' => env('REDIS_MAX_RETRIES', 3),
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'), 'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
...@@ -170,7 +170,7 @@ return [ ...@@ -170,7 +170,7 @@ return [
'host' => env('REDIS_HOST', '127.0.0.1'), 'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'), 'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'), 'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'), 'port' => '6379',
'database' => env('REDIS_CACHE_DB', '1'), 'database' => env('REDIS_CACHE_DB', '1'),
'max_retries' => env('REDIS_MAX_RETRIES', 3), 'max_retries' => env('REDIS_MAX_RETRIES', 3),
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'), 'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
......
services: services:
traefik: traefik:
restart: "${DOCKER_RESTART_POLICY:-always}"
image: traefik:v3.0 image: traefik:v3.0
container_name: traefik container_name: traefik
command: command:
- "--api.insecure=true"
- "--api.dashboard=true"
- "--providers.docker=true" - "--providers.docker=true"
- "--providers.docker.exposedbydefault=false" - "--providers.docker.exposedbydefault=false"
- "--providers.docker.network=jaga-be.sail.network"
- "--entrypoints.web.address=:80" - "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
ports: ports:
- "${APP_PORT:-80}:80" - "${TRAEFIK_PORT:-80}:80"
- "${TRAEFIK_PORT_HTTPS:-443}:443"
- "8080:8080" # Traefik dashboard
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro - /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- jaga-be.sail.network
labels:
- "traefik.enable=true"
# Dashboard
- "traefik.http.routers.dashboard.rule=Host(`${TRAEFIK_DASHBOARD_HOST:-traefik.localhost}`)"
- "traefik.http.routers.dashboard.service=api@internal"
- "traefik.http.routers.dashboard.entrypoints=web"
- "traefik.http.routers.dashboard.middlewares=auth"
# Middleware for basic auth (optional)
- "traefik.http.middlewares.auth.basicauth.users=${TRAEFIK_AUTH_USERS:-}"
jaga-be-receptionist.app: receptionist:
build: build:
context: ./docker/sail context: ./docker/sail
dockerfile: Dockerfile dockerfile: Dockerfile
args: args:
WWWGROUP: "${WWWGROUP:-1000}" WWWGROUP: "${WWWGROUP:-1000}"
image: jaga-be/app image: jaga-be/app
container_name: jaga-be.app
extra_hosts: extra_hosts:
- "host.docker.internal:host-gateway" - "host.docker.internal:host-gateway"
ports: ports:
- "${VITE_PORT:-5173}:${VITE_PORT:-5173}" - "${VITE_PORT:-5173}:${VITE_PORT:-5173}"
environment: environment:
WWWUSER: "${WWWUSER:-1000}" WWWUSER: "${WWWUSER:-1000}"
LARAVEL_SAIL: 1 LARAVEL_SAIL: 1
...@@ -30,46 +48,73 @@ services: ...@@ -30,46 +48,73 @@ services:
XDEBUG_MODE: "${SAIL_XDEBUG_MODE:-off}" XDEBUG_MODE: "${SAIL_XDEBUG_MODE:-off}"
XDEBUG_CONFIG: "${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}" XDEBUG_CONFIG: "${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}"
IGNITION_LOCAL_SITES_PATH: "${PWD}" IGNITION_LOCAL_SITES_PATH: "${PWD}"
SUPERVISOR_PHP_COMMAND: "php -d variables_order=EGPCS /var/www/html/artisan octane:swoole --host=0.0.0.0" SUPERVISOR_PHP_COMMAND: "php -d variables_order=EGPCS /var/www/html/artisan octane:swoole --host=0.0.0.0 --port=8000 --workers=auto"
SUPERVISOR_PHP_USER: sail SUPERVISOR_PHP_USER: sail
XDG_CONFIG_HOME: /var/www/html/config XDG_CONFIG_HOME: /var/www/html/config
XDG_DATA_HOME: /var/www/html/data XDG_DATA_HOME: /var/www/html/data
restart: ${DOCKER_RESTART_POLICY:-always} restart: ${DOCKER_RESTART_POLICY:-always}
volumes: volumes:
- ".:/var/www/html" - ".:/var/www/html"
- "./storage:/var/www/html/storage" - "./storage:/var/www/html/storage"
- "./bootstrap/cache:/var/www/html/bootstrap/cache" - "./bootstrap/cache:/var/www/html/bootstrap/cache"
- jaga-be.app-vendor:/var/www/html/vendor - jaga-be.app-vendor:/var/www/html/vendor
- jaga-be.app-node_modules:/var/www/html/node_modules
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.routers.receptionist.rule=Host(`api.localhost`)" # HTTP router
- "traefik.http.routers.receptionist.entrypoints=web" - "traefik.http.routers.receptionist-http.rule=Host(`${APP_HOST:-localhost}`)"
# - "traefik.http.services.receptionist.loadbalancer.server.port=8000" - "traefik.http.routers.receptionist-http.entrypoints=web"
- "traefik.http.routers.receptionist-http.service=receptionist"
# HTTPS router (if you add TLS)
- "traefik.http.routers.receptionist.rule=Host(`${APP_HOST:-localhost}`)"
- "traefik.http.routers.receptionist.entrypoints=websecure"
- "traefik.http.routers.receptionist.service=receptionist"
# Service configuration
- "traefik.http.services.receptionist.loadbalancer.server.port=8000"
- "traefik.http.services.receptionist.loadbalancer.server.scheme=http"
# Health check (optional)
- "traefik.http.services.receptionist.loadbalancer.healthcheck.path=/"
- "traefik.http.services.receptionist.loadbalancer.healthcheck.interval=30s"
- "traefik.http.services.receptionist.loadbalancer.healthcheck.timeout=5s"
networks: networks:
- jaga-be.sail.network - jaga-be.sail.network
depends_on: depends_on:
- jaga-be.redis - jaga-be.redis
healthcheck:
test: ["CMD", "php", "/var/www/html/artisan", "octane:status", "--no-interaction"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
jaga-be.redis: jaga-be.redis:
image: docker.io/library/redis:7.4 image: docker.io/library/redis:7.4-alpine
restart: ${DOCKER_RESTART_POLICY:-always} restart: ${DOCKER_RESTART_POLICY:-always}
container_name: jaga-be.redis container_name: jaga-be.redis
ports:
- "${REDIS_PORT:-6379}:6379"
networks: networks:
- jaga-be.sail.network - jaga-be.sail.network
ports:
- "${REDIS_PORT}:6379"
volumes: volumes:
- ./docker/redis/redis.conf:/usr/local/etc/redis.conf - ./docker/redis/redis.conf:/usr/local/etc/redis/redis.conf
command: [redis-server, /usr/local/etc/redis.conf] - jaga-be.redis-data:/data
user: "redis" command: redis-server /usr/local/etc/redis/redis.conf --appendonly yes --dir /tmp --protected-mode no --bind 0.0.0.0
user: "${WWWUSER:-1000}:${WWWGROUP:-1000}"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 5s
retries: 3
networks: networks:
jaga-be.sail.network: jaga-be.sail.network:
driver: bridge driver: bridge
name: jaga-be.sail.network
volumes: volumes:
jaga-be.app-vendor: jaga-be.app-vendor:
driver: local
jaga-be.app-node_modules:
driver: local
jaga-be.redis-data:
driver: local
\ No newline at end of file
...@@ -34,22 +34,34 @@ RUN docker-php-ext-configure gd --with-freetype --with-jpeg \ ...@@ -34,22 +34,34 @@ RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
gd \ gd \
mbstring \ mbstring \
xml \ xml \
bcmath \ bcmath
redis
# Swoole extension (CRITICAL) # Swoole extension (CRITICAL)
RUN pecl install swoole \ RUN pecl install swoole redis \
&& docker-php-ext-enable swoole && docker-php-ext-enable swoole redis
# Composer # Composer
RUN curl -sS https://getcomposer.org/installer \ RUN curl -sS https://getcomposer.org/installer \
| php -- --install-dir=/usr/bin --filename=composer | php -- --install-dir=/usr/bin --filename=composer
# Install Node.js (includes npm)
RUN curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Verify installation
RUN node --version && npm --version
# User # User
RUN groupadd --force -g ${WWWGROUP} ${SUPERVISOR_PHP_USER} \ RUN groupadd --force -g ${WWWGROUP} ${SUPERVISOR_PHP_USER} \
&& useradd -ms /bin/bash --no-user-group \ && useradd -ms /bin/bash --no-user-group \
-g ${WWWGROUP} -u 1337 ${SUPERVISOR_PHP_USER} -g ${WWWGROUP} -u 1337 ${SUPERVISOR_PHP_USER}
# Set proper permissions
RUN mkdir -p /var/www/html/storage /var/www/html/bootstrap/cache
RUN chown -R sail:sail /var/www/html/storage /var/www/html/bootstrap/cache
RUN chmod -Rf 777 /var/www/html/storage /var/www/html/bootstrap/cache
# Supervisor # Supervisor
COPY start-container /usr/local/bin/start-container COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment