A PHP client for connecting the National Alert Aggregation & Dissemination (NAAD) System via TCP socket to a REST API.
To run in the devcontainer (see .devcontainer/ directory):
- Install the Dev Containers VSCode extension.
- Run
cp .devcontainer/sample.override.env .devcontainer/override.env
and add/remove any env variable overrides you need based on your environment.- Note: this step can be skipped if you do'ot need to override any env variables.
- View > Command Palette... > Dev Containers: Reopen in Container
- VSCode should relaunch and the terminal should look like this:
vscode ➜ /workspaces/naad-connector
- This terminal should allow most commands to be run without any further dev environment setup:
php src/start.php
to start the applicationcomposer test
to run unit testscomposer test-coverage
to generate unit test coverage reportscomposer phpcs
to run lintingcomposer migrate
to run database migrationscomposer phpdoc
to generate project documentation
- Prerequisites: rename the
./sample-env
to.env
and fill in the values for local use only.
# build and run
docker compose up --build
# run using known good app image build
docker compose up
To build and run in Kubernetes via Docker Desktop, follow these steps:
kubectl config use-context docker-desktop
docker build -t bcgovgdx/naad-app .
kubectl apply -k deployments/kustomize/overlays/local
# or use composer instead:
composer k8s-start
Note: Kubernetes must be enabled in Docker Desktop.
Stopping (deleting) all pods will destroy all alerts in the database. To stop all pods, run:
kubectl delete -k deployments/kustomize/overlays/local
# or use composer instead:
composer k8s-delete
After deployment, PHPMyAdmin will be accessible at the following local addresses:
- Docker Compose: http://0.0.0.0:8080
- Kubernetes: http://0.0.0.0:31008
Note: You may need to use Firefox or Safari to access this as Chrome may block this address due to it not using https.
# Change to the correct namespace
oc project 12345-tools
# Apply the image builds configuration
oc apply -k deployments/kustomize/image-builds --namespace=12345-tools
# Start the build process and follow the output
oc start-build naad-app --follow --namespace=12345-tools
# Change to the correct namespace
oc project 12345-tools
# Apply the base configuration
oc apply -k deployments/kustomize/base --namespace=12345-tools
The only command you need is composer phpdoc
. It runs a script that pulls and runs the phpdoc container, generates documentation, and opens a browser so you can view it assuming you run the command from the root directory of your project.
To configure the phpdoc further, look at phpdoc.dist.xml
in the root directory of the project. For now it only determines the output folder /docs
where the index.html
is found, and the source folder(s) where the code that will be documented is found.
To view the documentation, you can use one of the following methods:
- Run
composer phpdoc-view
- Navigate to
./docs
in your console and typeopen index.html