Legend:
- Unmodified
- Added
- Removed
-
README.md
rae6cd79 r48d2bed 30 30 - **Build Tool:** npm/Create React App 31 31 32 ## 📋Prerequisites32 ## Prerequisites 33 33 34 34 Before you start, make sure you have installed: … … 37 37 - **Maven 3.8+** - [Download](https://maven.apache.org/download.cgi) 38 38 - **Node.js 22+** - [Download](https://nodejs.org/) 39 - **PostgreSQL 14+** - [Download](https://www.postgresql.org/download/) 39 - **PostgreSQL 14+** (if using local database) - [Download](https://www.postgresql.org/download/) 40 - **SSH Client** (for remote database access) - Built-in on Windows 10+, Mac, Linux 41 42 ## Configuration for Remote Database 43 44 ### Step 1: Setup `.env.properties` File 45 46 Create a `.env.properties` file in the project root directory with your remote database credentials: 47 48 ```properties 49 # Remote Database Credentials (provided by your professor or administrator) 50 DB_REMOTE_NAME=your_database_name 51 DB_REMOTE_USERNAME=your_database_username 52 DB_REMOTE_PASSWORD=your_database_password 53 54 # JWT Secret for authentication 55 JWT_SECRET=your_jwt_secret_key_min_32_characters 56 57 # Local database password (for local profile, default is 'postgres') 58 DB_PASSWORD=postgres 59 ``` 60 61 **Important Security Notes:** 62 - ⚠️ This file is in `.gitignore` and must NEVER be committed to Git 63 - ⚠️ Keep your credentials secure and do not share them 64 - ⚠️ Never upload this file to any public repository 65 66 ### Step 2: SSH Tunnel Setup (for Remote Database) 67 68 Before starting the application, you must establish an SSH tunnel to access the remote database: 69 70 ```bash 71 # Windows (Command Prompt or PowerShell) 72 ssh -L 9999:localhost:5432 your_ssh_username@remote_server_address 73 74 # Example: 75 ssh -L 9999:localhost:5432 t_medora@194.149.135.130 76 ``` 77 78 **Important:** Keep this terminal window open while running the application. The tunnel will close if you close the terminal. 79 80 **Expected Output:** 81 ``` 82 Enter password: [enter your SSH password] 83 Access granted. Press Return to begin session. 84 Local port 9999 forwarding to localhost:5432 85 ``` 86 87 --- 40 88 41 89 ## Quick Start 42 90 43 ### 1. Setup Database44 45 Create a PostgreSQL database for the application:46 47 ```bash 48 createdb medora 49 ``` 50 51 **Note:** The database schema and tables are automatically created by Flyway migrations and Hibernate when the backend starts. 52 53 ### 2. Start Backend54 55 Navigate to the backend directoryand run:91 ### Prerequisites Checklist 92 93 Before starting the application, ensure you have: 94 95 - Created `.env.properties` file with your database credentials 96 - SSH tunnel is running and connected (see Configuration section above) 97 - Terminal window with SSH tunnel remains open 98 99 --- 100 101 ### Step 1: Start Backend (Terminal 1) 102 103 Navigate to the project root and run: 56 104 57 105 ```bash … … 60 108 ``` 61 109 62 The backend will start on `http://localhost:8080` 63 64 **Wait for the message:** `Started Application in X seconds` 65 66 ### 3. Start Frontend (in a new terminal) 67 68 Navigate to the frontend directory and run: 110 **Expected Output:** 111 ``` 112 Started MedoraApplication in X seconds 113 ``` 114 115 **Port:** `http://localhost:8081` 116 117 --- 118 119 ### Step 2: Start Frontend (Terminal 2) 120 121 In a new terminal, navigate to frontend directory and run: 69 122 70 123 ```bash … … 74 127 ``` 75 128 76 The frontend will open automatically on `http://localhost:3000` 129 **Expected Output:** 130 ``` 131 Compiled successfully! 132 You can now view medora-frontend in the browser. 133 Local: http://localhost:3001 134 ``` 135 136 **Port:** `http://localhost:3001` 137 138 --- 139 140 ### Step 3: Access the Application 141 142 Open your browser and navigate to: **http://localhost:3001** 143 144 You should see the Medora login screen. 145 146 --- 147 148 ### ⚠️ Important: Keep These Terminals Open 149 150 - **Terminal 0:** SSH Tunnel (must remain open) 151 - **Terminal 1:** Backend (Spring Boot) 152 - **Terminal 2:** Frontend (React) 153 154 Close any of these and the application will stop working. 77 155 78 156 ## Default Credentials & User Roles … … 137 215 ### Backend Configuration 138 216 139 Edit `backend/src/main/resources/application.properties`: 217 The backend is configured to use a **remote PostgreSQL database** via SSH tunnel. 218 219 **Main Configuration File:** `backend/src/main/resources/application.properties` 140 220 141 221 ```properties 142 # Database 143 spring.datasource.url=jdbc:postgresql://localhost:5432/medora 144 spring.datasource.username=medora_app 145 spring.datasource.password=postgres 146 147 # JWT 148 jwt.secret=your-secret-key 222 # Application Setup 223 spring.application.name=medora 224 server.port=8081 225 spring.profiles.active=remote 226 227 # Load environment variables from .env.properties 228 spring.config.import=optional:file:.env.properties 229 230 # JWT Authentication 231 jwt.secret=${JWT_SECRET} 149 232 jwt.expiration=86400000 150 233 151 # Hibernate 152 spring.jpa.hibernate.ddl-auto=update 234 # Hibernate/JPA Settings 235 spring.jpa.hibernate.ddl-auto=none 236 spring.jpa.open-in-view=true 237 spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect 238 ``` 239 240 **Remote Database Configuration:** `backend/src/main/resources/application-remote.properties` 241 242 ```properties 243 # Remote PostgreSQL Database (via SSH tunnel on port 9999) 244 spring.datasource.url=jdbc:postgresql://localhost:9999/${DB_REMOTE_NAME} 245 spring.datasource.username=${DB_REMOTE_USERNAME} 246 spring.datasource.password=${DB_REMOTE_PASSWORD} 247 spring.datasource.driver-class-name=org.postgresql.Driver 153 248 ``` 154 249
Note:
See TracChangeset
for help on using the changeset viewer.
