From ede23d180d296c151667857df1eb9c2c79321d8e Mon Sep 17 00:00:00 2001 From: Alex MacArthur Date: Tue, 10 Sep 2019 22:19:24 -0500 Subject: [PATCH] Add FaunaDB. --- fauna/.fauna-shell | 7 +++++ fauna/Dockerfile | 4 +++ fauna/README.md | 63 ++++++++++++++++++++++++++++++++++++++++ fauna/docker-compose.yml | 17 +++++++++++ 4 files changed, 91 insertions(+) create mode 100644 fauna/.fauna-shell create mode 100644 fauna/Dockerfile create mode 100644 fauna/README.md create mode 100644 fauna/docker-compose.yml diff --git a/fauna/.fauna-shell b/fauna/.fauna-shell new file mode 100644 index 0000000..5b6452c --- /dev/null +++ b/fauna/.fauna-shell @@ -0,0 +1,7 @@ +default=localhost + +[localhost] +domain=db +port=8443 +scheme=http +secret=secret diff --git a/fauna/Dockerfile b/fauna/Dockerfile new file mode 100644 index 0000000..18c66ca --- /dev/null +++ b/fauna/Dockerfile @@ -0,0 +1,4 @@ +FROM node:latest +RUN npm install -g fauna-shell +COPY .fauna-shell /root +ENTRYPOINT ["tail", "-f", "/dev/null"] diff --git a/fauna/README.md b/fauna/README.md new file mode 100644 index 0000000..dedc631 --- /dev/null +++ b/fauna/README.md @@ -0,0 +1,63 @@ +# FaunaDB w/ Docker Compose + +This setup contains two separate services -- one for running the DB platform itself, and one for the shell used to interface with that platform. + +# Using the Dockerized Fauna Shell + +Running `docker-compose up` will activate both the DB and Fauna shell services, removing any need to deal with dependencies on your own machine. + +## Accessing the Shell + +Enter the container to use the shell with the following: + +``` +docker-compose exec --user root shell /bin/bash +``` + +## Running Only the DB Service +To run _only_ the DB, use `docker-compose up shell`. In order to use the Fauna shell with that DB, you'll need to set it up on your machine: + +### Set Up the Fauna Shell + +Outside your container, you'll need to separately install the `fauna-shell` for interacting with FaunaDB via command line. Dig into the package more [here](https://github.com/fauna/fauna-shell). + +### Install the CLI + +`npm install -g fauna-shell` + +### Configure the Shell +Create a ~/.fauna-shell configuration file. + +``` +touch ~/.fauna-shell +``` + +Place the following in that file. These values will set up the shell to interface with your running FaunaDB container. + +``` +default=localhost + +[localhost] +domain=127.0.0.1 +port=8443 +scheme=http +secret=secret +``` + +## Create a DB + +Run the following: + +``` +fauna create-database mydatabase +``` + +Start up a shell with your newly created database with the following: + +``` +fauna shell mydatabase +``` + +## Use a Pretty UI Locally + +For a pretty web interface through which to managed your local databases, see [FaunaDB's Developer Dashboard](https://github.com/fauna/dashboard). diff --git a/fauna/docker-compose.yml b/fauna/docker-compose.yml new file mode 100644 index 0000000..46b7aef --- /dev/null +++ b/fauna/docker-compose.yml @@ -0,0 +1,17 @@ +version: '3' + +services: + db: + image: fauna/faunadb:latest + volumes: + - dbdata:/var/log/faunadb + restart: always + ports: + - 8443:8443 + shell: + build: + context: . + restart: always + +volumes: + dbdata: