This guide provides step-by-step instructions to install and run the application both locally and in a Dockerized environment.
Local Installation
To set up the application on your local machine, follow these steps:
1. Clone the Repository
First, clone the project repository to your local system:
git clone https://github.com/amineXguesmi/cicd_pipeline.git
cd cicd_pipeline
2. Install Dependencies
This project uses Go Modules for dependency management. Ensure you have Go installed (v1.22 or higher).
To download and install the required dependencies:
3. Set Up Environment Variables
Create a .env file in the project root directory and configure the required environment variables:
4. Run the Application Locally
Start the Go application:
The application will be accessible at:
5. (Optional) Run Tests Locally
To verify that everything works correctly, run the unit tests:
Dockerized Installation
For a production-ready setup or easier deployment, you can run the application in a Dockerized environment.
1. Build and Start the Application
Navigate to the project root directory and run the following command:
This command will:
Build the Docker image for the Go application.
Start the Go app and any additional services (e.g., MongoDB) as defined in the docker-compose.yml.
2. Access the Application
Once the containers are running, you can access the application at:
3. Stopping the Application
To stop the running containers, execute:
This will:
Stop the running containers.
Preserve database data in Docker volumes (if configured).
Notes on Dockerized Installation
Persistent Data:
If the application uses a database, ensure volumes are configured in the docker-compose.yml to persist data across restarts.
Configuration Files:
Modify the docker-compose.yml file to adjust environment variables, ports, or service configurations.
Ports:
The default application port is 8080.
Ensure the port is not being used by other services.
Logs:
View application logs using: