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!
This short tutorial was built using WSL2, with integrated docker.
On your host OS, clone your own fork of Apache AGE and clone postgres in two side-by-side folders.
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
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
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
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>
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
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>
Then, you can remove the old container using:
docker rm debian:stable-slim
The newly created image will serve as your base to create other containers with different versions of postgres.
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
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