Updated pipeline
This commit is contained in:
@@ -9,6 +9,9 @@ stages:
|
|||||||
- verify
|
- verify
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
|
# Use stable clone path instead of runner-specific path
|
||||||
|
GIT_CLONE_PATH: $CI_BUILDS_DIR/motovaultpro
|
||||||
|
DEPLOY_PATH: $CI_BUILDS_DIR/motovaultpro
|
||||||
DOCKER_COMPOSE_FILE: docker-compose.yml
|
DOCKER_COMPOSE_FILE: docker-compose.yml
|
||||||
DOCKER_COMPOSE_PROD_FILE: docker-compose.prod.yml
|
DOCKER_COMPOSE_PROD_FILE: docker-compose.prod.yml
|
||||||
|
|
||||||
@@ -44,9 +47,6 @@ build:
|
|||||||
- echo "Building Docker images..."
|
- echo "Building Docker images..."
|
||||||
- echo "=========================================="
|
- echo "=========================================="
|
||||||
- cd "$DEPLOY_PATH"
|
- cd "$DEPLOY_PATH"
|
||||||
- echo "Pulling latest code..."
|
|
||||||
- git fetch origin main
|
|
||||||
- git reset --hard origin/main
|
|
||||||
- echo "Building images..."
|
- echo "Building images..."
|
||||||
- docker compose -f $DOCKER_COMPOSE_FILE build --no-cache
|
- docker compose -f $DOCKER_COMPOSE_FILE build --no-cache
|
||||||
- echo "=========================================="
|
- echo "=========================================="
|
||||||
|
|||||||
@@ -91,11 +91,12 @@ These variables use GitLab's **File** type, which writes the value to a temporar
|
|||||||
|
|
||||||
| Variable Name | Type | Protected | Masked | Value |
|
| Variable Name | Type | Protected | Masked | Value |
|
||||||
|--------------|------|-----------|--------|-------|
|
|--------------|------|-----------|--------|-------|
|
||||||
| `DEPLOY_PATH` | Variable | No | No | `/opt/motovaultpro` |
|
|
||||||
| `VITE_AUTH0_DOMAIN` | Variable | No | No | `motovaultpro.us.auth0.com` |
|
| `VITE_AUTH0_DOMAIN` | Variable | No | No | `motovaultpro.us.auth0.com` |
|
||||||
| `VITE_AUTH0_CLIENT_ID` | Variable | No | No | Your Auth0 client ID |
|
| `VITE_AUTH0_CLIENT_ID` | Variable | No | No | Your Auth0 client ID |
|
||||||
| `VITE_AUTH0_AUDIENCE` | Variable | No | No | `https://api.motovaultpro.com` |
|
| `VITE_AUTH0_AUDIENCE` | Variable | No | No | `https://api.motovaultpro.com` |
|
||||||
|
|
||||||
|
Note: `DEPLOY_PATH` is automatically set in `.gitlab-ci.yml` using `GIT_CLONE_PATH` for a stable path.
|
||||||
|
|
||||||
### Setting Up a File Type Variable
|
### Setting Up a File Type Variable
|
||||||
|
|
||||||
1. Go to **Settings > CI/CD > Variables**
|
1. Go to **Settings > CI/CD > Variables**
|
||||||
@@ -448,10 +449,12 @@ curl http://localhost:3001/health
|
|||||||
|
|
||||||
| Path | Description |
|
| Path | Description |
|
||||||
|------|-------------|
|
|------|-------------|
|
||||||
| `/opt/motovaultpro` | Application root |
|
| `$CI_BUILDS_DIR/motovaultpro` | Application root (stable clone path) |
|
||||||
| `/opt/motovaultpro/secrets/app/` | Secrets directory |
|
| `$CI_BUILDS_DIR/motovaultpro/secrets/app/` | Secrets directory |
|
||||||
| `/opt/motovaultpro/data/documents/` | Document storage |
|
| `$CI_BUILDS_DIR/motovaultpro/data/documents/` | Document storage |
|
||||||
| `/opt/motovaultpro/config/` | Configuration files |
|
| `$CI_BUILDS_DIR/motovaultpro/config/` | Configuration files |
|
||||||
|
|
||||||
|
Note: `CI_BUILDS_DIR` is typically `/opt/gitlab-runner/builds` for shell executors.
|
||||||
|
|
||||||
### Container Names
|
### Container Names
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,11 @@ echo "Injecting secrets..."
|
|||||||
echo " Deploy path: $DEPLOY_PATH"
|
echo " Deploy path: $DEPLOY_PATH"
|
||||||
echo " Secrets dir: $SECRETS_DIR"
|
echo " Secrets dir: $SECRETS_DIR"
|
||||||
|
|
||||||
# Create secrets directory if it doesn't exist
|
# Clean up any incorrectly created directories and create secrets directory
|
||||||
|
if [ -e "$SECRETS_DIR" ] && [ ! -d "$SECRETS_DIR" ]; then
|
||||||
|
echo " Removing invalid secrets path..."
|
||||||
|
rm -rf "$SECRETS_DIR"
|
||||||
|
fi
|
||||||
mkdir -p "$SECRETS_DIR"
|
mkdir -p "$SECRETS_DIR"
|
||||||
chmod 700 "$SECRETS_DIR"
|
chmod 700 "$SECRETS_DIR"
|
||||||
|
|
||||||
@@ -48,6 +52,11 @@ inject_secret() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Remove if exists as directory (cleanup from bad previous runs)
|
||||||
|
if [ -d "$target_path" ]; then
|
||||||
|
rm -rf "$target_path"
|
||||||
|
fi
|
||||||
|
|
||||||
# Copy the secret file
|
# Copy the secret file
|
||||||
cp "$source_path" "$target_path"
|
cp "$source_path" "$target_path"
|
||||||
chmod 600 "$target_path"
|
chmod 600 "$target_path"
|
||||||
|
|||||||
Reference in New Issue
Block a user