TripleParity / docks-api

RESTful API Server for Docks
https://tripleparity.github.io/docks-api/stack-api-spec.html
GNU General Public License v3.0
0 stars 0 forks source link
docker express nodejs

Docks API

Docks API provides authentication and additional functionality over the Docker API

For information on deploying Docks view the docks repository.

Features

Configuration

By default Docks API listens on *:8080. This can be configured in docker-compose.yml

Environment Variables

Docks API can be configured using the following environment variables:

Deployment

Requirements

The latest version of Docks API can be deployed as follows

git clone https://github.com/TripleParity/docks-ui

sudo docker swarm init
sudo docker stack deploy -c docker-compose.yml docks-api

Development

Using Node.js and Docker

Please see the security implications of managing Docker as a non-root user

# Required to communicate with the Docker socket
# without running npm as root
sudo usermod -aG docker $USER

# Log out and log back in or restart so that your group membership is re-evaluated.

docker swarm init

# Deploy postgres database
docker stack deploy -c docker-compose/db.yml docks-db

# Install required packages and tools
npm install

# Perform migrations on development database
npm run dev-migrate-db

# Run Docks API from source and export env variables
npm run start-dev-db

Using only Docker

If you use the included Docker file for development, there is no need to install NodeJS on your local machine.

The included Development docker-compose file will run the Docks API on port 8080:

$ docker-compose -f docker-compose.development.yml up --build

Note: currently, the development container will set the ownership of the node_modules folder and all installed packages to root if they don't exist (pure Docker workflow). This will break things if you decide to run the project locally instead of purely with Docker since the container could have a different Node version.

Testing

Unit Tests

Unit tests are defined in the spec folder and can be run with:

npm run test

Integration Testing

By default the integration tests are run against http://127.0.0.1:8080 using the command npm run jest.

This requires the Docks API server and database to be running.

Docks API can be hosted as described in Using Node.js and Docker for development or the entire stack can be built and deployed with Docker using ./integration-test.sh