# Update system
sudo apt update && sudo apt upgrade -y
# Install required packages
sudo apt install -y git curl htop ufw
# Configure firewall
sudo ufw allow OpenSSH
sudo ufw allow http
sudo ufw allow https
sudo ufw enable
# Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# Add current user to docker group
sudo usermod -aG docker $USER
# Install Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# Clone repository
git clone https://github.com/DevOpsTerminal/text2iac.git
cd text2iac
# Copy and configure environment variables
cp .env.example .env
nano .env # Edit with your configuration
# Build and start containers
make build
make start
sudo apt install -y nginx
sudo nano /etc/nginx/sites-available/text2iac
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /api {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
sudo ln -s /etc/nginx/sites-available/text2iac /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
# Install Certbot
sudo apt install -y certbot python3-certbot-nginx
# Obtain SSL certificate
sudo certbot --nginx -d your-domain.com
# Test automatic renewal
sudo certbot renew --dry-run
Variable | Required | Description | Default |
---|---|---|---|
NODE_ENV |
No | Node environment | production |
PORT |
No | API server port | 3000 |
OPENAI_API_KEY |
Yes | OpenAI API key | |
JWT_SECRET |
Yes | JWT secret key | |
DATABASE_URL |
Yes | Database connection URL | |
REDIS_URL |
No | Redis connection URL | redis://redis:6379 |
# docker-compose.yml
api:
image: text2iac/api:latest
deploy:
replicas: 3
resources:
limits:
cpus: '0.5'
memory: 1G
For production, consider using managed database services:
# View logs
docker-compose logs -f
# Set up log rotation
sudo nano /etc/logrotate.d/docker
# Create backup
docker-compose exec -T db pg_dump -U postgres text2iac > backup.sql
# Restore
cat backup.sql | docker-compose exec -T db psql -U postgres text2iac
# Create backup
tar -czf data_backup.tar.gz /var/lib/docker/volumes/text2iac_*
git pull
docker-compose build --no-cache
docker-compose up -d --force-recreate
# Check container status
docker ps
# Check logs
docker-compose logs -f
# Check disk usage
df -h
netstat -tuln | grep <port>
to check# Restart Docker
sudo systemctl restart docker
# Check container logs
docker logs <container_id>
.env
docker-compose ps db
For additional help, please open an issue on our GitHub repository.