Skip to content

Instantly share code, notes, and snippets.

@MitchPierias
Last active December 9, 2022 21:32
Show Gist options
  • Save MitchPierias/af2aa704ffc7d750aacd32f7a9d37919 to your computer and use it in GitHub Desktop.
Save MitchPierias/af2aa704ffc7d750aacd32f7a9d37919 to your computer and use it in GitHub Desktop.
Deploying ArnagoDB to an EC2 Linux Instance

ArangoDB Deployment to EC2 Linux Instance

Quickly get an ArangoDB instance running on an Amazon EC2 Linux Instance

Update existing package list and then install prerequieites.

sudo yum update -y

If your running a regular amazon linuz instance

sudo yum install docker

Otherwise amazon linux 2 instances require installing docker from Amazon's Linux extra packages

sudo amazon-linux-extras install docker

Start the docker service

sudo service docker start

REgister the ec2-user to the docker group so we don't need to run sudo with commands

sudo usermod -a -G docker ec2-user

You'll need to logout and log back in for this change to take effect. The simplest way is to close the SSH connection and reconnect. Now you can run docker info and it should return docker information.

Installing ArangoDB

First we need to pull the ArangoDB Docker image, simply run;

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.

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;

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 control access to 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;

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;

docker run -e ARANGO_NO_AUTH=1 -p 8529:8529 -td arangodb --restart unless-stopped

The -d flag detaches the container and runs the process in the background, printing the container id. -t allocates a pseudo-TTY

We're using the --restart unless-stopped flag to tell Docker to restart our instance automatically unless told otherwise with docker stop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment