From 17b85a4e5997cb0879cabd993c50adfbaaf733e1 Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Sat, 16 Nov 2024 00:48:28 +0700 Subject: [PATCH] fix: update blog admin installer --- README.md | 19 +++++++++++++------ runner.sh | 2 +- setup/functions.sh | 7 +++++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f15399e..7a650a5 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,12 @@ First, copy the `.env.example` file to `.env` and update the values. envsubst < .env.example > .env ``` +If you don't have `envsubst` command, you can use the following command: + +```bash +cp .env.example .env +``` + In the `.env` file, update the values to match your environment. ```bash @@ -60,9 +66,10 @@ Then, you can just run the following command to start the runner. The runner has the following commands: -| Command | Description | -|----------------|------------------------------| -| `help`, `tips` | Shows the help message | -| `build`, `b` | Builds the Blog | -| `worker`, `w` | Create or restart the worker | -| `all`, `a` | Runs all the commands | +| Command | Description | +|---------------------|------------------------------------------| +| `help`, `tips` | Shows the help message | +| `build`, `b` | Builds the Blog | +| `worker`, `w` | Create or restart the worker | +| `sync`, `blog_sync` | Sync the Blog with the remote repository | +| `all`, `a` | Runs all the commands | diff --git a/runner.sh b/runner.sh index 302f4a5..50d15d0 100755 --- a/runner.sh +++ b/runner.sh @@ -21,7 +21,7 @@ case "$1" in usage ;; - blog_sync) + blog_sync | sync) blog_sync "$2" ;; diff --git a/setup/functions.sh b/setup/functions.sh index eafbc6d..e9fbd86 100644 --- a/setup/functions.sh +++ b/setup/functions.sh @@ -84,7 +84,7 @@ node_runner() { # ======================================== build_admin() { - echo '⚙ Building blog API (Laravel)...' + echo '⚙ Building blog ADMIN/API (Laravel)...' if [ "$1" == "install" ]; then COMPOSER_COMMAND="install" @@ -96,13 +96,16 @@ build_admin() { if [ ! -f "$BLOG_ADMIN_DIR/.env" ]; then echo ' ∟ .env file missing, copying from .env.example...' - cp "$BLOG_ADMIN_DIR/.env.example" "$BLOG_ADMIN_DIR/.env" + cp "$BLOG_ADMIN_DIR/.env.production" "$BLOG_ADMIN_DIR/.env" composer $COMPOSER_COMMAND php artisan key:generate else composer $COMPOSER_COMMAND fi + echo ' ∟ Migrating database...' + php artisan migrate + echo '' }