Deployment: Difference between revisions

From MemCP
Jump to navigation Jump to search
No edit summary
(Refresh MemCP documentation: accuracy, operational guidance, performance profile and maintained API reference)
Line 1: Line 1:
MemCP is relatively easy to deploy. It only requires minimal system requirements (some 10-20 Megabytes of RAM for the base system). There are two deployment methods:
<!-- Copyright (C) 2026 Carl-Philip Haensch -->


=== Deployment via pm2 (preferred) ===
<!-- SPDX-License-Identifier: GPL-3.0-or-later -->
To run memcp, just follow these commands:
git clone https://github.com/launix-de/memcp
cd memcp
go get
make # make sure, go is installed
pm2 start ./memcp -data ./data/ # use a different path than ./data if you wish; install pm2
If you want to update memcp, just run:
git pull
make
pm2 restart [processid]
If you want a minimal installation without source code, just copy the executable <code>memcp</code>as well as the <code>lib</code>folder as well as <code>assets</code>.


=== Deployment via Docker ===
<span id="deployment"></span>
Docker needs a lot more RAM and disk space since every docker container installs its own linux distribution.
= Deployment =


To build docker just run
This page covers a single-node MemCP service from build through shutdown and upgrade. A production deployment must choose a durability ENGINE, protect credentials and listeners, provide a writable data directory or configured remote backend, and install the executable together with the exact matching Scheme libraries and assets.
git clone https://github.com/launix-de/memcp
 
cd memcp
MemCP is currently Beta. Treat deployment as an operational workflow rather than merely starting a binary: establish backups, restart tests, resource limits, monitoring, upgrade rollback, and application-level compatibility checks before accepting production traffic. Multi-node ownership and failover are not yet provided by the [[Cluster Monitor]].
docker buildx .
 
Docker offers a volume <code>/data</code> where all data is stored and exposes port 4332 (HTTP and REST APIs) and port 3307 (mysql)
<span id="build-and-run"></span>
== Build and run ==
 
<syntaxhighlight lang="bash">git clone https://github.com/launix-de/memcp
cd memcp
go mod download
make
./memcp -data /var/lib/memcp --no-repl \
  --api-port=4321 --mysql-port=3307 \
  --root-password='replace-on-first-start' lib/main.scm</syntaxhighlight>
<code>--root-password</code> initializes a fresh data directory only. Never expose the HTTP or MySQL port using <code>root/admin</code>. Put the service behind the intended firewall or reverse proxy and protect the data directory and configuration file.
 
<span id="interfaces"></span>
== Interfaces ==
 
{| class="wikitable"
|-
! Interface
! Default
|-
| HTTP SQL/dashboard
| TCP 4321
|-
| MySQL protocol
| TCP 3307
|-
| MySQL Unix socket
| <code>/tmp/memcp.sock</code>
|-
| Data directory
| <code>./data</code>
|}
 
Disable unused listeners with <code>--disable-api</code>, <code>--disable-mysql</code>, or an empty socket setting. Use <code>--config=FILE</code> for one argument per line; explicit command line options override configuration entries.
 
<span id="service-installation"></span>
== Service installation ==
 
MemCP supplies <code>make install</code>, Debian and RPM package targets, systemd lifecycle scripts, and <code>make memcp.sif</code> for Singularity/Apptainer. Packages install the binary and Scheme libraries in system paths and provide service configuration. Review paths and credentials before starting the service.
 
For a source checkout, PM2 remains a lightweight supervisor option:
 
<syntaxhighlight lang="bash">pm2 start ./memcp --name memcp -- \
  --no-repl -data /var/lib/memcp \
  --api-port=4321 --mysql-port=3307 lib/main.scm
pm2 save</syntaxhighlight>
 
After rebuilding, restart the named process with <code>pm2 restart memcp</code>. Keep the binary, <code>lib/</code> and <code>assets/</code> from the same commit. Docker is the other common deployment path; it consumes additional image/runtime resources but provides a reproducible bundle and a persistent <code>/data</code> volume. See [[Install MemCP with Docker]].
 
<span id="shutdown-and-upgrades"></span>
== Shutdown and upgrades ==
 
SIGTERM/SIGINT stops new work, drains in-flight requests up to <code>ShutdownDrainSeconds</code>, and closes storage. Before upgrading persistent data:
 
# back up the data directory or remote backend;
# read serialization and durability notes for the target release;
# stop MemCP cleanly;
# install the new binary and matching <code>lib/</code>/<code>assets/</code> files;
# start it and verify logs, schema, representative reads/writes, and restart.
 
Do not copy only the binary while retaining incompatible Scheme libraries. See [[Install_MemCP_with_Docker|Install MemCP with Docker]], [[Storage_Backends|Storage Backends]], and [[Persistency_and_Performance_Guarantees|Persistency and Performance Guarantees]].

Revision as of 11:59, 28 August 2026


Deployment

This page covers a single-node MemCP service from build through shutdown and upgrade. A production deployment must choose a durability ENGINE, protect credentials and listeners, provide a writable data directory or configured remote backend, and install the executable together with the exact matching Scheme libraries and assets.

MemCP is currently Beta. Treat deployment as an operational workflow rather than merely starting a binary: establish backups, restart tests, resource limits, monitoring, upgrade rollback, and application-level compatibility checks before accepting production traffic. Multi-node ownership and failover are not yet provided by the Cluster Monitor.

Build and run

<syntaxhighlight lang="bash">git clone https://github.com/launix-de/memcp cd memcp go mod download make ./memcp -data /var/lib/memcp --no-repl \

 --api-port=4321 --mysql-port=3307 \
 --root-password='replace-on-first-start' lib/main.scm</syntaxhighlight>

--root-password initializes a fresh data directory only. Never expose the HTTP or MySQL port using root/admin. Put the service behind the intended firewall or reverse proxy and protect the data directory and configuration file.

Interfaces

Interface Default
HTTP SQL/dashboard TCP 4321
MySQL protocol TCP 3307
MySQL Unix socket /tmp/memcp.sock
Data directory ./data

Disable unused listeners with --disable-api, --disable-mysql, or an empty socket setting. Use --config=FILE for one argument per line; explicit command line options override configuration entries.

Service installation

MemCP supplies make install, Debian and RPM package targets, systemd lifecycle scripts, and make memcp.sif for Singularity/Apptainer. Packages install the binary and Scheme libraries in system paths and provide service configuration. Review paths and credentials before starting the service.

For a source checkout, PM2 remains a lightweight supervisor option:

<syntaxhighlight lang="bash">pm2 start ./memcp --name memcp -- \

 --no-repl -data /var/lib/memcp \
 --api-port=4321 --mysql-port=3307 lib/main.scm

pm2 save</syntaxhighlight>

After rebuilding, restart the named process with pm2 restart memcp. Keep the binary, lib/ and assets/ from the same commit. Docker is the other common deployment path; it consumes additional image/runtime resources but provides a reproducible bundle and a persistent /data volume. See Install MemCP with Docker.

Shutdown and upgrades

SIGTERM/SIGINT stops new work, drains in-flight requests up to ShutdownDrainSeconds, and closes storage. Before upgrading persistent data:

  1. back up the data directory or remote backend;
  2. read serialization and durability notes for the target release;
  3. stop MemCP cleanly;
  4. install the new binary and matching lib//assets/ files;
  5. start it and verify logs, schema, representative reads/writes, and restart.

Do not copy only the binary while retaining incompatible Scheme libraries. See Install MemCP with Docker, Storage Backends, and Persistency and Performance Guarantees.