Add deployment documentation and scripts
This commit is contained in:
138
MANUAL_DEPLOYMENT.md
Normal file
138
MANUAL_DEPLOYMENT.md
Normal file
@@ -0,0 +1,138 @@
|
||||
# Manual Deployment Instructions
|
||||
|
||||
## Quick Deployment to Dev Server
|
||||
|
||||
Since Git authentication is having issues, here's the manual deployment process:
|
||||
|
||||
### Step 1: Create Deployment Package (On Your Local Machine)
|
||||
|
||||
```bash
|
||||
# Create archive excluding unnecessary files
|
||||
tar -czf sdi-deploy.tar.gz \
|
||||
--exclude='node_modules' \
|
||||
--exclude='.git' \
|
||||
--exclude='dist' \
|
||||
--exclude='*.log' \
|
||||
.
|
||||
```
|
||||
|
||||
### Step 2: Upload to Server
|
||||
|
||||
```bash
|
||||
# Upload the archive
|
||||
scp sdi-deploy.tar.gz root@102.69.243.165:/tmp/
|
||||
```
|
||||
|
||||
Password: `clonii@@2014`
|
||||
|
||||
### Step 3: Deploy on Server
|
||||
|
||||
SSH into the server:
|
||||
```bash
|
||||
ssh root@102.69.243.165
|
||||
```
|
||||
|
||||
Then run these commands:
|
||||
|
||||
```bash
|
||||
# Create deployment directory
|
||||
mkdir -p /var/www/sdi-saas
|
||||
cd /var/www/sdi-saas
|
||||
|
||||
# Extract files
|
||||
tar -xzf /tmp/sdi-deploy.tar.gz
|
||||
|
||||
# Install Node.js 20 (if not installed)
|
||||
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
|
||||
apt-get install -y nodejs
|
||||
|
||||
# Install pnpm
|
||||
npm install -g pnpm@8.15.0
|
||||
|
||||
# Install dependencies
|
||||
pnpm install
|
||||
|
||||
# Set up environment files
|
||||
cp apps/api/.env.example apps/api/.env
|
||||
cp apps/worker/.env.example apps/worker/.env
|
||||
cp packages/database/.env.example packages/database/.env
|
||||
|
||||
# Update DATABASE_URL for Docker networking
|
||||
sed -i 's/localhost/postgres/g' apps/api/.env
|
||||
sed -i 's/localhost/postgres/g' apps/worker/.env
|
||||
sed -i 's/localhost/postgres/g' packages/database/.env
|
||||
|
||||
# Generate Prisma client
|
||||
cd packages/database
|
||||
pnpm db:generate
|
||||
|
||||
# Start Docker services
|
||||
cd /var/www/sdi-saas
|
||||
docker-compose up -d
|
||||
|
||||
# Wait for database to be ready
|
||||
sleep 15
|
||||
|
||||
# Run migrations
|
||||
cd packages/database
|
||||
pnpm db:migrate
|
||||
|
||||
# Seed demo data
|
||||
pnpm db:seed
|
||||
|
||||
# Check services are running
|
||||
cd /var/www/sdi-saas
|
||||
docker-compose ps
|
||||
```
|
||||
|
||||
### Step 4: Verify Deployment
|
||||
|
||||
Access the API:
|
||||
- **API**: http://102.69.243.165:3000
|
||||
- **API Docs**: http://102.69.243.165:3000/api/docs
|
||||
|
||||
Check logs:
|
||||
```bash
|
||||
docker-compose logs -f
|
||||
```
|
||||
|
||||
## Alternative: Git Push (If Authentication Works)
|
||||
|
||||
If you can fix the Git authentication issue:
|
||||
|
||||
```bash
|
||||
# On local machine
|
||||
git remote set-url origin https://git.votcloud.com/austindebest/sdi.git
|
||||
git push -u origin main
|
||||
# Enter username: austindebest
|
||||
# Enter password: VcG_3xwbEUyDcMqgKwTTLJP4KoEp!Q9
|
||||
|
||||
# On server
|
||||
cd /var/www
|
||||
git clone https://git.votcloud.com/austindebest/sdi.git sdi-saas
|
||||
cd sdi-saas
|
||||
# Follow deployment steps above
|
||||
```
|
||||
|
||||
## For Future Updates
|
||||
|
||||
```bash
|
||||
# Create new deployment package
|
||||
tar -czf sdi-deploy.tar.gz --exclude='node_modules' --exclude='.git' --exclude='dist' .
|
||||
|
||||
# Upload
|
||||
scp sdi-deploy.tar.gz root@102.69.243.165:/tmp/
|
||||
|
||||
# SSH and update
|
||||
ssh root@102.69.243.165
|
||||
cd /var/www/sdi-saas
|
||||
tar -xzf /tmp/sdi-deploy.tar.gz
|
||||
pnpm install
|
||||
cd packages/database && pnpm db:generate
|
||||
cd /var/www/sdi-saas
|
||||
docker-compose up -d --build
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Ready to proceed with Phase 1 development once deployed!**
|
||||
Reference in New Issue
Block a user