Compare commits

...

16 Commits

Author SHA1 Message Date
9099622ceb Merge pull request 'test' (#8) from test into main
Some checks failed
continuous-integration/drone/push Build is failing
Reviewed-on: #8
2026-03-27 14:43:03 +03:00
72da6a7600 Merge pull request 'deploy sh3' (#7) from develop into test
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing
Reviewed-on: #7
2026-03-27 14:41:37 +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
87fbf98858 Merge pull request 'deploy sh2' (#6) from develop into test
Some checks failed
continuous-integration/drone/push Build is failing
Reviewed-on: #6
2026-03-27 14:37:50 +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
4f01c1bec8 Merge pull request 'test' (#5) from test into main
Some checks failed
continuous-integration/drone/push Build is failing
Reviewed-on: #5
2026-03-27 14:29:17 +03:00
a24c2f18d8 Merge pull request 'develop' (#4) from develop into test
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing
Reviewed-on: #4
2026-03-27 14:25:43 +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
49f9f69b1e Merge pull request 'deploy sh1' (#3) from develop into test
Some checks failed
continuous-integration/drone/push Build is failing
Reviewed-on: #3
2026-03-27 14:13:08 +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
c7e251cc1c Merge pull request 'develop' (#2) from develop into test
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
Reviewed-on: #2
2026-03-27 13:39:44 +03:00
Bulut Kuru
cb5c24648d deploy sh
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing
2026-03-27 13:36:55 +03:00
bulut
f008e2d9d1 trust proxies 1
All checks were successful
continuous-integration/drone/push Build is passing
2026-03-27 12:00:58 +03:00
bulut
b25c5d2cfb update ssl force
All checks were successful
continuous-integration/drone/push Build is passing
2026-03-27 11:40:00 +03:00
bulut
79d0b2e54f Add Drone CI pipeline
All checks were successful
continuous-integration/drone/push Build is passing
2026-03-27 11:28:18 +03:00
6 changed files with 81 additions and 50 deletions

View File

@@ -1,6 +1,6 @@
kind: pipeline
type: docker
name: default
name: bogazici-api
trigger:
branch:
@@ -15,13 +15,13 @@ steps:
branch:
- develop
commands:
- apt-get update && apt-get install -y git unzip curl libzip-dev default-mysql-client
- docker-php-ext-install pdo_mysql zip
- 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 config:clear || true
- php artisan optimize:clear || true
- php artisan test || true
- name: deploy-test
@@ -31,11 +31,12 @@ steps:
- test
settings:
host:
from_secret: server_host
from_secret: SERVER_HOST
username:
from_secret: server_user
from_secret: SERVER_USER
key:
from_secret: server_ssh_key
from_secret: SERVER_SSH_KEY
port: 22
script:
- cd /opt/projects/bogazici/corporate-api/test/api
- bash scripts/deploy-test.sh
@@ -47,11 +48,12 @@ steps:
- main
settings:
host:
from_secret: server_host
from_secret: SERVER_HOST
username:
from_secret: server_user
from_secret: SERVER_USER
key:
from_secret: server_ssh_key
from_secret: SERVER_SSH_KEY
port: 22
script:
- cd /opt/projects/bogazici/corporate-api/prod/api
- bash scripts/deploy-prod.sh

View File

@@ -31,6 +31,7 @@ use App\Repositories\Eloquent\UserRepository;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
@@ -39,6 +40,8 @@ class AppServiceProvider extends ServiceProvider
/**
* @var array<class-string, class-string>
*/
public array $bindings = [
CategoryRepositoryInterface::class => CategoryRepository::class,
CourseRepositoryInterface::class => CourseRepository::class,
@@ -68,6 +71,8 @@ class AppServiceProvider extends ServiceProvider
*/
public function boot(): void
{
URL::forceScheme('https');
Str::macro('turkishSlug', function (string $text, string $separator = '-'): string {
$map = [
'ç' => 'c',

View File

@@ -1,3 +1,5 @@
name: bogazici-api-prod
services:
bdc-api-prod:
build:

View File

@@ -1,3 +1,5 @@
name: bogazici-api-test
services:
bdc-api-test:
build:

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"
@@ -35,23 +37,31 @@ 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
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 -f "$COMPOSE_FILE" down --remove-orphans 2>/dev/null || true
docker compose -f "$COMPOSE_FILE" up -d --build
docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" down --remove-orphans || true
docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" up -d --build
sleep 3
docker compose -f "$COMPOSE_FILE" exec -T "$CONTAINER" composer install --no-interaction --prefer-dist --optimize-autoloader --no-dev || true
docker compose -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan migrate --force || true
docker compose -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan optimize:clear || true
docker compose -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan config:cache || true
docker compose -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan route:cache || true
docker compose -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan view:cache || true
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"
@@ -35,23 +37,31 @@ 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
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 -f "$COMPOSE_FILE" down --remove-orphans 2>/dev/null || true
docker compose -f "$COMPOSE_FILE" up -d --build
docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" down --remove-orphans || true
docker compose -p "$COMPOSE_PROJECT" -f "$COMPOSE_FILE" up -d --build
sleep 3
docker compose -f "$COMPOSE_FILE" exec -T "$CONTAINER" composer install --no-interaction --prefer-dist --optimize-autoloader || true
docker compose -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan migrate --force || true
docker compose -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan optimize:clear || true
docker compose -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan config:cache || true
docker compose -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan route:cache || true
docker compose -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan view:cache || true
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