Initial commit: MV Rent car rental management system
Spring Boot + Thymeleaf app: fleet, drivers, vendors, bookings, billing/ settlements, payments, maintenance, inspections, reviews, telematics, audit log, staff/user management, and separate admin/vendor/driver portals. Includes Docker Compose deployment (app + Postgres). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
# Deploying MV Rent to a server (Docker Compose)
|
||||
|
||||
Target: `root@93.127.166.135`. The stack runs the Spring Boot app + PostgreSQL in
|
||||
containers. The server only needs Docker — no Java or Postgres install required.
|
||||
|
||||
---
|
||||
|
||||
## 1. Install Docker on the server (one time)
|
||||
|
||||
SSH in and install Docker + the Compose plugin:
|
||||
|
||||
```bash
|
||||
ssh root@93.127.166.135
|
||||
|
||||
# Ubuntu/Debian:
|
||||
curl -fsSL https://get.docker.com | sh
|
||||
docker --version && docker compose version
|
||||
```
|
||||
|
||||
Open the firewall for HTTP (and HTTPS if you'll add TLS later):
|
||||
|
||||
```bash
|
||||
ufw allow 80/tcp && ufw allow 443/tcp # skip if ufw isn't enabled
|
||||
```
|
||||
|
||||
## 2. Copy the project to the server
|
||||
|
||||
From your **local machine** (in the project folder `car-rent`):
|
||||
|
||||
```bash
|
||||
# excludes build output, .git and local uploads
|
||||
rsync -az --delete \
|
||||
--exclude target --exclude .git --exclude uploads \
|
||||
./ root@93.127.166.135:/opt/mvrent/
|
||||
```
|
||||
|
||||
(Or `git clone` your repo into `/opt/mvrent` if it's pushed somewhere.)
|
||||
|
||||
## 3. Configure secrets
|
||||
|
||||
On the **server**:
|
||||
|
||||
```bash
|
||||
cd /opt/mvrent
|
||||
cp .env.example .env
|
||||
nano .env # set a strong DB_PASSWORD (and mail creds if you want email)
|
||||
```
|
||||
|
||||
## 4. Build & start
|
||||
|
||||
```bash
|
||||
cd /opt/mvrent
|
||||
docker compose up -d --build
|
||||
```
|
||||
|
||||
First run takes a few minutes (it builds the app image and downloads Postgres).
|
||||
On startup the app creates the schema and seeds demo data automatically.
|
||||
|
||||
## 5. Verify
|
||||
|
||||
```bash
|
||||
docker compose ps # both services "running"/"healthy"
|
||||
docker compose logs -f app # look for "Started CarRentalApplication"
|
||||
curl -I http://localhost # expect HTTP 200/302
|
||||
```
|
||||
|
||||
Then open **http://93.127.166.135/** in a browser.
|
||||
|
||||
| Area | URL | Default login |
|
||||
|------|-----|---------------|
|
||||
| Public site | `/` | — |
|
||||
| Admin | `/admin/login` | `admin` / `admin123` |
|
||||
| Vendor portal | `/vendor/login` | created from admin |
|
||||
| Driver portal | `/driver/login` | created from admin |
|
||||
|
||||
> ⚠️ **Change the admin password immediately** (Admin → profile) and delete the
|
||||
> demo customer if this is production.
|
||||
|
||||
---
|
||||
|
||||
## Day-2 operations
|
||||
|
||||
**Update after code changes** (re-run rsync from step 2, then):
|
||||
```bash
|
||||
cd /opt/mvrent && docker compose up -d --build
|
||||
```
|
||||
|
||||
**Logs / restart / stop:**
|
||||
```bash
|
||||
docker compose logs -f app
|
||||
docker compose restart app
|
||||
docker compose down # stop (keeps data volumes)
|
||||
```
|
||||
|
||||
**Back up the database:**
|
||||
```bash
|
||||
docker compose exec db pg_dump -U postgres mv_rent > backup-$(date +%F).sql
|
||||
```
|
||||
|
||||
**Restore:**
|
||||
```bash
|
||||
cat backup-YYYY-MM-DD.sql | docker compose exec -T db psql -U postgres -d mv_rent
|
||||
```
|
||||
|
||||
Uploaded files persist in the `uploads` Docker volume; DB in `db-data`.
|
||||
|
||||
---
|
||||
|
||||
## Optional: domain + HTTPS (nginx + Let's Encrypt)
|
||||
|
||||
If you point a domain at the server, put nginx in front and get a free cert.
|
||||
First change the app's port mapping in `docker-compose.yml` from `"80:8080"` to
|
||||
`"127.0.0.1:8080:8080"` (so only nginx is public), then:
|
||||
|
||||
```bash
|
||||
apt install -y nginx certbot python3-certbot-nginx
|
||||
# create /etc/nginx/sites-available/mvrent -> proxy_pass http://127.0.0.1:8080;
|
||||
certbot --nginx -d yourdomain.com
|
||||
```
|
||||
|
||||
Ask me and I'll generate the exact nginx server block for your domain.
|
||||
Reference in New Issue
Block a user