Skip to content

Commit

Permalink
Update deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
tobifra committed Aug 18, 2024
2 parents bf0924e + 55a6fb4 commit 8b89f6c
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 23 deletions.
31 changes: 26 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,16 @@ jobs:
cd .vitepress/dist
rsync -avz --delete . $SSH_USERNAME@$SSH_SERVER:$DEPLOY_PATH
- name: Ensure bootstrap/cache directory exists and is writable
run: |
mkdir -p ./api/bootstrap/cache
chmod -R 775 ./api/bootstrap/cache
- name: Install PHP 8.2 and Composer
run: |
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update
sudo apt-get install -y php8.2 php8.2-cli php8.2-mbstring php8.2-xml php8.2-curl php8.2-zip unzip curl
sudo apt-get install -y php8.2 php8.2-cli php8.2-mbstring php8.2-xml php8.2-curl php8.2-zip php8.2-intl php8.2-bcmath unzip curl
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
Expand All @@ -68,11 +73,21 @@ jobs:
MAIL_ENCRYPTION: ${{ secrets.MAIL_ENCRYPTION }}
MAIL_FROM_ADDRESS: ${{ secrets.MAIL_FROM_ADDRESS }}
MAIL_FROM_NAME: ${{ secrets.MAIL_FROM_NAME }}
APP_KEY: ${{ secrets.APP_KEY }}
FRONTEND_URL: ${{ vars.FRONTEND_URL }}
CREDITOR_NAME: ${{ vars.CREDITOR_NAME }}
CREDITOR_STREET: ${{ vars.CREDITOR_STREET }}
CREDITOR_TOWN: ${{ vars.CREDITOR_TOWN }}
CREDITOR_ZIP: ${{ vars.CREDITOR_ZIP }}
CREDITOR_IBAN: ${{ vars.CREDITOR_IBAN }}
CREDITOR_EMAIL: ${{ vars.CREDITOR_EMAIL }}

