### Install Development Tools Source: https://github.com/nerves-hub/nerves_hub_web/blob/main/README.md Installs necessary development tools like Node.js and Erlang using asdf-vm. Ensure GPG is installed for Node.js key import. ```sh cd nerves_hub_web asdf plugin-add nodejs bash ~/.asdf/plugins/nodejs/bin/import-release-team-keyring # this requires gpg to be installed asdf install ``` -------------------------------- ### Install ssl tool on Mac OS Source: https://github.com/nerves-hub/nerves_hub_web/blob/main/test/fixtures/README.md Installs the `ssl` tool using Homebrew on Mac OS. Ensure you have Homebrew installed. ```sh brew install ssl ``` -------------------------------- ### Install System Dependencies (Debian/Ubuntu) Source: https://github.com/nerves-hub/nerves_hub_web/blob/main/README.md Installs inotify-tools on Debian/Ubuntu systems, which may be required for certain development functionalities. ```sh sudo apt install inotify-tools ``` -------------------------------- ### Setup Test Environment Dependencies Source: https://github.com/nerves-hub/nerves_hub_web/blob/main/README.md Fetches and compiles dependencies specifically for the test environment. Ensures that test-specific configurations are applied. ```sh MIX_ENV=test mix do deps.get, compile ``` -------------------------------- ### Start Phoenix Server Source: https://github.com/nerves-hub/nerves_hub_web/blob/main/README.md Starts the NervesHub Phoenix server for development. The application will be accessible at http://localhost:4000 by default. ```sh mix phx.server ``` -------------------------------- ### Install Web Assets Source: https://github.com/nerves-hub/nerves_hub_web/blob/main/README.md Compiles web assets for the application. This command requires Python 2 or a symlink for Python 3. ```sh mix assets.install ``` -------------------------------- ### Start Phoenix Server with IEx Source: https://github.com/nerves-hub/nerves_hub_web/blob/main/README.md Starts the NervesHub Phoenix server and attaches an interactive Elixir shell (IEx) for debugging and advanced interaction. ```sh iex -S mix phx.server ``` -------------------------------- ### Configure Local Host File Source: https://github.com/nerves-hub/nerves_hub_web/blob/main/README.md Adds a host record for 'nerves-hub.org' to the local /etc/hosts file, mapping it to 127.0.0.1 for local development and certificate validation. ```sh echo "127.0.0.1 nerves-hub.org" | sudo tee -a /etc/hosts ``` -------------------------------- ### Initialize Test Database Source: https://github.com/nerves-hub/nerves_hub_web/blob/main/README.md Resets and migrates the database for the test environment, ensuring a clean state for running tests. ```sh MIX_ENV=test mix ecto.migrate.reset ``` -------------------------------- ### Initialize Database Source: https://github.com/nerves-hub/nerves_hub_web/blob/main/README.md Resets the Ecto database, which is useful for development to ensure a clean state. ```sh mix ecto.reset ``` -------------------------------- ### Run Tests Source: https://github.com/nerves-hub/nerves_hub_web/blob/main/README.md Executes the test suite for the NervesHub application using the 'make test' command. ```sh make test ``` -------------------------------- ### Create Fake Client Certificate Source: https://github.com/nerves-hub/nerves_hub_web/blob/main/test/fixtures/README.md Generates a fake client certificate for negative unit tests. This certificate is signed by the fake CA and is used to test rejection scenarios. ```sh cd certs echo '{"CN":"device-fake","hosts":[],"key":{"algo":"ecdsa","size":256}}' | ssl gencert -ca=ca-fake.pem -ca-key=ca-fake-key.pem -config=../cert_config/ca-config.json -profile=client - | ssljson -bare device-fake ``` -------------------------------- ### Create Certificate Authority Source: https://github.com/nerves-hub/nerves_hub_web/blob/main/test/fixtures/README.md Initializes a new certificate authority (CA) using a CSR configuration file. The private key `ca-key.pem` should be stored securely. ```sh cd certs ssl gencert -initca ../cert_config/ca-csr.json | ssljson -bare ca - ``` -------------------------------- ### Fetch and Compile Dependencies Source: https://github.com/nerves-hub/nerves_hub_web/blob/main/README.md Fetches and compiles project dependencies using Mix. This is a standard step for Elixir projects. ```sh mix do deps.get, compile ``` -------------------------------- ### Generate Server Certificate Source: https://github.com/nerves-hub/nerves_hub_web/blob/main/test/fixtures/README.md Creates a server certificate signed by the CA. This requires the CA's certificate and private key, along with server-specific configuration. ```sh cd certs ssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=../cert_config/ca-config.json -profile=www ../cert_config/server.json | ssljson -bare server ``` -------------------------------- ### Create Fake Certificate Authority Source: https://github.com/nerves-hub/nerves_hub_web/blob/main/test/fixtures/README.md Generates a fake certificate authority for negative unit testing. This is used to ensure that invalid certificates are rejected. ```sh cd certs ssl gencert -initca ../cert_config/ca-csr.json | ssljson -bare ca-fake - ``` -------------------------------- ### Generate Client Certificate Source: https://github.com/nerves-hub/nerves_hub_web/blob/main/test/fixtures/README.md Generates a client certificate for a device, using the CA's credentials and a client profile. The Common Name (CN) in the JSON payload will be used as the device's serial number on the server. ```sh cd certs echo '{"CN":"device-1234","hosts":[],"key":{"algo":"ecdsa","size":256}}' | ssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=../cert_config/ca-config.json -profile=client - | ssljson -bare device-1234 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.