The simplest way to run Fostgres is through Docker, although it can also be built from source.
There is a docker image available, fost/all which can be run. You will need to make Postgres available to it.
Assuming you're running Postgres on your host machine and it has a unix domain socket available in /var/run/postgres (the default on Ubuntu) you can run the image using:
sudo docker run -it \
-v/var/run/postgresql:/var/run/postgresql \
-v$(pwd):/src \
-w/src \
-u$(id -u):$(id -g) \
-ePGUSER=$USER \
fost/all \
fostgres-test todo schema1.sql tests1.fg
This breaks down as:
-itRun the container interactively-v/var/run/postgresql:/var/run/postgresqlShare the host Postgresql unix domain socket to the container.-v$(pwd):/srcMake the current directory available inside the container in the/srcfolder.-w/srcUse the /src folder as the current directory in the container.-u$(id -u):$(id -g)Use the currently logged in user and group IDs inside the container.-ePGUSER=$USERUse the current username as the Postgresql role name when connecting.fost/allThe container namefostgres-test todo schema1.sql tests1.fgThe command to run in the container.
Make sure we have the latest version of the image:
sudo docker pull fost/all
Clone the Fostgres project files:
git clone git@github.com:KayEss/fostgres.git
There are a number of examples that can be used, this is one of the tests:
cd fostgres/Examples/films
And finally run the image:
sudo docker run -it \
-v/var/run/postgresql:/var/run/postgresql \
-v$(pwd):/src \
-u$(id -u):$(id -g) \
-w/src \
-ePGUSER=$USER \
fost/all:latest \
fostgres-test fostgres-test-films \
libfostgres.so films.fg films.tables.sql view.film-slug.json
It's probably most convenient to set up an alias for this:
alias fostgres-test="sudo docker run -it
-v/var/run/postgresql:/var/run/postgresql
-v$(pwd):/src
-u$(id -u):$(id -g)
-w/src
-ePGUSER=$USER
fost/all:latest
fostgres-test"
TODO