run: |
cd ./api
rm -f .env
cp .env.example .env
cp env.example .env
sed -ri "s~^APP_URL=.*$~APP_URL=$BACKEND_URL~" .env
sed -ri "s~^FRONTEND_URL=.*$~FRONTEND_URL=$FRONTEND_URL~" .env
sed -ri "s~^DB_HOST=.*$~DB_HOST=$DB_HOST~" .env
sed -ri "s~^DB_DATABASE=.*$~DB_DATABASE=$DB_DATABASE~" .env
sed -ri "s~^DB_USERNAME=.*$~DB_USERNAME=$DB_USERNAME~" .env
Expand All @@ -84,8 +99,14 @@ jobs:
sed -ri "s~^MAIL_PORT=.*$~MAIL_PORT=$MAIL_PORT~" .env
sed -ri "s~^MAIL_ENCRYPTION=.*$~MAIL_ENCRYPTION=$MAIL_ENCRYPTION~" .env
sed -ri "s~^MAIL_FROM_ADDRESS=.*$~MAIL_FROM_ADDRESS=$MAIL_FROM_ADDRESS~" .env
sed -ri "s~^MAIL_FROM_NAME=.*$~MAIL_FROM_NAME=$MAIL_FROM_NAME~" .env
sed -ri "s~^MAIL_FROM_NAME=.*\$~MAIL_FROM_NAME=\"$MAIL_FROM_NAME\"~" .env
sed -ri "s~^APP_KEY=.*$~APP_KEY=$APP_KEY~" .env
sed -ri "s~^CREDITOR_NAME=.*\$~CREDITOR_NAME=\"$CREDITOR_NAME\"~" .env
sed -ri "s~^CREDITOR_STREET=.*\$~CREDITOR_STREET=\"$CREDITOR_STREET\"~" .env
sed -ri "s~^CREDITOR_TOWN=.*\$~CREDITOR_TOWN=\"$CREDITOR_TOWN\"~" .env
sed -ri "s~^CREDITOR_ZIP=.*\$~CREDITOR_ZIP=\"$CREDITOR_ZIP\"~" .env
sed -ri "s~^CREDITOR_IBAN=.*\$~CREDITOR_IBAN=\"$CREDITOR_IBAN\"~" .env
sed -ri "s~^CREDITOR_EMAIL=.*\$~CREDITOR_EMAIL=\"$CREDITOR_EMAIL\"~" .env
- name: Deploy backend via SSH
env:
Expand Down Expand Up @@ -116,7 +137,7 @@ jobs:
SSH_SERVER: ${{ vars.SSH_SERVER }}
DEPLOY_PATH_BACKEND: ${{ vars.DEPLOY_PATH_BACKEND }}
run: |
ssh -i ~/.ssh/id_rsa $SSH_USERNAME@$SSH_SERVER "cd $DEPLOY_PATH_BACKEND && php artisan migrate --force"
ssh -i ~/.ssh/id_rsa $SSH_USERNAME@$SSH_SERVER "cd $DEPLOY_PATH_BACKEND && /usr/local/php83/bin/php artisan migrate --force"
- name: Optimize application
env:
Expand All @@ -125,4 +146,4 @@ jobs:
SSH_SERVER: ${{ vars.SSH_SERVER }}
DEPLOY_PATH_BACKEND: ${{ vars.DEPLOY_PATH_BACKEND }}
run: |
ssh -i ~/.ssh/id_rsa $SSH_USERNAME@$SSH_SERVER "cd $DEPLOY_PATH_BACKEND && php artisan config:cache && php artisan route:cache && php artisan view:cache"
ssh -i ~/.ssh/id_rsa $SSH_USERNAME@$SSH_SERVER "cd $DEPLOY_PATH_BACKEND && /usr/local/php83/bin/php artisan config:cache && /usr/local/php83/bin/php artisan route:cache && /usr/local/php83/bin/php artisan view:cache"
18 changes: 9 additions & 9 deletions .vitepress/components/BulkOrderForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ export default {
return {
success: false,
form: {
first_name: "Max",
last_name: "Mustermann",
pfadiname: "Frosch",
email: "[email protected]",
delivery_first_name: "Max",
delivery_last_name: "Mustermann",
delivery_street: "Bahnhofstrasse 41B",
delivery_zip: "8000",
delivery_town: "Zürich",
first_name: undefined,
last_name: undefined,
pfadiname: undefined,
email: undefined,
delivery_first_name: undefined,
delivery_last_name: undefined,
delivery_street: undefined,
delivery_zip: undefined,
delivery_town: undefined,
quantity: 20,
},
options: [
Expand Down
2 changes: 2 additions & 0 deletions api/config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,6 @@
'email' => env('CREDITOR_EMAIL', ''),
],

'frontend_url' => env('FRONTEND_URL', ''),

];
17 changes: 9 additions & 8 deletions api/env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
APP_NAME=Laravel
APP_ENV=local
APP_ENV=production
APP_KEY=
APP_DEBUG=true
APP_DEBUG=false
APP_TIMEZONE=UTC
APP_URL=http://localhost
FRONTEND_URL=localhost:8080

APP_LOCALE=de
APP_FALLBACK_LOCALE=en
Expand All @@ -26,12 +27,12 @@ CREDITOR_ZIP=""
CREDITOR_IBAN=""
CREDITOR_EMAIL=""

DB_CONNECTION=sqlite
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=laravel
# DB_USERNAME=root
# DB_PASSWORD=
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=



Expand Down
2 changes: 2 additions & 0 deletions api/public/.htaccess
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
AddHandler application/x-httpd-php83 .php

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
Expand Down
2 changes: 1 addition & 1 deletion api/routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
use Illuminate\Support\Facades\Route;

Route::get('/', function () {
return view('welcome');
return redirect(config('app.frontend_url'));
});

0 comments on commit 8b89f6c

Please sign in to comment.