Compare commits

...

5 Commits

Author SHA1 Message Date
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
4 changed files with 35 additions and 26 deletions

View File

@@ -1,6 +1,6 @@
kind: pipeline kind: pipeline
type: docker type: docker
name: default name: bogazici-api
trigger: trigger:
branch: branch:
@@ -15,13 +15,13 @@ steps:
branch: branch:
- develop - develop
commands: commands:
- apt-get update && apt-get install -y git unzip curl libzip-dev default-mysql-client - apt-get update && apt-get install -y git unzip curl libzip-dev libicu-dev default-mysql-client
- docker-php-ext-install pdo_mysql zip - docker-php-ext-install pdo_mysql zip intl
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- cp .env.example .env || true - cp .env.example .env || true
- composer install --no-interaction --prefer-dist --optimize-autoloader - composer install --no-interaction --prefer-dist --optimize-autoloader
- php artisan key:generate --force || true - php artisan key:generate --force || true
- php artisan config:clear || true - php artisan optimize:clear || true
- php artisan test || true - php artisan test || true
- name: deploy-test - name: deploy-test
@@ -31,11 +31,12 @@ steps:
- test - test
settings: settings:
host: host:
from_secret: server_host from_secret: SERVER_HOST
username: username:
from_secret: server_user from_secret: SERVER_USER
key: key:
from_secret: server_ssh_key from_secret: SERVER_SSH_KEY
port: 22
script: script:
- cd /opt/projects/bogazici/corporate-api/test/api - cd /opt/projects/bogazici/corporate-api/test/api
- bash scripts/deploy-test.sh - bash scripts/deploy-test.sh
@@ -47,11 +48,12 @@ steps:
- main - main
settings: settings:
host: host:
from_secret: server_host from_secret: SERVER_HOST
username: username:
from_secret: server_user from_secret: SERVER_USER
key: key:
from_secret: server_ssh_key from_secret: SERVER_SSH_KEY
port: 22
script: script:
- cd /opt/projects/bogazici/corporate-api/prod/api - cd /opt/projects/bogazici/corporate-api/prod/api
- bash scripts/deploy-prod.sh - bash scripts/deploy-prod.sh

View File

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

View File

@@ -28,6 +28,7 @@ if [ ! -f "$ENV_SOURCE" ]; then
exit 1 exit 1
fi fi
cp "$ENV_SOURCE" .env cp "$ENV_SOURCE" .env
if ! grep -q '^APP_KEY=base64:' .env; then if ! grep -q '^APP_KEY=base64:' .env; then
@@ -42,16 +43,16 @@ sudo find "$UPLOADS_DIR" -type f -exec chmod 664 {} \; 2>/dev/null || true
docker stop "$CONTAINER" 2>/dev/null || true docker stop "$CONTAINER" 2>/dev/null || true
docker rm "$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 -p bogazici-api-prod -f "$COMPOSE_FILE" down --remove-orphans 2>/dev/null || true
docker compose -f "$COMPOSE_FILE" up -d --build docker compose -p bogazici-api-prod -f "$COMPOSE_FILE" up -d --build
sleep 3 sleep 3
docker compose -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" 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 -p bogazici-api-prod -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 -p bogazici-api-prod -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 -p bogazici-api-prod -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 -p bogazici-api-prod -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan route:cache || true
docker compose -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan view:cache || true docker compose -p bogazici-api-prod -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan view:cache || true
docker image prune -f 2>/dev/null || true docker image prune -f 2>/dev/null || true

View File

@@ -30,6 +30,7 @@ fi
cp "$ENV_SOURCE" .env cp "$ENV_SOURCE" .env
if ! grep -q '^APP_KEY=base64:' .env; then if ! grep -q '^APP_KEY=base64:' .env; then
echo "❌ HATA: APP_KEY eksik veya boş -> $ENV_SOURCE" echo "❌ HATA: APP_KEY eksik veya boş -> $ENV_SOURCE"
exit 1 exit 1
@@ -42,16 +43,16 @@ sudo find "$UPLOADS_DIR" -type f -exec chmod 664 {} \; 2>/dev/null || true
docker stop "$CONTAINER" 2>/dev/null || true docker stop "$CONTAINER" 2>/dev/null || true
docker rm "$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 -p bogazici-api-test -f "$COMPOSE_FILE" down --remove-orphans 2>/dev/null || true
docker compose -f "$COMPOSE_FILE" up -d --build docker compose -p bogazici-api-test -f "$COMPOSE_FILE" up -d --build
sleep 3 sleep 3
docker compose -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" composer install --no-interaction --prefer-dist --optimize-autoloader || true
docker compose -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 migrate --force || true
docker compose -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 optimize:clear || true
docker compose -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 config:cache || true
docker compose -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 route:cache || true
docker compose -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan view:cache || true docker compose -p bogazici-api-test -f "$COMPOSE_FILE" exec -T "$CONTAINER" php artisan view:cache || true
docker image prune -f 2>/dev/null || true docker image prune -f 2>/dev/null || true