Compare commits

...

9 Commits

Author SHA1 Message Date
Bulut Kuru
733607493a deploy sh6
All checks were successful
continuous-integration/drone/pr Build is passing
2026-03-27 20:54:05 +03:00
Bulut Kuru
8bd35c425d deploy sh5
Some checks reported errors
continuous-integration/drone/push Build was killed
2026-03-27 20:53:18 +03:00
Bulut Kuru
5ad61853b4 Simplify Drone pipeline for test and prod only
All checks were successful
continuous-integration/drone/push Build is passing
2026-03-27 20:51:20 +03:00
Bulut Kuru
272010d738 deploy sh4
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing
2026-03-27 14:55:05 +03:00
Bulut Kuru
9e88de9902 deploy sh3
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2026-03-27 14:40:18 +03:00
Bulut Kuru
fa14e752ac deploy sh2
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2026-03-27 14:36:01 +03:00
Bulut Kuru
fea885f6cf Fix Drone test deploy without sudo
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing
2026-03-27 14:23:49 +03:00
Bulut Kuru
268bf371df Fix Drone test deploy without sudo 2026-03-27 14:23:27 +03:00
Bulut Kuru
e51d6b0cb0 deploy sh1
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing
2026-03-27 14:11:35 +03:00
5 changed files with 72 additions and 60 deletions

View File

@@ -4,26 +4,10 @@ name: bogazici-api
trigger:
branch:
- develop
- test
- main
steps:
- name: laravel-check
image: php:8.4-cli
when:
branch:
- develop
commands:
- apt-get update && apt-get install -y git unzip curl libzip-dev libicu-dev default-mysql-client
- docker-php-ext-install pdo_mysql zip intl
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- cp .env.example .env || true
- composer install --no-interaction --prefer-dist --optimize-autoloader
- php artisan key:generate --force || true
- php artisan optimize:clear || true
- php artisan test || true
- name: deploy-test
image: appleboy/drone-ssh
when:

View File

@@ -1,9 +1,10 @@
name: bogazici-api-prod
services:
bdc-api-prod:
build:
context: .
dockerfile: Dockerfile
container_name: bdc-api-prod
restart: unless-stopped
volumes:
- ./:/var/www/html

View File

@@ -1,9 +1,10 @@
name: bogazici-api-test
services:
bdc-api-test:
build:
context: .
dockerfile: Dockerfile
container_name: bdc-api-test
restart: unless-stopped
volumes:
- ./:/var/www/html

View File

@@ -6,17 +6,19 @@ ENV_SOURCE="/opt/projects/bogazici/corporate-api/prod/.env.prod"
BRANCH="main"
CONTAINER="bdc-api-prod"
COMPOSE_FILE="docker-compose.prod.yml"
COMPOSE_PROJECT="bogazici-api-prod"
UPLOADS_DIR="/opt/projects/bogazici/corporate-api/prod/uploads"
echo "🚀 [API] Production deploy başlatılıyor..."
cd "$PROJECT_DIR"
sudo chown -R "$USER":www-data storage bootstrap/cache 2>/dev/null || true
sudo find storage -type d -exec chmod 2775 {} \; 2>/dev/null || true
sudo find storage -type f -exec chmod 664 {} \; 2>/dev/null || true
sudo find bootstrap/cache -type d -exec chmod 2775 {} \; 2>/dev/null || true
sudo find bootstrap/cache -type f -exec chmod 664 {} \; 2>/dev/null || true
git config --global --add safe.directory "$PROJECT_DIR" || true
find storage -type d -exec chmod 2775 {} \; 2>/dev/null || true
find storage -type f -exec chmod 664 {} \; 2>/dev/null || true
find bootstrap/cache -type d -exec chmod 2775 {} \; 2>/dev/null || true
find bootstrap/cache -type f -exec chmod 664 {} \; 2>/dev/null || true
git fetch origin
git checkout "$BRANCH"
@@ -28,7 +30,6 @@ if [ ! -f "$ENV_SOURCE" ]; then
exit 1
fi
cp "$ENV_SOURCE" .env
if ! grep -q '^APP_KEY=base64:' .env; then
@@ -36,23 +37,35 @@ if ! grep -q '^APP_KEY=base64:' .env; then
exit 1
fi
sudo mkdir -p "$UPLOADS_DIR"/{images,videos,hero-slides,settings,pages,courses,announcements,categories}
sudo chown -R "$USER":www-data "$UPLOADS_DIR" 2>/dev/null || true
sudo find "$UPLOADS_DIR" -type d -exec chmod 2775 {} \; 2>/dev/null || true
sudo find "$UPLOADS_DIR" -type f -exec chmod 664 {} \; 2>/dev/null || true
docker stop "$CONTAINER" 2>/dev/null || true
docker rm "$CONTAINER" 2>/dev/null || true
docker compose -p bogazici-api-prod -f "$COMPOSE_FILE" down --remove-orphans 2>/dev/null || true
docker compose -p bogazici-api-prod -f "$COMPOSE_FILE" up -d --build
mkdir -p "$UPLOADS_DIR"
chmod 2775 "$UPLOADS_DIR" 2>/dev/null || true
sleep 3
docker compose -p bogazici-api-prod -f "$COMPOSE_FILE" exec -T "$CONTAINER" composer install --no-interaction --prefer-dist --optimize-autoloader --no-dev || true
docker compose -p bogazici-api-prod -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan migrate --force || true
docker compose -p bogazici-api-prod -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan optimize:clear || true
docker compose -p bogazici-api-prod -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan config:cache || true
docker compose -p bogazici-api-prod -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan route:cache || true
docker compose -p bogazici-api-prod -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan view:cache || true
docker rm -f bogazici-api-prod-bdc-api-prod-1 2>/dev/null || true
docker rm -f bdc-api-prod 2>/dev/null || true
docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" down --remove-orphans || true
docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" up -d --build
echo "⏳ Container hazır olması bekleniyor..."
for i in {1..30}; do
if docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" ps --status running | grep -q "$CONTAINER"; then
echo "✅ Container ayakta"
break
fi
if [ "$i" -eq 30 ]; then
echo "❌ HATA: Container zamanında ayağa kalkmadı"
docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" logs --tail=100
exit 1
fi
sleep 1
done
docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" exec -T "$CONTAINER" composer install --no-interaction --prefer-dist --optimize-autoloader --no-dev
docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan optimize:clear
docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan config:cache
docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan route:cache
docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan view:cache
docker image prune -f 2>/dev/null || true

