You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
1.9 KiB
85 lines
1.9 KiB
|
3 months ago
|
# Lottery Simple DApp - Deployment Guide
|
||
|
|
|
||
|
|
## Quick Deployment
|
||
|
|
|
||
|
|
### Local Testing
|
||
|
|
```bash
|
||
|
|
# Build and run with Docker
|
||
|
|
./deploy.sh
|
||
|
|
|
||
|
|
# Or manually:
|
||
|
|
docker-compose up --build -d
|
||
|
|
|
||
|
|
# Access at: http://localhost:14888
|
||
|
|
```
|
||
|
|
|
||
|
|
### Remote Server Deployment
|
||
|
|
|
||
|
|
1. **Sync files to server:**
|
||
|
|
```bash
|
||
|
|
# Only sync the necessary frontend files
|
||
|
|
rsync -av --exclude='.git' --exclude='node_modules' --exclude='target' \
|
||
|
|
--exclude='programs' --exclude='client' --exclude='tests' \
|
||
|
|
/home/crappy/lottery/lottery-simple/ user@your-server:/opt/lottery-simple/
|
||
|
|
```
|
||
|
|
|
||
|
|
2. **On the remote server:**
|
||
|
|
```bash
|
||
|
|
cd /opt/lottery-simple
|
||
|
|
./deploy.sh
|
||
|
|
```
|
||
|
|
|
||
|
|
3. **Nginx reverse proxy (optional):**
|
||
|
|
```nginx
|
||
|
|
location /lottery/ {
|
||
|
|
proxy_pass http://localhost:14888/;
|
||
|
|
proxy_set_header Host $host;
|
||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
## Configuration
|
||
|
|
|
||
|
|
### Environment Variables
|
||
|
|
- Edit `config.json` for different environments
|
||
|
|
- Update `programId`, `mint`, and `devWallet` as needed
|
||
|
|
|
||
|
|
### Port Configuration
|
||
|
|
- Default: `14888` (configured in docker-compose.yml)
|
||
|
|
- Health check: `/health`
|
||
|
|
|
||
|
|
## File Structure (Clean)
|
||
|
|
```
|
||
|
|
lottery-simple/
|
||
|
|
├── index.html # Frontend HTML
|
||
|
|
├── styles.css # CSS styles
|
||
|
|
├── app.js # Frontend JavaScript
|
||
|
|
├── config.json # Configuration
|
||
|
|
├── Dockerfile # Docker build
|
||
|
|
├── docker-compose.yml # Docker orchestration
|
||
|
|
├── nginx.conf # Web server config
|
||
|
|
├── deploy.sh # Deployment script
|
||
|
|
└── .dockerignore # Build exclusions
|
||
|
|
```
|
||
|
|
|
||
|
|
## Troubleshooting
|
||
|
|
|
||
|
|
### Check container status:
|
||
|
|
```bash
|
||
|
|
docker-compose ps
|
||
|
|
docker-compose logs
|
||
|
|
```
|
||
|
|
|
||
|
|
### Manual container management:
|
||
|
|
```bash
|
||
|
|
docker-compose stop
|
||
|
|
docker-compose start
|
||
|
|
docker-compose restart
|
||
|
|
```
|
||
|
|
|
||
|
|
### Clean rebuild:
|
||
|
|
```bash
|
||
|
|
docker-compose down
|
||
|
|
docker-compose build --no-cache
|
||
|
|
docker-compose up -d
|
||
|
|
```
|