Skip to content

installation instructions

Shelson Ferrari edited this page Jul 24, 2024 · 11 revisions

Installation Instructions

Cloning the Project Repository

To clone the project repository, follow these steps:

  1. Clone the GitHub repository and navigate to the project directory:
git clone https://github.com/33mestre/java_base.git
cd java_base
chmod +x index.sh
chmod +x scripts/*.sh

Running with Docker

The project is designed to run seamlessly with Docker. The provided scripts handle the installation and execution of Docker containers. If Docker is not installed, the scripts will handle the installation process.

Running the Project with Docker

To run the project using Docker, execute the index.bat script for Windows or the index.sh script for Linux and Mac. These scripts will open a console terminal with the following main menu:

   Console Terminal 
   Main Menu

   ---------------------------------
   
   echo "Selecione uma opção:"
   echo "[1] - Server"
   echo "[2] - Console"
   echo "[3] - DB"
   echo "[4] - Directory"
   echo "[5] - Changelog"

Each option in the menu calls the corresponding script that manages the specific Docker container:

  • Server: Java Spring Server on port 80 and H2 DB Server on port 8092.
  • Console: Docker environment to run a Java console application, allowing testing of the Currency Conversion API application.
  • DB: DB Tester Installation and Execution Script (SELECT CURRENCY_CONVERSIONS from H2 DB).
  • Directory: Script to generate the DIRECTORY.md file.
  • Changelog: Script that:
    • Obtains the list of Git commits in the format: hash, date, author, and message.
    • Defines and increments the project version according to the commits.
    • Updates the 'CHANGELOG.md' file with a detailed log of all changes.
    • Updates the '.env' file with the new project version.
    • Ignores commits containing the keyword "AUTO_COMMIT".

Additional Script Features

  • Internationalization: The scripts read from the project.properties file to determine the language settings using the i18n key.
  • Property Checks: The scripts check for the existence of necessary property files and keys.
  • Script Existence Checks: Before running, each script verifies the existence of the required files.

Running without Docker

To run the project without Docker, ensure you have the following installed:

  • Java 17 or higher
  • Maven
  • Python
  • Groovy

Steps to Run without Docker

  1. Clone the repository:
git clone https://github.com/33mestre/java_base.git
cd java_base
  1. Install dependencies:
mvn clean install
  1. Run the application:
mvn spring-boot:run

You can use any Java IDE like Eclipse, IntelliJ IDEA, or VS Code to import the project using the pom.xml file.


Summary of Each Script

index.sh and index.bat

Currency Conversion API - Console Terminal This script provides a console terminal menu for managing the Currency Conversion API project. It performs the following steps:

  1. Checks for the existence of the project.properties file.
  2. Reads the i18n key from project.properties to determine the language.
  3. Loads the corresponding internationalization file for messages.
  4. Displays a menu with options to run various project scripts.
  5. Verifies the existence of each script before attempting to run it.
  6. Verifies the existence of properties in the i18n file. Each option in the menu calls the corresponding script that manages the specific Docker container:
  • [1] Server: Java Spring Server on port 80 and H2 DB Server on port 8092.
  • [2] Console: Docker environment to run a Java console application, allowing testing of the Currency Conversion API application.
  • [3] DB: DB Tester Installation and Execution Script (SELECT CURRENCY_CONVERSIONS from H2 DB).
  • [4] Directory: Script to generate the DIRECTORY.md file.
  • [5] Changelog: Script that:
    • Obtains the list of Git commits in the format: hash, date, author, and message.
    • Defines and increments the project version according to the commits.
    • Updates the 'CHANGELOG.md' file with a detailed log of all changes.
    • Updates the '.env' file with the new project version.
    • Ignores commits containing the keyword "AUTO_COMMIT".

changelog.sh and changelog.bat

Currency Conversion API - Project changelog generation script with i18n support

This script generates the project's changelog by setting up a Docker environment. It performs the following steps:

  1. Checks for the existence of the project.properties file.
  2. Reads the i18n key from project.properties to determine the language.
  3. Loads the corresponding internationalization file for messages.
  4. Verifies Docker installation and ensures the Docker daemon is running.
  5. Checks for and creates a Docker network if necessary.
  6. Packages the project into a Docker image.
  7. Runs a Docker container to generate the project changelog.

Calls changelog-docker.yml Dockerfile

The changelog-docker.yml Dockerfile is responsible for:

  • Setting up a Docker environment to run a Groovy application
  • For the purpose of generating the project's changelog.

console.sh and console.bat

Currency Conversion API - Project installation and execution script with i18n support

This script sets up and runs the Currency Conversion API application in a Docker environment. It performs the following steps:

  1. Checks for the existence of the project.properties file.
  2. Reads the i18n key from project.properties to determine the language.
  3. Loads the corresponding internationalization file for messages.
  4. Verifies Docker installation and installs it if necessary.
  5. Ensures the Docker daemon is running.
  6. Checks for and creates a Docker network if necessary.
  7. Packages the project into a Docker image.
  8. Runs a Docker container to execute the Currency Conversion API application.

Calls console-app-docker.yml Dockerfile

The console-app-docker.yml Dockerfile is responsible for:

  • Setting up a Docker environment to run a Java console application
  • Allowing the testing of the Currency Conversion API application.

db.sh and db.bat

This script sets up and runs the DB Tester for the Currency Conversion API application in a Docker environment. It performs the following steps:

  1. Checks for the existence of the project.properties file.
  2. Reads the i18n key from project.properties to determine the language.
  3. Loads the corresponding internationalization file for messages.
  4. Verifies Docker installation and installs it if necessary.
  5. Ensures the Docker daemon is running.
  6. Checks for and creates a Docker network if necessary.
  7. Packages the DB Tester project into a Docker image.
  8. Runs a Docker container to execute the DB Tester, which:
    • Installs, configures, and starts the H2 Database server.
    • Runs a Java program that performs a SELECT query on the CURRENCY_CONVERSIONS table in the H2 database.

Calls db-docker.yml Dockerfile

The db-docker.yml Dockerfile is responsible for:

  • Installing, configuring, and starting the H2 Database server
  • Running a Java program that performs a SELECT query on the CURRENCY_CONVERSIONS table in the H2 database.

directory.sh and directory.bat

This script sets up and runs the generation of the DIRECTORY.md file for the Currency Conversion API project in a Docker environment. It performs the following steps:

  1. Checks for the existence of the project.properties file.
  2. Reads the i18n key from project.properties to determine the language.
  3. Loads the corresponding internationalization file for messages.
  4. Verifies Docker installation and exits if not found.
  5. Ensures the Docker daemon is running.
  6. Checks for and creates a Docker network if necessary.
  7. Stops and removes any existing Docker container named "directory".
  8. Packages the project into a Docker image using directory-docker.yml.
  9. Adds execution permission to the script inside the container.
  10. Runs a Docker container to generate the DIRECTORY.md file.

Calls directory-docker.yml Dockerfile

The directory-docker.yml Dockerfile is responsible for:

  • Generating the project DIRECTORY.md

server.sh and server.bat

Currency Conversion API - Unix / Linux Version Server Installation and Execution Script

  • Java Spring Server - port 8080
  • H2 DB Server - port 8092

This script sets up and runs the server environment for the Currency Conversion API project in a Docker container. It performs the following steps:

  1. Checks for the existence of the project.properties file.
  2. Reads the i18n key from project.properties to determine the language.
  3. Loads the corresponding internationalization file for messages.
  4. Verifies Docker installation and installs it if necessary.
  5. Ensures the Docker daemon is running.
  6. Checks for and creates a Docker network if necessary.
  7. Stops and removes any existing Docker container named "shelson-app".
  8. Packages the project into a Docker image using Dockerfile.
  9. Runs the Docker container with the server on port 8080.

Running without Docker

To run the project without Docker, ensure you have the following installed:

  • Java 17 or higher
  • Maven
  • Python
  • Groovy

Steps to Run without Docker

  1. Clone the repository:
git clone https://github.com/33mestre/java_base.git
cd java_base
  1. Install dependencies:
mvn clean install
  1. Run the application:
mvn spring-boot:run

You can use any Java IDE like Eclipse, IntelliJ IDEA, or VS Code to import the project using the pom.xml file.


Wiki Menu

Wiki Main Page

1. Introduction to the Project

  • Overview: Presentation of the project, highlighting its purpose and the context in which it is embedded.
  • Project Objectives: Enumeration of the main objectives that the project aims to achieve.
  • Scope and Functionalities: Description of the main functionalities offered by the project and its scope of operation.

2. Configuration and Installation

3. Project Structure

  • Folder Structure: Description of the organization of the project directories.
  • Project Architecture: Explanation of the architecture used, including design patterns and technical decisions.

4. Development

  • Development Flow: Description of the development process adopted, including planning, coding, and review stages.
  • Apache Camel Integration: Guide on integrating Apache Camel into the project, including configuration and usage.
  • Contributors and Authors: Recognition of the contributors to the project.
  • Contributions: Guidelines on how to contribute to the project, including code standards and pull request requirements, tips and best practices.
  • Code of Conduct: Behavioral guidelines expected for the project community.

5. API and Documentation

6. Endpoints and Database

  • Endpoint Description: Details of the available API endpoints, including methods, parameters, and usage examples.
  • Database Management: Strategies and practices for efficient management of the database used by the project.

7. Testing

  • Testing Strategies: Approach and methods used to test the software, including unit, integration, and E2E tests.
  • Testing Tools: Description of the testing tools used in the project and how to configure them.

8. CI/CD and Automations

  • CI/CD Pipeline: Explanation of the continuous integration and delivery pipeline, detailing each stage and its function.
  • Automations and Artifact Generation: Description of the automations incorporated into the CI/CD, including documentation generation and build artifacts.

9. Configuration Files

10. Best Practices

11. Legal and Licensing

  • Licensing: Information about the rights and restrictions associated with the use of the software.
  • Terms of Use: Information about the terms and conditions for using the software.

12. Projections and Innovations

  • Future Plans: Discussion on functionalities and improvements considered for future versions of the project.
  • Improvement Proposals: Space for the community to suggest and debate improvements and innovations.

13. Attachments and Useful Links

14. Security

  • Security Policy: Details on the supported versions, reporting vulnerabilities, and general security practices.

Clone this wiki locally