Persisting projections when MemDb = true

I’ve setup a docker container for EventStore which is restarted before I run unit tests on my dev machine.
What I really like about this system is that I can setup the EventStore configuration to use MemDb and then restart the docker container at the beginning of the test run, starting all the tests with a fresh clean EventStore each time.

The problem is that I’m losing any projects that I manually setup in the EventStore.

Is there a way to add projection definitions to the configuration file or via some kind of cli or api, so that I can include projections in my test runs too?

I’ve attached my current docker container definition in case you need to see it.

Thank you.

docker-eventstore-tests.zip (2.15 KB)

typo: projects = projections

I’ve looked at the documentation here https://eventstore.org/docs/projections/4.0.2/api/ and seen this method for creating a continuous projection.
Unfortunately, it doesn’t seem to contain parameters for the actual javascript body of the projection.

/projections/continuous?name={name}&type={type}&enabled={enabled}&emit={emit}&trackemittedstreams={trackemittedstreams}

To make that clear, I’m trying to persist projection definitions, NOT the projection state or results or emitted streams. Just the definition, so it’s ready to go up and running when the container restarts.

the body of the post is the actual projection. This is exactly how the UI works it posts the projection. There is also a wrapper in the client api of the http api https://github.com/EventStore/EventStore/blob/release-v4.0.4/src/EventStore.ClientAPI/Projections/ProjectionsManager.cs

That’s fantastic. Thank you so much.