🌐 API Instance¶
The Meerschaum API instance (and Web Console) lets you manage pipes, jobs, and connectors over the Internet. Start the API server with the stack or via start api; see Deployment below for ways to run Meerschaum in production.
Usage¶
Starting the Meerschaum API server lets you treat your host as the following:
- API instance
For managing pipes. - Plugin repository
For storing plugins. - Remote executor
For running jobs.
Adding Connectors¶
Add new api connectors with bootstrap connector or declaring an environment connector:
1 2 | |
Remote Actions¶
Add -e to client commands to execute them remotely on your API instance:
1 | |
When running the mrsm shell, the executor command allows you to temporarily run all the commands in your session remotely (like the instance command):
1 | |
API Documentation¶
You can visit your API instance's Swagger documentation by navigating to /docs or /redoc.
Deployment¶
It's common in production deployments to stand up a public-facing API instance. See below for deployment tips:
Meerschaum Stack (easiest)¶
If you have Docker installed, the most straightforward way to deploy is via the Meerschaum stack:
1 | |
This starts an internally-managed, pre-configured Docker Compose project with an api service that runs on http://localhost:8000.
The environment in the api service is updated such that connectors from your host are passed to the container.
Want to manage Docker yourself?
You can run the bmeares/meerschaum Docker image if you'd like to add Meerschaum to another Docker Compose project. You may also edit the stack Docker Compose project with mrsm edit config stack under the key docker-compose.yaml.
Bare Metal¶
If you don't want to deploy with Docker, you can run an API instance on your host directly:
The --production flag starts the API server with gunicorn, allowing for self-healing.
1 | |
For example, this is a common pattern for standing up a systemd service to start the API server:
1 | |
TLS / SSL / HTTPS¶
See the example NGINX configuration for a proxy pass to add HTTPS to your API instance via Let's Encrypt.
Otherwise, if you have a certificate on hand, you can run the API server with --keyfile and --certfile:
1 | |
Docker¶
If you're building your own Docker images, consider basing off the bmeares/meerschaum Docker image, as is done in the mrsm compose template repository:
1 2 3 4 5 6 7 8 | |
This image comes pre-installed with common database drivers and package dependencies. Note this image is configured to run as a non-privileged user meerschaum.
Of course, you can always pip install Meerschaum into your own custom image:
1 2 3 4 5 6 7 8 9 | |
AWS¶
Run the bmeares/meerschaum Docker image with ECS or on an EC2 like you would any other Docker container. See the Docker section above if you want to build your own images.
Helm Chart (k8s)¶
If you are running Kubernetes, consider the Meerschaum Helm chart on Artifact Hub. It's configured to run the bmeares/meerschaum Docker Image for k8s environments.