-
Notifications
You must be signed in to change notification settings - Fork 2
Running in Docker
In Foxx-builder
v.2.x, we added the docker-compose.yml
file and a few shortcuts into package.json
that will help you to develop your APIs and run them in docker.
docker-compose.yml
:
version: "3.9"
services:
arangodb:
restart: always
container_name: "arangodb-dev"
image: "arangodb/arangodb:latest"
ports:
- "8529:8529"
environment:
- ARANGO_ROOT_PASSWORD=openSesame
volumes:
- .backup:/backup
You can use npm
or yarn
to run things; just keep in mind that there is an order of actions to consider.
The flow would be like this:
- Start docker container:
yarn run docker:start
o, manually:
docker compose -p foxx-backend -f docker-compose.yml up -d
- Setup the development database:
yarn run docker:setup-db
or, manually:
docker exec -it arangodb-dev arangosh --server.username root --server.password openSesame --javascript.execute-string "db._createDatabase('dev',{},[{username: 'dev', passwd: 'sandbox', active: true}]);"
- Register development database server with Foxx CLI
yarn run register-foxx-dev-server
or
foxx server set dev http://dev:sandbox@localhost:8529
- Install Foxx Microservices on
/api
endpoint on development database
yarn run install-foxx-dev
or, manually:
foxx install /api . --server dev --database dev
After microservices are installed, during the development, all you will need to call is a replace
method - yarn run replace-foxx-dev
To backup your ArangoDb data locally, just run the following:
docker exec -it arangodb-dev arangodump --overwrite true --server.database dev --server.username root --server.password openSesame --output-directory /backup
It will backup data into /backup
folder that you mounted as a volume in your docker-compose.yml
to .backup
. For more examples of arangodump
utility, please refer to https://www.arangodb.com/docs/stable/programs-arangodump-examples.html
Restoring from the backup is done in the following way:
docker exec -it arangodb-dev arangorestore --server.database dev --server.username root --server.password openSesame --input-directory /backup
Underneath it is using arangorestore
utility, you can see more examples of how to use it at https://www.arangodb.com/docs/stable/programs-arangorestore-examples.html
Copyright © 2016-2022, Skitsanos™