Skip to content

Instantly share code, notes, and snippets.

@MitchPierias
Last active December 17, 2020 14:57
Show Gist options
  • Save MitchPierias/9fd921ad24816380811d77e886b99b0b to your computer and use it in GitHub Desktop.
Save MitchPierias/9fd921ad24816380811d77e886b99b0b to your computer and use it in GitHub Desktop.
ArangoDB Deployment to EC2 with Docker

ArangoDB Deployment to EC2

Install Docker

Update exisitn gpackage list and then install prerequieites.

sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common

Install GPG for the offical Docker release;

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Add the repository to APT sources, and update the package database again;

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update

Ensure install from the Docker repo and not the Ubuntu repo with apt-cache policy docker-ce. The output should look like the follow;

docker-ce:
  Installed: (none)
  Candidate: 5:18.09.1~3-0~ubuntu-bionic
  Version table:
     5:18.09.1~3-0~ubuntu-bionic 500
        500 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     5:18.09.0~3-0~ubuntu-bionic 500
        500 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     18.06.1~ce~3-0~ubuntu 500
        500 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     18.06.0~ce~3-0~ubuntu 500
        500 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     18.03.1~ce~3-0~ubuntu 500
        500 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages

Finally install Docker

sudo apt install docker-ce

You can now be installed and configured to run on your system. To check the status of docker run sudo systemctl status docker. We haven't configured our user as a super user so we will need to prefix all commands with the sudo command. To setup administration access, follow step two here.

Installing ArangoDB

First we need to pull the docker image, run;

sudo docker pull arangodb

Starting an Instance

Now we can start an ArangoDB instance; The ARANGO_RANDOM_ROOT_PASSWORD will generate a random root password upon startup and print to the console and to docker logs. Alternatively you can use ARANGO_NO_AUTH=1 to disabled authentication or set your own password with ARANGO_ROOT_PASSWORD=somepassword.

Note: this way of specifying logins only applies to single server installations. With clusters you have to provision the users via the root user with empty password once the system is up.

sudo docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 -d --name arangodb-instance arangodb

We can now call on our container with the arangodb-instance name. Let's request the IP address Arango is listening on;

sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}' arangodb-instance

Exposing the Port

If you want to allow outisde access to ArangoDB, you'll need to expose port 8529; We will limit this later with Aamazon security groups and virtual private networks.

docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 -p 8529:8529 -d arangodb

Using an Instance

We need to link the container inorder to use the running instance from an application;

sudo docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 --name my-app --link arangodb-instance:db-link arangodb

Command line options

A list of commands is available with the following command; docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 arangodb arangod --help

Finally!

We're now going to start our instance with no authentication and map the ArangoDB port to our Instance port, exposing it;

sudo docker run -e ARANGO_NO_AUTH=1 -p 8529:8529 -d arangodb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment