Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Project Makefile

.PHONY: up down build restart logs clean shell-back shell-front shell-ws migrate seed fresh composer-install npm-install provision help

# --- SETUP ---

provision: ## Run the automated installation script (sets .env, keys, and DB)
chmod +x provision.sh
./provision.sh

# --- DOCKER MANAGEMENT ---

up: ## Start containers in detached mode (recreating them)
docker compose up -d --force-recreate

down: ## Stop containers
docker compose down

build: ## Build containers
docker compose build

restart: ## Restart containers
docker compose restart

logs: ## View logs for all containers
docker compose logs -f

clean: ## Remove containers, networks, volumes, and images
docker compose down -v --rmi all

# --- SHELL ACCESS ---

shell-back: ## Open bash in the backend container
docker exec -it laravel_app bash

shell-front: ## Open sh in the frontend container
docker exec -it react_app sh

shell-ws: ## Open sh in the ws_server container
docker exec -it ws_server sh

# --- LARAVEL (BACKEND) ---

migrate: ## Run database migrations
docker exec -it laravel_app php artisan migrate

seed: ## Run database seeders
docker exec -it laravel_app php artisan db:seed

fresh: ## Fresh migration and seed
docker exec -it laravel_app php artisan migrate:fresh --seed

composer-install: ## Install composer dependencies
docker exec -it laravel_app composer install

# --- NPM (FRONTEND & WS SERVER) ---

npm-install: ## Install NPM packages for frontend and ws server
docker exec -it react_app npm install
docker exec -it ws_server npm install

# --- HELP ---

help: ## Show this help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'

.DEFAULT_GOAL := help
3 changes: 2 additions & 1 deletion back/src/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,5 @@ VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

JUDGE0_API_URL=http://judge0_server:2358
SANCTUM_STATEFUL_DOMAINS=http://localhost:5173
SANCTUM_STATEFUL_DOMAINS=http://localhost:5173
FRONTEND_URL=http://localhost:5173
2 changes: 1 addition & 1 deletion back/src/config/cors.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

'allowed_methods' => ['*'],

'allowed_origins' => ['http://localhost:5173'],
'allowed_origins' => [env('FRONTEND_URL', 'http://localhost:5173')],

'allowed_origins_patterns' => [],

Expand Down
Loading