|
49 | 49 | description: 'Absolute path of the SQL dump ON THE DEV MACHINE (used only when IMPORT is checked)' |
50 | 50 | required: false |
51 | 51 | type: string |
52 | | - default: '/opt/dspace-envs/8603/dspace_dev5_dump_26.07.16.sql' |
| 52 | + default: '/opt/dspace-envs/8603/dump/dspace_dev5_dump_26.07.16.sql' |
| 53 | + PROBE_ONLY: |
| 54 | + description: 'Only report the state of the target machine; deploy and import nothing' |
| 55 | + required: false |
| 56 | + default: false |
| 57 | + type: boolean |
53 | 58 |
|
54 | 59 | jobs: |
55 | | - deploy-8603: |
56 | | - if: inputs.INSTANCE == '*' || inputs.INSTANCE == '8603' |
| 60 | + # Read-only report of the machine we are about to touch. Runs first so that a |
| 61 | + # misconfigured target is visible in the log even when the deploy then fails. |
| 62 | + probe: |
57 | 63 | runs-on: dspace-${{inputs.DEV_MACHINE}}-dep-1 |
58 | | - timeout-minutes: 60 |
| 64 | + timeout-minutes: 10 |
59 | 65 | env: |
60 | | - INSTANCE: '8603' |
| 66 | + INSTANCE: ${{inputs.INSTANCE}} |
61 | 67 | CONFIG_PATH: /opt/dspace-envs/${{inputs.INSTANCE}} |
62 | 68 | ENVFILE: /opt/dspace-envs/${{inputs.INSTANCE}}/.env |
63 | 69 | steps: |
64 | 70 | - uses: actions/checkout@v6 |
65 | 71 |
|
66 | | - # Report the environment we are about to deploy into. Everything here is |
67 | | - # tolerant of failure: it must never be the reason a deploy goes red. |
68 | | - - name: probe environment |
| 72 | + - name: config dir + dump |
69 | 73 | run: | |
70 | 74 | echo "===== $CONFIG_PATH" |
71 | 75 | ls -la "$CONFIG_PATH/" || echo "MISSING: $CONFIG_PATH" |
72 | | - echo "===== .env keys (values redacted)" |
73 | | - sed 's/=.*/=<redacted>/' "$ENVFILE" || echo "MISSING: $ENVFILE" |
74 | | - echo "===== containers for instance $INSTANCE" |
75 | | - docker ps -a --format '{{.Names}}\t{{.Image}}\t{{.Status}}' | grep -E "${INSTANCE}" || echo "no containers matching $INSTANCE" |
76 | | - echo "===== postgres port inside dspacedb$INSTANCE" |
77 | | - docker exec dspacedb$INSTANCE sh -c 'echo "PGPORT=$PGPORT"; pg_isready -U dspace; psql -U dspace -d postgres -tAc "SHOW port;" 2>/dev/null' || echo "could not probe dspacedb$INSTANCE" |
78 | | - echo "===== dump file" |
| 76 | + echo "===== $CONFIG_PATH/dump" |
| 77 | + ls -la "$CONFIG_PATH/dump/" || echo "MISSING: $CONFIG_PATH/dump" |
| 78 | + echo "===== dump referenced by DUMP_PATH input" |
79 | 79 | ls -la "${{ inputs.DUMP_PATH }}" || echo "MISSING dump: ${{ inputs.DUMP_PATH }}" |
| 80 | + echo "===== port-ish keys from .env (values shown; these are ports, not secrets)" |
| 81 | + grep -E '^(PG_PORT|SOLR_PORT|DSPACE_PORT|DSPACE_FE_PORT|DSPACE_REST_PORT|DSPACE_DOCKER_REST_PORT|DSPACE_VER|DSPACE_HOST)=' "$ENVFILE" || echo "no port keys found" |
| 82 | +
|
| 83 | + - name: who owns the host ports |
| 84 | + run: | |
| 85 | + echo "===== all dspace-ish containers and their published ports" |
| 86 | + docker ps -a --format '{{.Names}}\t{{.Status}}\t{{.Ports}}' | grep -Ei 'dspace|postgres|solr' || echo "none" |
| 87 | + echo "===== anything publishing host port 5432" |
| 88 | + docker ps --format '{{.Names}}\t{{.Ports}}' | grep -E '(^|[^0-9])5432->' || echo "nothing publishes 5432" |
| 89 | + echo "===== host listeners on 5432" |
| 90 | + (ss -lntp 2>/dev/null || netstat -lntp 2>/dev/null) | grep -E ':5432' || echo "no listener on 5432 (or no permission to see it)" |
| 91 | +
|
| 92 | + - name: resolved compose ports for this instance |
| 93 | + run: | |
| 94 | + echo "===== merged compose config (dspacedb ports) for -p dspace-$INSTANCE" |
| 95 | + docker compose --env-file "$ENVFILE" -p dspace-$INSTANCE \ |
| 96 | + -f docker/docker-compose.yml -f docker/docker-compose-rest.yml \ |
| 97 | + -f "$CONFIG_PATH/docker-compose-rest.yml" -f "$CONFIG_PATH/docker-compose.yml" \ |
| 98 | + config 2>&1 | grep -nE '^ [a-z-]+:|container_name:|published:|target:|^\s+ports:' | head -60 \ |
| 99 | + || echo "compose config failed" |
| 100 | + echo "===== what start.sh alone would publish (NO instance overlay)" |
| 101 | + docker compose --env-file "$ENVFILE" -p dspace-$INSTANCE \ |
| 102 | + -f docker/docker-compose.yml -f docker/docker-compose-rest.yml \ |
| 103 | + config 2>&1 | grep -nE '^ [a-z-]+:|container_name:|published:|target:|^\s+ports:' | head -40 \ |
| 104 | + || echo "compose config failed" |
| 105 | +
|
| 106 | + - name: postgres inside the instance db container |
| 107 | + run: | |
| 108 | + docker exec dspacedb$INSTANCE sh -c 'echo "PGPORT=$PGPORT"; pg_isready -U dspace; psql -U dspace -d postgres -tAc "SHOW port;" 2>/dev/null' || echo "could not probe dspacedb$INSTANCE" |
| 109 | +
|
| 110 | + deploy-8603: |
| 111 | + if: (inputs.INSTANCE == '*' || inputs.INSTANCE == '8603') && !inputs.PROBE_ONLY |
| 112 | + needs: probe |
| 113 | + runs-on: dspace-${{inputs.DEV_MACHINE}}-dep-1 |
| 114 | + timeout-minutes: 60 |
| 115 | + env: |
| 116 | + INSTANCE: '8603' |
| 117 | + CONFIG_PATH: /opt/dspace-envs/${{inputs.INSTANCE}} |
| 118 | + ENVFILE: /opt/dspace-envs/${{inputs.INSTANCE}}/.env |
| 119 | + steps: |
| 120 | + - uses: actions/checkout@v6 |
80 | 121 |
|
81 | 122 | - uses: ./.github/actions/erase-db |
82 | 123 | if: inputs.ERASE_DB |
|
0 commit comments