chore: cms sync
This commit is contained in:
@@ -126,9 +126,9 @@ fields:
|
|||||||
schema:
|
schema:
|
||||||
name: id
|
name: id
|
||||||
table: client_users
|
table: client_users
|
||||||
data_type: char
|
data_type: uuid
|
||||||
default_value: null
|
default_value: null
|
||||||
max_length: 36
|
max_length: null
|
||||||
numeric_precision: null
|
numeric_precision: null
|
||||||
numeric_scale: null
|
numeric_scale: null
|
||||||
is_nullable: false
|
is_nullable: false
|
||||||
@@ -304,7 +304,7 @@ fields:
|
|||||||
foreign_key_column: null
|
foreign_key_column: null
|
||||||
- collection: client_users
|
- collection: client_users
|
||||||
field: company
|
field: company
|
||||||
type: string
|
type: uuid
|
||||||
meta:
|
meta:
|
||||||
collection: client_users
|
collection: client_users
|
||||||
conditions: null
|
conditions: null
|
||||||
@@ -328,9 +328,9 @@ fields:
|
|||||||
schema:
|
schema:
|
||||||
name: company
|
name: company
|
||||||
table: client_users
|
table: client_users
|
||||||
data_type: char
|
data_type: uuid
|
||||||
default_value: null
|
default_value: null
|
||||||
max_length: 36
|
max_length: null
|
||||||
numeric_precision: null
|
numeric_precision: null
|
||||||
numeric_scale: null
|
numeric_scale: null
|
||||||
is_nullable: true
|
is_nullable: true
|
||||||
@@ -450,9 +450,9 @@ fields:
|
|||||||
schema:
|
schema:
|
||||||
name: id
|
name: id
|
||||||
table: companies
|
table: companies
|
||||||
data_type: char
|
data_type: uuid
|
||||||
default_value: null
|
default_value: null
|
||||||
max_length: 36
|
max_length: null
|
||||||
numeric_precision: null
|
numeric_precision: null
|
||||||
numeric_scale: null
|
numeric_scale: null
|
||||||
is_nullable: false
|
is_nullable: false
|
||||||
@@ -617,7 +617,7 @@ fields:
|
|||||||
width: full
|
width: full
|
||||||
- collection: directus_users
|
- collection: directus_users
|
||||||
field: company
|
field: company
|
||||||
type: string
|
type: uuid
|
||||||
meta:
|
meta:
|
||||||
collection: directus_users
|
collection: directus_users
|
||||||
conditions: null
|
conditions: null
|
||||||
@@ -641,9 +641,9 @@ fields:
|
|||||||
schema:
|
schema:
|
||||||
name: company
|
name: company
|
||||||
table: directus_users
|
table: directus_users
|
||||||
data_type: char
|
data_type: uuid
|
||||||
default_value: null
|
default_value: null
|
||||||
max_length: 36
|
max_length: null
|
||||||
numeric_precision: null
|
numeric_precision: null
|
||||||
numeric_scale: null
|
numeric_scale: null
|
||||||
is_nullable: true
|
is_nullable: true
|
||||||
@@ -869,7 +869,7 @@ fields:
|
|||||||
foreign_key_column: null
|
foreign_key_column: null
|
||||||
- collection: visual_feedback
|
- collection: visual_feedback
|
||||||
field: user_created
|
field: user_created
|
||||||
type: string
|
type: uuid
|
||||||
meta:
|
meta:
|
||||||
collection: visual_feedback
|
collection: visual_feedback
|
||||||
conditions: null
|
conditions: null
|
||||||
@@ -894,9 +894,9 @@ fields:
|
|||||||
schema:
|
schema:
|
||||||
name: user_created
|
name: user_created
|
||||||
table: visual_feedback
|
table: visual_feedback
|
||||||
data_type: char
|
data_type: uuid
|
||||||
default_value: null
|
default_value: null
|
||||||
max_length: 36
|
max_length: null
|
||||||
numeric_precision: null
|
numeric_precision: null
|
||||||
numeric_scale: null
|
numeric_scale: null
|
||||||
is_nullable: true
|
is_nullable: true
|
||||||
@@ -934,9 +934,9 @@ fields:
|
|||||||
schema:
|
schema:
|
||||||
name: screenshot
|
name: screenshot
|
||||||
table: visual_feedback
|
table: visual_feedback
|
||||||
data_type: char
|
data_type: uuid
|
||||||
default_value: null
|
default_value: null
|
||||||
max_length: 36
|
max_length: null
|
||||||
numeric_precision: null
|
numeric_precision: null
|
||||||
numeric_scale: null
|
numeric_scale: null
|
||||||
is_nullable: true
|
is_nullable: true
|
||||||
@@ -950,7 +950,7 @@ fields:
|
|||||||
foreign_key_column: null
|
foreign_key_column: null
|
||||||
- collection: visual_feedback
|
- collection: visual_feedback
|
||||||
field: company
|
field: company
|
||||||
type: string
|
type: uuid
|
||||||
meta:
|
meta:
|
||||||
collection: visual_feedback
|
collection: visual_feedback
|
||||||
conditions: null
|
conditions: null
|
||||||
@@ -974,9 +974,9 @@ fields:
|
|||||||
schema:
|
schema:
|
||||||
name: company
|
name: company
|
||||||
table: visual_feedback
|
table: visual_feedback
|
||||||
data_type: char
|
data_type: uuid
|
||||||
default_value: null
|
default_value: null
|
||||||
max_length: 36
|
max_length: null
|
||||||
numeric_precision: null
|
numeric_precision: null
|
||||||
numeric_scale: null
|
numeric_scale: null
|
||||||
is_nullable: true
|
is_nullable: true
|
||||||
@@ -1072,7 +1072,7 @@ fields:
|
|||||||
foreign_key_column: null
|
foreign_key_column: null
|
||||||
- collection: visual_feedback_comments
|
- collection: visual_feedback_comments
|
||||||
field: user_created
|
field: user_created
|
||||||
type: string
|
type: uuid
|
||||||
meta:
|
meta:
|
||||||
collection: visual_feedback_comments
|
collection: visual_feedback_comments
|
||||||
conditions: null
|
conditions: null
|
||||||
@@ -1097,9 +1097,9 @@ fields:
|
|||||||
schema:
|
schema:
|
||||||
name: user_created
|
name: user_created
|
||||||
table: visual_feedback_comments
|
table: visual_feedback_comments
|
||||||
data_type: char
|
data_type: uuid
|
||||||
default_value: null
|
default_value: null
|
||||||
max_length: 36
|
max_length: null
|
||||||
numeric_precision: null
|
numeric_precision: null
|
||||||
numeric_scale: null
|
numeric_scale: null
|
||||||
is_nullable: true
|
is_nullable: true
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
PROJECT="infra-cms"
|
PROJECT="infra-cms"
|
||||||
SCHEMA_PATH="./packages/cms-infra/schema/snapshot.yaml"
|
LOCAL_SCHEMA_PATH="./packages/cms-infra/schema/snapshot.yaml"
|
||||||
CMD_PREFIX="docker-compose -f packages/cms-infra/docker-compose.yml"
|
|
||||||
REMOTE_HOST="root@infra.mintel.me"
|
REMOTE_HOST="root@infra.mintel.me"
|
||||||
REMOTE_DIR="/opt/infra/directus"
|
REMOTE_DIR="/opt/infra/directus"
|
||||||
|
|
||||||
@@ -16,7 +15,6 @@ fi
|
|||||||
|
|
||||||
case $ENV in
|
case $ENV in
|
||||||
local)
|
local)
|
||||||
# Default to infra-cms package for at-mintel
|
|
||||||
PROJECT="infra-cms"
|
PROJECT="infra-cms"
|
||||||
CMD_PREFIX="docker-compose -f packages/cms-infra/docker-compose.yml"
|
CMD_PREFIX="docker-compose -f packages/cms-infra/docker-compose.yml"
|
||||||
|
|
||||||
@@ -31,26 +29,33 @@ case $ENV in
|
|||||||
;;
|
;;
|
||||||
infra)
|
infra)
|
||||||
# 'infra' is the remote production server for at-mintel
|
# 'infra' is the remote production server for at-mintel
|
||||||
PROJECT="directus" # Remote project name is usually 'directus' in docker-compose
|
PROJECT="directus" # Remote project name
|
||||||
|
|
||||||
echo "📤 Uploading snapshot to REMOTE $ENV..."
|
|
||||||
# Ensure remote directory exists
|
|
||||||
ssh "$REMOTE_HOST" "mkdir -p $REMOTE_DIR/directus/schema"
|
|
||||||
scp ./packages/cms-infra/schema/snapshot.yaml "$REMOTE_HOST:$REMOTE_DIR/directus/schema/snapshot.yaml"
|
|
||||||
|
|
||||||
echo "🔍 Detecting remote container..."
|
echo "🔍 Detecting remote container..."
|
||||||
REMOTE_CONTAINER=$(ssh "$REMOTE_HOST" "cd $REMOTE_DIR && docker compose -p $PROJECT ps -q directus")
|
REMOTE_CONTAINER=$(ssh "$REMOTE_HOST" "docker ps --filter label=com.docker.compose.project=$PROJECT --filter label=com.docker.compose.service=directus -q")
|
||||||
|
|
||||||
|
if [ -z "$REMOTE_CONTAINER" ]; then
|
||||||
|
# Fallback to older name if labels fail
|
||||||
|
REMOTE_CONTAINER=$(ssh "$REMOTE_HOST" "docker ps -f name=directus-directus-1 -q")
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$REMOTE_CONTAINER" ]; then
|
if [ -z "$REMOTE_CONTAINER" ]; then
|
||||||
echo "❌ Remote container for $ENV not found."
|
echo "❌ Remote container for $ENV not found."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "📤 Injecting snapshot directly into container $REMOTE_CONTAINER..."
|
||||||
|
# Inject file via stdin to avoid needing a host-side mount or scp path matching
|
||||||
|
ssh "$REMOTE_HOST" "docker exec -i $REMOTE_CONTAINER sh -c 'cat > /tmp/snapshot.yaml'" < "$LOCAL_SCHEMA_PATH"
|
||||||
|
|
||||||
echo "🚀 Applying schema to REMOTE $ENV..."
|
echo "🚀 Applying schema to REMOTE $ENV..."
|
||||||
ssh "$REMOTE_HOST" "docker exec $REMOTE_CONTAINER npx directus schema apply -y /directus/schema/snapshot.yaml"
|
ssh "$REMOTE_HOST" "docker exec $REMOTE_CONTAINER npx directus schema apply -y /tmp/snapshot.yaml"
|
||||||
|
|
||||||
echo "🔄 Restarting remote Directus to clear cache..."
|
echo "🔄 Restarting remote Directus to clear cache..."
|
||||||
ssh "$REMOTE_HOST" "cd $REMOTE_DIR && docker compose -p $PROJECT restart directus"
|
ssh "$REMOTE_HOST" "cd $REMOTE_DIR && docker compose restart directus"
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
ssh "$REMOTE_HOST" "docker exec $REMOTE_CONTAINER rm /tmp/snapshot.yaml"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "❌ Invalid environment: $ENV. Supported: local, infra."
|
echo "❌ Invalid environment: $ENV. Supported: local, infra."
|
||||||
|
|||||||
Reference in New Issue
Block a user