Merge pull request #893 from tobiasge/startup-scripts-complete-removal
Startup scripts complete removal
This commit is contained in:
commit
b72084290a
1
.github/workflows/push.yml
vendored
1
.github/workflows/push.yml
vendored
@ -31,6 +31,7 @@ jobs:
|
|||||||
LINTER_RULES_PATH: /
|
LINTER_RULES_PATH: /
|
||||||
VALIDATE_ALL_CODEBASE: false
|
VALIDATE_ALL_CODEBASE: false
|
||||||
VALIDATE_DOCKERFILE: false
|
VALIDATE_DOCKERFILE: false
|
||||||
|
VALIDATE_GITLEAKS: false
|
||||||
FILTER_REGEX_EXCLUDE: (.*/)?(LICENSE|configuration/.*)
|
FILTER_REGEX_EXCLUDE: (.*/)?(LICENSE|configuration/.*)
|
||||||
EDITORCONFIG_FILE_NAME: .ecrc
|
EDITORCONFIG_FILE_NAME: .ecrc
|
||||||
DOCKERFILE_HADOLINT_FILE_NAME: .hadolint.yaml
|
DOCKERFILE_HADOLINT_FILE_NAME: .hadolint.yaml
|
||||||
|
@ -3,12 +3,13 @@ services:
|
|||||||
netbox:
|
netbox:
|
||||||
image: ${IMAGE-netboxcommunity/netbox:latest}
|
image: ${IMAGE-netboxcommunity/netbox:latest}
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
postgres:
|
||||||
- redis
|
condition: service_healthy
|
||||||
- redis-cache
|
redis:
|
||||||
|
condition: service_started
|
||||||
|
redis-cache:
|
||||||
|
condition: service_started
|
||||||
env_file: env/netbox.env
|
env_file: env/netbox.env
|
||||||
environment:
|
|
||||||
SKIP_STARTUP_SCRIPTS: ${SKIP_STARTUP_SCRIPTS-false}
|
|
||||||
user: 'unit:root'
|
user: 'unit:root'
|
||||||
volumes:
|
volumes:
|
||||||
- ./configuration:/etc/netbox/config:z,ro
|
- ./configuration:/etc/netbox/config:z,ro
|
||||||
@ -19,6 +20,11 @@ services:
|
|||||||
postgres:
|
postgres:
|
||||||
image: postgres:15-alpine
|
image: postgres:15-alpine
|
||||||
env_file: env/postgres.env
|
env_file: env/postgres.env
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
redis:
|
redis:
|
||||||
image: redis:7-alpine
|
image: redis:7-alpine
|
||||||
command:
|
command:
|
||||||
|
@ -80,15 +80,6 @@ END
|
|||||||
echo "💡 Superuser Username: ${SUPERUSER_NAME}, E-Mail: ${SUPERUSER_EMAIL}"
|
echo "💡 Superuser Username: ${SUPERUSER_NAME}, E-Mail: ${SUPERUSER_EMAIL}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Print warning if startup scripts (and initializers) would've been run # Remove for next release
|
|
||||||
if [ "$SKIP_STARTUP_SCRIPTS" == "true" ]; then
|
|
||||||
# Nothing to do
|
|
||||||
echo "" # Empty block not allowed
|
|
||||||
else
|
|
||||||
echo "⚠️⚠️⚠️ WARNING: The initializers have been moved to a plugin. See release notes."
|
|
||||||
echo "⚠️⚠️⚠️ Set environment variable 'SKIP_STARTUP_SCRIPTS' to 'true' to remove this warning."
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "✅ Initialisation is done."
|
echo "✅ Initialisation is done."
|
||||||
|
|
||||||
# Launch whatever is passed by docker
|
# Launch whatever is passed by docker
|
||||||
|
14
test.sh
14
test.sh
@ -35,10 +35,14 @@ if [ -z "${IMAGE}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# The docker compose command to use
|
# The docker compose command to use
|
||||||
doco="docker-compose --file docker-compose.test.yml --project-name netbox_docker_test_${1}"
|
doco="docker compose --file docker-compose.test.yml --project-name netbox_docker_test"
|
||||||
|
|
||||||
test_setup() {
|
test_setup() {
|
||||||
echo "🏗 Setup up test environment"
|
echo "🏗 Setup up test environment"
|
||||||
|
$doco up --detach --quiet-pull --wait --force-recreate --renew-anon-volumes --no-start
|
||||||
|
$doco start postgres
|
||||||
|
$doco start redis
|
||||||
|
$doco start redis-cache
|
||||||
}
|
}
|
||||||
|
|
||||||
test_netbox_unit_tests() {
|
test_netbox_unit_tests() {
|
||||||
@ -46,9 +50,14 @@ test_netbox_unit_tests() {
|
|||||||
$doco run --rm netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py test
|
$doco run --rm netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py test
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test_compose_db_setup() {
|
||||||
|
echo "⏱ Running NetBox DB migrations"
|
||||||
|
$doco run --rm netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py migrate
|
||||||
|
}
|
||||||
|
|
||||||
test_cleanup() {
|
test_cleanup() {
|
||||||
echo "💣 Cleaning Up"
|
echo "💣 Cleaning Up"
|
||||||
$doco down -v
|
$doco down --volumes
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "🐳🐳🐳 Start testing '${IMAGE}'"
|
echo "🐳🐳🐳 Start testing '${IMAGE}'"
|
||||||
@ -58,5 +67,6 @@ trap test_cleanup EXIT ERR
|
|||||||
test_setup
|
test_setup
|
||||||
|
|
||||||
test_netbox_unit_tests
|
test_netbox_unit_tests
|
||||||
|
test_compose_db_setup
|
||||||
|
|
||||||
echo "🐳🐳🐳 Done testing '${IMAGE}'"
|
echo "🐳🐳🐳 Done testing '${IMAGE}'"
|
||||||
|
Loading…
Reference in New Issue
Block a user