Files
iiEasy/nomad/README.md

82 lines
1.8 KiB
Markdown
Raw Normal View History

# iiEasy Nomad Deployment
## Prerequisites
1. **Nomad cluster** at 192.168.1.16 (or your host)
2. **Nomad client** with Docker driver and host volumes configured
3. **SSH access** to the Nomad node for image transfer
## Setup
### 1. Configure host volumes on Nomad client
Add to your Nomad client config (e.g. `/etc/nomad.d/nomad.hcl`):
```hcl
host_volume "iieasy-postgres-data" {
path = "/opt/nomad/iieasy/postgres-data"
read_only = false
}
host_volume "iieasy-strapi-uploads" {
path = "/opt/nomad/iieasy/uploads"
read_only = false
}
```
Create directories and restart Nomad client:
```bash
sudo mkdir -p /opt/nomad/iieasy/postgres-data /opt/nomad/iieasy/uploads
sudo chmod -R 755 /opt/nomad/iieasy
# Restart Nomad client
```
### 2. Environment variables
```bash
export NOMAD_ADDR=http://192.168.1.16:4646
export NOMAD_HOST=192.168.1.16
export NOMAD_USER=its
export STRAPI_PUBLIC_URL=http://192.168.1.16:1337 # URL for browser API calls
```
Use SSH key authentication or enter password when `scp`/`ssh` prompts.
### 3. Deploy
```bash
chmod +x deploy-nomad.sh
./deploy-nomad.sh
```
## Manual steps
If the deploy script fails or you prefer manual control:
```bash
# Build images
docker build --build-arg VITE_STRAPI_URL=http://192.168.1.16:1337 -t iieasy-frontend:latest .
docker build -t iieasy-strapi:latest ./iiEasy
# Copy to Nomad node
docker save iieasy-frontend:latest iieasy-strapi:latest -o /tmp/iieasy-images.tar
scp /tmp/iieasy-images.tar its@192.168.1.16:/tmp/
# On Nomad node
ssh its@192.168.1.16
docker load -i /tmp/iieasy-images.tar
# From your machine (with Nomad CLI)
export NOMAD_ADDR=http://192.168.1.16:4646
nomad job run nomad/iieasy.nomad.hcl
```
## Access
- Frontend: http://192.168.1.16:3000
- Strapi Admin: http://192.168.1.16:1337/admin
- PostgreSQL: 192.168.1.16:5432 (internal use)
Check status: `nomad job status iieasy`