Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamped installation instructions & Software Dependencies pages with Docker-first approach #2

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,34 @@
# Installation Instructions

* Cloning the repository.
* Installing dependencies.
* Setting up environment variables.
* Configuring the database.
* Running the application locally.
## Development Environment Setup

### Step 1: Software Dependencies
First, ensure all required software is installed by following the [Software Dependencies Guide](https://piramal-swasthya.gitbook.io/amrit/developer-guide/development-environment-setup/software-dependencies):

#### Dockerized Path (Recommended)
- Make sure you followed Step 7 in the Software Dependencies Guide to install Docker and Docker Compose
- **Skip** Steps 8 & 9 as you won't need manual database installation

#### Manual Path
- Make sure you followed Steps 8 & 9 in the Software Dependencies Guide to install:
- MySQL and MongoDB (Step 8)
- Redis for caching (Step 9)
- **Skip** Step 7 as you won't need Docker

### Step 2: Infrastructure Setup

#### Dockerized Path (Recommended)
1. Clone the AMRIT DevOps repository
2. Follow the [DevOps Setup Documentation](https://github.com/PSMRI/AMRIT-DevOps/tree/main/amrit-local-setup)
- This will automatically set up your databases with required dummy data

> 💡 **We strongly recommend the Docker path** as it ensures consistent database setup and eliminates potential conflicts.

#### Manual Path
1. Refer to the [Database Schema Documentation](https://piramal-swasthya.gitbook.io/amrit/data-management/database-schema) to:
- Set up required database schemas
- Load necessary data

### Step 3: Application Setup
After completing either path above:
1. Clone the required application repositories
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ The API microservices are built on Java, Spring boot framework and MySQL DB.
* Redis
* MySQL 8.0 and MySQL Workbench

### Through CLI
To build and run your Maven project, open the CLI.
* Navigate to your project directory using the `cd` command.
* Use the Maven command `mvn clean install` to build your project.
* To run your Java application, use `mvn spring-boot:run -DENV_VAR=local`. Ensure the Redis server is open during the run.
* Once the run is complete, load `http://localhost:{PORT}/swagger-ui.html#!/`, where PORT is defined in the [AMRIT documentation](https://github.com/PSMRI/AMRIT/blob/main/README.md).



#### Creating a build configuration in STS / Eclipse

* You can copy `common_example.properties` to `common_local.properties` and edit the file accordingly. The file is under `src/main/environment` folder.
Expand All @@ -35,7 +44,7 @@ The API microservices are built on Java, Spring boot framework and MySQL DB.
* Double-click on Spring Boot App(in STS) / Java Application(in Eclipse) and give a suitable name for the new configuration.
* Select the project and main class and click on Apply.
* Click Run to run the configuration. Keep the Redis server open during this run.
* Once the run is complete, load [http://localhost:8080/swagger-ui.html#!/](http://localhost:8080/swagger-ui.html#!/)
* Once the run is complete, load `http://localhost:{PORT}/swagger-ui.html#!/`, where PORT is defined in the [AMRIT documentation](https://github.com/PSMRI/AMRIT/blob/main/README.md).

#### How to Import, Build, and Run Maven Code in Visual Studio Code

Expand All @@ -54,3 +63,4 @@ The API microservices are built on Java, Spring boot framework and MySQL DB.
* Navigate to your project directory using the `cd` command.
* Use the Maven command `mvn clean install` to build your project.
* To run your Java application, use `mvn spring-boot:run -DENV_VAR=local`. Ensure the Redis server is open during the run.
* Once the run is complete, load `http://localhost:{PORT}/swagger-ui.html#!/`, where PORT is defined in the [AMRIT documentation](https://github.com/PSMRI/AMRIT/blob/main/README.md).
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
npm start
```

By default, your application will be available at `http://localhost:4200/`. You can access it in your browser.
Access your application through your browser using `http://localhost:{PORT}`, where PORT is defined in the [AMRIT documentation](https://github.com/PSMRI/AMRIT/blob/main/README.md).
185 changes: 111 additions & 74 deletions developer-guide/development-environment-setup/software-dependencies.md
Original file line number Diff line number Diff line change
@@ -1,118 +1,155 @@
# Software dependencies
## Software Dependencies

**1. Operating System:**
### **1. Operating System:**

The development environment for a Spring Boot 3 and Angular 16 application can be set up on any modern operating system. Ensure that your system meets the following requirements:

* **Windows 10/11 (64-bit)**: Suitable for most development setups.
* **macOS (Big Sur or later)**: Offers great compatibility with open-source tooling and a Unix-based system.
* **Linux (Ubuntu 20.04+, Fedora, etc.)**: Popular among developers for its performance, flexibility, and ease of use in programming environments.
- **Windows 10/11 (64-bit)**: Suitable for most development setups.
- **macOS (Big Sur or later)**: Offers great compatibility with open-source tooling and a Unix-based system.
- **Linux (Ubuntu 20.04+, Fedora, etc.)**: Popular among developers for its performance, flexibility, and ease of use in programming environments.

#### **2. Java Development Kit (JDK):**
---

### **2. Java Development Kit (JDK):**

Spring Boot 3 requires **Java 17** (LTS version) as it offers long-term support and compatibility.

* **Version**: Java 17 (LTS).
* **Installation Guide**:
* [**Oracle JDK**](https://www.oracle.com/java/technologies/javase-downloads.html): Official JDK from Oracle with licensing and support.
* [**OpenJDK**](https://jdk.java.net/17/): Free and open-source implementation.
* **Verify Installation**: Once installed, verify by running the following command:
- **Version**: Java 17 (LTS).
- **Installation Guide**:
- [**Oracle JDK**](https://www.oracle.com/java/technologies/javase-downloads.html): Official JDK from Oracle with licensing and support.
- [**OpenJDK**](https://jdk.java.net/17/): Free and open-source implementation.
- **Verify Installation**: Once installed, verify by running the following command:
```bash
java -version
```
It should display Java 17.

```bash
java -version
```
---

It should display Java 17.

#### **3. Node.js and npm (for Angular 16):**
### **3. Node.js and npm (for Angular 16):**

Node.js is essential for Angular development, as it powers the Angular CLI, package management, and builds.

* **Version**: Node.js 18+ (for Angular 16+).
* **Installation Guide**:
* [**Node.js Official Downloads**](https://nodejs.org/en/download/): Download the LTS version for the best stability and support.
* **Verify Installation**: After installing, verify by running:
- **Version**: Node.js 18+ (for Angular 16+).
- **Installation Guide**:
- [**Node.js Official Downloads**](https://nodejs.org/en/download/): Download the LTS version for the best stability and support.
- **Verify Installation**: After installing, verify by running:
```bash
node --version
npm --version
```

```bash
node --version
npm --version
```
---

#### **4. Angular CLI:**
### **4. Angular CLI:**

The Angular CLI helps you scaffold and manage Angular applications.

* **Version**: Angular CLI 16.x.
* **Installation Command**: Install Angular CLI globally via npm:
- **Version**: Angular CLI 16.x.
- **Installation Command**: Install Angular CLI globally via npm:
```bash
npm install -g @angular/cli@16
```
- **Verify Installation**: Run `ng version` to confirm the CLI is properly installed.

```bash
npm install -g @angular/cli@16
```
* **Verify Installation**: Run `ng version` to confirm the CLI is properly installed.
---

#### **5. Spring Boot:**
### **5. Spring Boot:**

Spring Boot simplifies the development of Java-based enterprise applications by providing pre-configured templates and reducing boilerplate.

* **Version**: Spring Boot 3.x.
* **Build Tool**: Maven (preferred) or Gradle.
* **Installation Command (Maven)**: Maven is a build automation tool used for managing dependencies and packaging your Spring Boot project.
* [**Maven Installation Guide**](https://maven.apache.org/install.html).
* After installing Maven, verify with:
- **Version**: Spring Boot 3.x.
- **Build Tool**: Maven (preferred) or Gradle.
- **Installation Command (Maven)**: Maven is a build automation tool used for managing dependencies and packaging your Spring Boot project.
- [**Maven Installation Guide**](https://maven.apache.org/install.html).
- **Verify Installation**: After installing Maven, verify with:
```bash
mvn -version
```

```bash
mvn -version
```
---

#### **6. Development Environment:**
### **6. Development Environment:**

You’ll need integrated development environments (IDEs) that support Java and TypeScript for backend and frontend development, respectively.

* **IDE for Backend (Spring Boot)**:
* [**IntelliJ IDEA**](https://www.jetbrains.com/idea/download/): Great for Java-based development and Spring Boot. It has dedicated support for Spring.
* [**Eclipse IDE**](https://www.eclipse.org/downloads/): A popular open-source IDE with Spring Boot support.
* [**Spring Tool Suite (STS)**](https://spring.io/tools): A specialized IDE tailored for Spring applications.
* **IDE for Frontend (Angular)**:
* [**Visual Studio Code**](https://code.visualstudio.com/download/): A lightweight and highly customizable editor for TypeScript and Angular development.
* [**WebStorm**](https://www.jetbrains.com/webstorm/download/): A feature-rich IDE with built-in Angular support.
- **IDE for Backend (Spring Boot)**:
- [**IntelliJ IDEA**](https://www.jetbrains.com/idea/download/): Great for Java-based development and Spring Boot. It has dedicated support for Spring.
- [**Eclipse IDE**](https://www.eclipse.org/downloads/): A popular open-source IDE with Spring Boot support.
- [**Spring Tool Suite (STS)**](https://spring.io/tools): A specialized IDE tailored for Spring applications.
- **IDE for Frontend (Angular)**:
- [**Visual Studio Code**](https://code.visualstudio.com/download/): A lightweight and highly customizable editor for TypeScript and Angular development.
- [**WebStorm**](https://www.jetbrains.com/webstorm/download/): A feature-rich IDE with built-in Angular support.

#### **7. Database:**
---

AMRIT platform requires a database, we use MySQL, a relational database. 
### **7. Docker and Docker Compose (Optional):**

* **MySQL**:
* **Version**: MySQL 8+.
* Download Mysql from [here](https://dev.mysql.com/downloads/installer/)
* After installation, use MySQL Workbench or the command line to manage your database.
Docker and Docker Compose are only required if you want to set up dummy data locally using the `amrit-devops` repository. This setup includes pre-configured databases (MySQL and MongoDB) and Redis, so you **do not need to manually install MySQL, MongoDB, or Redis** (steps 8, 9, and 10) if using Docker.

Configure your Spring Boot application with the required database connection properties in the `application.properties` file.
- **Docker**:
- **Version**: Docker 20.10+.
- [**Install Docker**](https://docs.docker.com/get-docker/).
- **Verify Installation**:
```bash
docker --version
```
- **Docker Compose**:
- **Version**: Docker Compose 2.1+.
- [**Install Docker Compose**](https://docs.docker.com/compose/install/).
- **Verify Installation**:
```bash
docker-compose --version
```

---

#### **8. Caching:**
### **8. Database (Optional):**

To improve performance, we use caching solutions.
If you are **not using Docker**, the AMRIT platform requires a database. We use **MySQL** and **MongoDB**.

* **Redis** is a popular in-memory data store used for caching in Spring Boot apps.
* Download Redis from [here](https://redis.io/docs/latest/get-started/)
* Redis is integrated into Spring Boot via the `spring-data-redis` library.
- **MySQL**:
- **Version**: MySQL 8+.
- [**Download MySQL**](https://dev.mysql.com/downloads/).
- After installation, use MySQL Workbench or the command line to manage your database.
- Configure your Spring Boot application with the required database connection properties in the `application.properties` file.
- **MongoDB**:
- **Version**: MongoDB 6.0+.
- [**Download MongoDB**](https://www.mongodb.com/try/download/community).
- After installation, use MongoDB Compass or the command line to manage your database.
- Configure your Spring Boot application with the required MongoDB connection properties in the `application.properties` file.

#### **9. Other Tools:**
---

* **Git**: Version control system.
* Download Git from [here](https://git-scm.com/downloads)
* After installing, verify by running:
### **9. Caching (Optional):**

```bash
git --version
```
* **NVM (Node Version Manager)**: To manage multiple Node.js versions if needed.
* Download node from [here](https://nodejs.org/en/download/package-manager)
* **Browser**: The latest version of Google Chrome, Firefox, or Microsoft Edge is recommended for testing and debugging Angular apps.
If you are **not using Docker**, Redis is used for caching to improve performance.

#### **10. Additional Recommendations:**
- **Redis**:
- [**Download Redis**](https://redis.io/download).
- Redis is integrated into Spring Boot via the `spring-data-redis` library.

* **Memory Allocation**: Spring Boot applications, especially large ones, may require a substantial amount of memory. Allocate 2 GB or more to the JVM to avoid performance issues during development.
---

### **10. Other Tools:**

- **Git**: Version control system.
- [**Download Git**](https://git-scm.com/downloads).
- **Verify Installation**:
```bash
export JAVA_OPTS="-Xms2g -Xmx4g"
git --version
```
- **NVM (Node Version Manager)**: To manage multiple Node.js versions if needed.
- [**Download NVM**](https://github.com/nvm-sh/nvm).
- **Browser**: The latest version of Google Chrome, Firefox, or Microsoft Edge is recommended for testing and debugging Angular apps.

---

### **11. Additional Recommendations:**

- **Memory Allocation**: Spring Boot applications, especially large ones, may require a substantial amount of memory. Allocate 2 GB or more to the JVM to avoid performance issues during development.
```bash
export JAVA_OPTS="-Xms2g -Xmx4g"
```

---