This repository contains a simple project that combines Vagrant and Docker to create a development environment for a RESTful API. It helps you quickly set up and run a REST API server within a Vagrant-managed virtual machine using Docker containers.
Vagrant is an open-source tool and a powerful command-line utility for managing and provisioning virtualized development environments. It is designed to simplify the process of creating, configuring, and sharing reproducible development environments across different platforms and virtualization providers.
Docker is a platform and set of tools that simplify the process of developing, shipping, and running applications in lightweight, portable containers. Containers are standalone, executable packages that include everything needed to run a piece of software, including the code, runtime, libraries, and system tools.
Gin is a web framework for the Go programming language that simplifies the development of web applications and APIs. It is known for its speed, minimal memory footprint, and ease of use, making it a popular choice for building high-performance web services in Go.
Express is a popular and minimalistic web application framework for Node.js, a runtime environment that executes JavaScript on the server side.
Before you begin, ensure you have met the following requirements:
- Vagrant installed on your local machine.
- VirtualBox (or another supported provider) installed.
- Basic knowledge of Vagrant and Docker.
To get started with this project, follow these steps:
-
Clone this repository to your local machine:
git clone https://github.com/rosariocannavo/Vagrant_docker_rest.git
-
Run the following command to execute Vagrant:
vagrant up
-
Run the following to attach a terminal to the VM:
vagrant ssh
-
Run this command inside the machine to check the containers:
docker ps
-
You can check the api root at:
localhost:8080 //node express
localhost:9090/hello //go gin
-
To stop the machine run:
vagrant halt
-
To destroy the machine run:
vagrant destroy --force