View File

@@ -6,17 +6,19 @@ ENV_SOURCE="/opt/projects/bogazici/corporate-api/test/.env.test"
BRANCH="test"
CONTAINER="bdc-api-test"
COMPOSE_FILE="docker-compose.test.yml"
COMPOSE_PROJECT="bogazici-api-test"
UPLOADS_DIR="/opt/projects/bogazici/corporate-api/test/uploads"
echo "🚀 [API] Test deploy başlatılıyor..."
cd "$PROJECT_DIR"
sudo chown -R "$USER":www-data storage bootstrap/cache 2>/dev/null || true
sudo find storage -type d -exec chmod 2775 {} \; 2>/dev/null || true
sudo find storage -type f -exec chmod 664 {} \; 2>/dev/null || true
sudo find bootstrap/cache -type d -exec chmod 2775 {} \; 2>/dev/null || true
sudo find bootstrap/cache -type f -exec chmod 664 {} \; 2>/dev/null || true
git config --global --add safe.directory "$PROJECT_DIR" || true
find storage -type d -exec chmod 2775 {} \; 2>/dev/null || true
find storage -type f -exec chmod 664 {} \; 2>/dev/null || true
find bootstrap/cache -type d -exec chmod 2775 {} \; 2>/dev/null || true
find bootstrap/cache -type f -exec chmod 664 {} \; 2>/dev/null || true
git fetch origin
git checkout "$BRANCH"
@@ -30,29 +32,40 @@ fi
cp "$ENV_SOURCE" .env
if ! grep -q '^APP_KEY=base64:' .env; then
echo "❌ HATA: APP_KEY eksik veya boş -> $ENV_SOURCE"
exit 1
fi
sudo mkdir -p "$UPLOADS_DIR"/{images,videos,hero-slides,settings,pages,courses,announcements,categories}
sudo chown -R "$USER":www-data "$UPLOADS_DIR" 2>/dev/null || true
sudo find "$UPLOADS_DIR" -type d -exec chmod 2775 {} \; 2>/dev/null || true
sudo find "$UPLOADS_DIR" -type f -exec chmod 664 {} \; 2>/dev/null || true
mkdir -p "$UPLOADS_DIR"
chmod 2775 "$UPLOADS_DIR" 2>/dev/null || true
docker stop "$CONTAINER" 2>/dev/null || true
docker rm "$CONTAINER" 2>/dev/null || true
docker compose -p bogazici-api-test -f "$COMPOSE_FILE" down --remove-orphans 2>/dev/null || true
docker compose -p bogazici-api-test -f "$COMPOSE_FILE" up -d --build
docker rm -f bogazici-api-test-bdc-api-test-1 2>/dev/null || true
docker rm -f bdc-api-test 2>/dev/null || true
sleep 3
docker compose -p bogazici-api-test -f "$COMPOSE_FILE" exec -T "$CONTAINER" composer install --no-interaction --prefer-dist --optimize-autoloader || true
docker compose -p bogazici-api-test -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan migrate --force || true
docker compose -p bogazici-api-test -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan optimize:clear || true
docker compose -p bogazici-api-test -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan config:cache || true
docker compose -p bogazici-api-test -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan route:cache || true
docker compose -p bogazici-api-test -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan view:cache || true
docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" down --remove-orphans || true
docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" up -d --build
echo "⏳ Container hazır olması bekleniyor..."
for i in {1..30}; do
if docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" ps --status running | grep -q "$CONTAINER"; then
echo "✅ Container ayakta"
break
fi
if [ "$i" -eq 30 ]; then
echo "❌ HATA: Container zamanında ayağa kalkmadı"
docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" logs --tail=100
exit 1
fi
sleep 1
done
docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" exec -T "$CONTAINER" composer install --no-interaction --prefer-dist --optimize-autoloader
docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan optimize:clear
docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan config:cache
docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan route:cache
docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan view:cache
docker image prune -f 2>/dev/null || true