DEV Community

Marco Aurélio Silva de Souza Júnior
Marco Aurélio Silva de Souza Júnior

Posted on

How to Set Up a Developer Environment for Apache AGE using Docker

This is a guide on setting up your developer environment for Apache AGE using Docker on WSL. Docker simplifies your workflow and enhances your productivity. It allows you to create, deploy, and run applications by using containers. It will be helpful if you need to work on many versions of a software, like postgres.

Let's go into the steps!

Pre-requisites

This short tutorial was built using WSL2, with integrated docker.

Step 1: Create AGE Fork and Clone PostgreSQL

On your host OS, clone your own fork of Apache AGE and clone postgres in two side-by-side folders.

Step 2: Get Base Image and Install Build Essentials

I like using the image debian:stable-slim, as it is very lightweight. You can get it by pulling from docker hub:

docker run debian:stable-slim
Enter fullscreen mode Exit fullscreen mode

Start by running a Docker container with the command:

docker run --name <new_image_name> -h <new_tag> -e LANG=C.UTF-8 -it debian:stable-slim /bin/bash -l
Enter fullscreen mode Exit fullscreen mode

Next, we need to update our software packages and install the essential ones. Run these commands on the terminal inside the container, which just opened:

apt update && apt upgrade --yes && apt install sudo locales --yes
dpkg-reconfigure tzdata
Enter fullscreen mode Exit fullscreen mode

Now, we'll create a new user and give them sudo permissions. Replace <your_username> with your chosen username:

adduser <your_username>
echo "<your_username> ALL=PASSWD: ALL" > /etc/sudoers.d/<your_username>
su - <your_username>
Enter fullscreen mode Exit fullscreen mode

Lastly, we need to install some necessary tools. Run:

sudo apt install htop git build-essential cmake libreadline-dev zlib1g-dev flex bison libicu-dev pkgconf vim --yes
Enter fullscreen mode Exit fullscreen mode

Step 3: Clone Image and Delete the Old One

To create a new Docker image from changes made to the current container, run:

docker image ls
docker commit debian:stable-slim <new_image_name:new_tag>
Enter fullscreen mode Exit fullscreen mode

Then, you can remove the old container using:

docker rm debian:stable-slim
Enter fullscreen mode Exit fullscreen mode

The newly created image will serve as your base to create other containers with different versions of postgres.

Step 4: Run the Container

Finally, we can run our new container. Make sure to replace the path placeholders with the actual source and destination paths for AGE:

docker run \
    --name <new_container_name> -h <new_host_name> \
    -v path/to/age/source:path/to/age/destination/inside/container \
    -it <new_image_name>:<hostname> /bin/bash
Enter fullscreen mode Exit fullscreen mode

Congrats! You've now set up your developer environment for Apache AGE using Docker. This environment will be isolated from the other parts of your system, which helps to keep your workstation clean and organized.

Keep in mind that Docker is an extensive platform, and there's a lot more to learn. However, understanding these basics will significantly improve your workflow as a developer.


I make these posts in order to guide people into the development of a new technology. If you find anything incorrect, I urge you to comment below so I can fix it. Thanks!


Check Apache AGE: https://age.apache.org/.

Overview — Apache AGE master documentation: https://age.apache.org/age-manual/master/intro/overview.html.

GitHub - apache/age: https://github.com/apache/age

Top comments (0)