From e0d72f62b200f9ca94d436c2bffde8e9574404ad Mon Sep 17 00:00:00 2001 From: "bruno.thomas" Date: Tue, 12 Dec 2023 11:22:35 +0100 Subject: [PATCH 1/7] test crontab --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 03b9905..fa7e6a8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,7 +3,7 @@ name: Deploy to Container on: push: branches: - - 13_continuous_integration + - 17_schedule_and_swagger - main jobs: @@ -25,4 +25,4 @@ jobs: chmod 600 ~/.ssh/pkey eval "$(ssh-agent -s)" ssh-add ~/.ssh/pkey - ssh ${{ secrets.SECRET_USER }}@${{ secrets.SECRET_HOST }} -p ${{ secrets.SECRET_PORT }} "cd ./project/Swissdle && git pull origin main && cd backend-laravel && composer install && cd ../frontend-vue && npm install && npm run build" \ No newline at end of file + ssh ${{ secrets.SECRET_USER }}@${{ secrets.SECRET_HOST }} -p ${{ secrets.SECRET_PORT }} "cd ./project/Swissdle && git pull origin main && cd backend-laravel && composer install && cd ../frontend-vue && npm install && npm run build && echo '* * * * * cd /home/laravel/project/Swissdle/backend-laravel && php artisan schedule:run >> /dev/null 2>&1' | crontab -" \ No newline at end of file From 8490b330a6095c7f324294ae9a41ecea975a4f4e Mon Sep 17 00:00:00 2001 From: "bruno.thomas" Date: Mon, 18 Dec 2023 19:52:58 +0100 Subject: [PATCH 2/7] crontab test --- .github/workflows/deploy.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index fa7e6a8..a40656f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -5,6 +5,7 @@ on: branches: - 17_schedule_and_swagger - main + - dev jobs: deploy: @@ -25,4 +26,4 @@ jobs: chmod 600 ~/.ssh/pkey eval "$(ssh-agent -s)" ssh-add ~/.ssh/pkey - ssh ${{ secrets.SECRET_USER }}@${{ secrets.SECRET_HOST }} -p ${{ secrets.SECRET_PORT }} "cd ./project/Swissdle && git pull origin main && cd backend-laravel && composer install && cd ../frontend-vue && npm install && npm run build && echo '* * * * * cd /home/laravel/project/Swissdle/backend-laravel && php artisan schedule:run >> /dev/null 2>&1' | crontab -" \ No newline at end of file + ssh ${{ secrets.SECRET_USER }}@${{ secrets.SECRET_HOST }} -p ${{ secrets.SECRET_PORT }} "cd ./project/Swissdle && git pull origin main && cd backend-laravel && composer install && cd ../frontend-vue && npm install && npm run build && crontab -r && echo '* * * * * cd /home/laravel/project/Swissdle/backend-laravel && php artisan schedule:run >> /home/laravel/project/Swissdle/cron.log' | crontab -e" \ No newline at end of file From 9d06d46bfb2256af59e9d0d97639efd7011607fd Mon Sep 17 00:00:00 2001 From: "bruno.thomas" Date: Mon, 18 Dec 2023 20:09:39 +0100 Subject: [PATCH 3/7] removed crontab entries only if there are entries --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a40656f..c9ea35b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -26,4 +26,4 @@ jobs: chmod 600 ~/.ssh/pkey eval "$(ssh-agent -s)" ssh-add ~/.ssh/pkey - ssh ${{ secrets.SECRET_USER }}@${{ secrets.SECRET_HOST }} -p ${{ secrets.SECRET_PORT }} "cd ./project/Swissdle && git pull origin main && cd backend-laravel && composer install && cd ../frontend-vue && npm install && npm run build && crontab -r && echo '* * * * * cd /home/laravel/project/Swissdle/backend-laravel && php artisan schedule:run >> /home/laravel/project/Swissdle/cron.log' | crontab -e" \ No newline at end of file + ssh ${{ secrets.SECRET_USER }}@${{ secrets.SECRET_HOST }} -p ${{ secrets.SECRET_PORT }} "cd ./project/Swissdle && git pull origin main && cd backend-laravel && composer install && cd ../frontend-vue && npm install && npm run build && crontab -l >/dev/null 2>&1 && crontab -r && echo '* * * * * cd /home/laravel/project/Swissdle/backend-laravel && php artisan schedule:run >> /home/laravel/project/Swissdle/cron.log' | crontab -e" \ No newline at end of file From 1412927ecc1b6bf62a8e3681e9fc2379195cd07f Mon Sep 17 00:00:00 2001 From: "bruno.thomas" Date: Mon, 18 Dec 2023 20:17:23 +0100 Subject: [PATCH 4/7] test cron --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c9ea35b..4884326 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -26,4 +26,4 @@ jobs: chmod 600 ~/.ssh/pkey eval "$(ssh-agent -s)" ssh-add ~/.ssh/pkey - ssh ${{ secrets.SECRET_USER }}@${{ secrets.SECRET_HOST }} -p ${{ secrets.SECRET_PORT }} "cd ./project/Swissdle && git pull origin main && cd backend-laravel && composer install && cd ../frontend-vue && npm install && npm run build && crontab -l >/dev/null 2>&1 && crontab -r && echo '* * * * * cd /home/laravel/project/Swissdle/backend-laravel && php artisan schedule:run >> /home/laravel/project/Swissdle/cron.log' | crontab -e" \ No newline at end of file + ssh ${{ secrets.SECRET_USER }}@${{ secrets.SECRET_HOST }} -p ${{ secrets.SECRET_PORT }} "cd ./project/Swissdle && git pull origin main && cd backend-laravel && composer install && cd ../frontend-vue && npm install && npm run build && crontab -l" \ No newline at end of file From 8ba5e95671b8d75c508a55461428a569c8fdfb48 Mon Sep 17 00:00:00 2001 From: "bruno.thomas" Date: Mon, 18 Dec 2023 20:34:51 +0100 Subject: [PATCH 5/7] test cron --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4884326..a30082e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -26,4 +26,4 @@ jobs: chmod 600 ~/.ssh/pkey eval "$(ssh-agent -s)" ssh-add ~/.ssh/pkey - ssh ${{ secrets.SECRET_USER }}@${{ secrets.SECRET_HOST }} -p ${{ secrets.SECRET_PORT }} "cd ./project/Swissdle && git pull origin main && cd backend-laravel && composer install && cd ../frontend-vue && npm install && npm run build && crontab -l" \ No newline at end of file + ssh ${{ secrets.SECRET_USER }}@${{ secrets.SECRET_HOST }} -p ${{ secrets.SECRET_PORT }} "cd ./project/Swissdle && git pull origin main && cd backend-laravel && composer install && cd ../frontend-vue && npm install && npm run build && (crontab -l && crontab -r) || echo 'Nothing to delete'" \ No newline at end of file From 3db2f42175707d089999eb6061f7d199413d39d8 Mon Sep 17 00:00:00 2001 From: "bruno.thomas" Date: Mon, 18 Dec 2023 20:46:29 +0100 Subject: [PATCH 6/7] test cron --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a30082e..949349b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -26,4 +26,4 @@ jobs: chmod 600 ~/.ssh/pkey eval "$(ssh-agent -s)" ssh-add ~/.ssh/pkey - ssh ${{ secrets.SECRET_USER }}@${{ secrets.SECRET_HOST }} -p ${{ secrets.SECRET_PORT }} "cd ./project/Swissdle && git pull origin main && cd backend-laravel && composer install && cd ../frontend-vue && npm install && npm run build && (crontab -l && crontab -r) || echo 'Nothing to delete'" \ No newline at end of file + ssh ${{ secrets.SECRET_USER }}@${{ secrets.SECRET_HOST }} -p ${{ secrets.SECRET_PORT }} "cd ./project/Swissdle && git pull origin main && cd backend-laravel && composer install && cd ../frontend-vue && npm install && npm run build && (crontab -l && crontab -r) || echo '* * * * * cd /home/laravel/project/Swissdle/backend-laravel && /usr/local/bin/php artisan schedule:run >> /home/laravel/project/Swissdle/cron.log' | crontab" \ No newline at end of file From b82f2919299e2cb53e4008927ac521c41fbd1f5e Mon Sep 17 00:00:00 2001 From: Thombrix Date: Mon, 18 Dec 2023 21:38:50 +0100 Subject: [PATCH 7/7] Swagger doc gen & https in production --- .github/workflows/deploy.yml | 2 +- backend-laravel/app/Providers/RouteServiceProvider.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 949349b..34996c0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -26,4 +26,4 @@ jobs: chmod 600 ~/.ssh/pkey eval "$(ssh-agent -s)" ssh-add ~/.ssh/pkey - ssh ${{ secrets.SECRET_USER }}@${{ secrets.SECRET_HOST }} -p ${{ secrets.SECRET_PORT }} "cd ./project/Swissdle && git pull origin main && cd backend-laravel && composer install && cd ../frontend-vue && npm install && npm run build && (crontab -l && crontab -r) || echo '* * * * * cd /home/laravel/project/Swissdle/backend-laravel && /usr/local/bin/php artisan schedule:run >> /home/laravel/project/Swissdle/cron.log' | crontab" \ No newline at end of file + ssh ${{ secrets.SECRET_USER }}@${{ secrets.SECRET_HOST }} -p ${{ secrets.SECRET_PORT }} "cd ./project/Swissdle && git pull origin main && cd backend-laravel && composer install && php artisan vendor:publish --provider "L5Swagger\L5SwaggerServiceProvider" && cd ../frontend-vue && npm install && npm run build && (crontab -l && crontab -r) || echo '* * * * * cd /home/laravel/project/Swissdle/backend-laravel && /usr/local/bin/php artisan schedule:run >> /home/laravel/project/Swissdle/cron.log' | crontab" \ No newline at end of file diff --git a/backend-laravel/app/Providers/RouteServiceProvider.php b/backend-laravel/app/Providers/RouteServiceProvider.php index 1cf5f15..b06c5b7 100644 --- a/backend-laravel/app/Providers/RouteServiceProvider.php +++ b/backend-laravel/app/Providers/RouteServiceProvider.php @@ -24,6 +24,10 @@ class RouteServiceProvider extends ServiceProvider */ public function boot(): void { + if (App::environment() === "production") { + URL::forceScheme("https"); + } + RateLimiter::for('api', function (Request $request) { return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); });