mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
refactor(backend): separate push from seed and provide a pull script (#423)
This commit is contained in:
parent
e261d68534
commit
f80357e45f
2
.github/workflows/test.backend.seed.yml
vendored
2
.github/workflows/test.backend.seed.yml
vendored
@ -40,7 +40,7 @@ jobs:
|
|||||||
sudo chmod 777 -R ./data
|
sudo chmod 777 -R ./data
|
||||||
docker compose -f docker-compose.yml up -d
|
docker compose -f docker-compose.yml up -d
|
||||||
sleep 5
|
sleep 5
|
||||||
cd backend && ./seed.sh
|
cd backend && ./push.sh && ./seed.sh
|
||||||
working-directory: ${{env.WORKING_DIRECTORY}}
|
working-directory: ${{env.WORKING_DIRECTORY}}
|
||||||
|
|
||||||
#build-development:
|
#build-development:
|
||||||
|
|||||||
@ -6,6 +6,7 @@ To run the backend you can simply execute
|
|||||||
To fill in all required data execute the following commands in order:
|
To fill in all required data execute the following commands in order:
|
||||||
```
|
```
|
||||||
cd backend
|
cd backend
|
||||||
|
./push.sh
|
||||||
./seed.sh
|
./seed.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -22,6 +23,8 @@ npx directus-sync pull \
|
|||||||
--directus-password admin123
|
--directus-password admin123
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can run `./pull.sh` to run this command and modify it via `export PROJECT=...` for a different project configuration.
|
||||||
|
|
||||||
## Push Data from Harddrive to Docker
|
## Push Data from Harddrive to Docker
|
||||||
|
|
||||||
To push local changes or to seed directus use the following command
|
To push local changes or to seed directus use the following command
|
||||||
@ -33,6 +36,8 @@ npx directus-sync push \
|
|||||||
--directus-password admin123
|
--directus-password admin123
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can run `./push.sh` to run this command and modify it via `export PROJECT=...` for a different project configuration.
|
||||||
|
|
||||||
## Seed Data for local development
|
## Seed Data for local development
|
||||||
|
|
||||||
In order to seed the development data, run the script `backend/seed.sh`.
|
In order to seed the development data, run the script `backend/seed.sh`.
|
||||||
|
|||||||
24
backend/pull.sh
Executable file
24
backend/pull.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# base setup
|
||||||
|
SCRIPT_PATH=$(realpath $0)
|
||||||
|
SCRIPT_DIR=$(dirname $SCRIPT_PATH)
|
||||||
|
|
||||||
|
DIRECTUS_URL="${DIRECTUS_URL:-http://localhost:8055}"
|
||||||
|
DIRECTUS_EMAIL="${DIRECTUS_EMAIL:-admin@it4c.dev}"
|
||||||
|
DIRECTUS_PASSWORD="${DIRECTUS_PASSWORD:-admin123}"
|
||||||
|
|
||||||
|
PGPASSWORD="${PGPASSWORD:-'directus'}"
|
||||||
|
PGUSER="${PGUSER:-'directus'}"
|
||||||
|
PGDATABASE="${PGDATABASE:-'directus'}"
|
||||||
|
|
||||||
|
PROJECT_NAME="${PROJECT:-development}"
|
||||||
|
PROJECT_FOLDER=$SCRIPT_DIR/directus-config/$PROJECT_NAME
|
||||||
|
|
||||||
|
echo "Pull collections"
|
||||||
|
npx directus-sync@3.4.0 pull \
|
||||||
|
--dump-path $PROJECT_FOLDER \
|
||||||
|
--directus-url $DIRECTUS_URL \
|
||||||
|
--directus-email $DIRECTUS_EMAIL \
|
||||||
|
--directus-password $DIRECTUS_PASSWORD \
|
||||||
|
|| exit 1
|
||||||
24
backend/push.sh
Executable file
24
backend/push.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# base setup
|
||||||
|
SCRIPT_PATH=$(realpath $0)
|
||||||
|
SCRIPT_DIR=$(dirname $SCRIPT_PATH)
|
||||||
|
|
||||||
|
DIRECTUS_URL="${DIRECTUS_URL:-http://localhost:8055}"
|
||||||
|
DIRECTUS_EMAIL="${DIRECTUS_EMAIL:-admin@it4c.dev}"
|
||||||
|
DIRECTUS_PASSWORD="${DIRECTUS_PASSWORD:-admin123}"
|
||||||
|
|
||||||
|
PGPASSWORD="${PGPASSWORD:-'directus'}"
|
||||||
|
PGUSER="${PGUSER:-'directus'}"
|
||||||
|
PGDATABASE="${PGDATABASE:-'directus'}"
|
||||||
|
|
||||||
|
PROJECT_NAME="${PROJECT:-development}"
|
||||||
|
PROJECT_FOLDER=$SCRIPT_DIR/directus-config/$PROJECT_NAME
|
||||||
|
|
||||||
|
echo "Push collections"
|
||||||
|
npx directus-sync@3.4.0 push \
|
||||||
|
--dump-path $PROJECT_FOLDER \
|
||||||
|
--directus-url $DIRECTUS_URL \
|
||||||
|
--directus-email $DIRECTUS_EMAIL \
|
||||||
|
--directus-password $DIRECTUS_PASSWORD \
|
||||||
|
|| exit 1
|
||||||
@ -15,14 +15,6 @@ PGDATABASE="${PGDATABASE:-'directus'}"
|
|||||||
PROJECT_NAME="${PROJECT:-development}"
|
PROJECT_NAME="${PROJECT:-development}"
|
||||||
PROJECT_FOLDER=$SCRIPT_DIR/directus-config/$PROJECT_NAME
|
PROJECT_FOLDER=$SCRIPT_DIR/directus-config/$PROJECT_NAME
|
||||||
|
|
||||||
echo "Sync collections"
|
|
||||||
npx directus-sync@3.4.0 push \
|
|
||||||
--dump-path $PROJECT_FOLDER \
|
|
||||||
--directus-url $DIRECTUS_URL \
|
|
||||||
--directus-email $DIRECTUS_EMAIL \
|
|
||||||
--directus-password $DIRECTUS_PASSWORD \
|
|
||||||
|| exit 1
|
|
||||||
|
|
||||||
echo "Seed data"
|
echo "Seed data"
|
||||||
npx directus-sync@3.4.0 seed push \
|
npx directus-sync@3.4.0 seed push \
|
||||||
--seed-path $PROJECT_FOLDER/seed \
|
--seed-path $PROJECT_FOLDER/seed \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user