Skip to content

Latest commit

Β 

History

History
134 lines (93 loc) Β· 3.04 KB

File metadata and controls

134 lines (93 loc) Β· 3.04 KB

Automatic Deployment Guide

This guide contains the necessary steps to automatically deploy your Vue.js frontend and .NET backend applications to your servers via FTP.

πŸš€ Setup

1. Frontend Dependencies

cd src/frontend
npm install  # This will create package-lock.json automatically

2. Backend Dependencies (for macOS)

# Install lftp (for FTP deployment)
brew install lftp

# Install fswatch (for file watching)
brew install fswatch

3. Configure FTP Credentials

For Frontend:

cp src/frontend/.env.deploy.example src/frontend/.env.deploy
# Edit the file and enter your FTP credentials

For Backend:

cp src/backend/.env.deploy.example src/backend/.env.deploy
# Edit the file and enter your API FTP credentials

πŸ“ Usage

Manual Deployment

Frontend:

cd src/frontend
npm run deploy

Backend:

cd src/backend
./scripts/deploy.sh

Automatic Deployment (File Watching)

To watch and automatically deploy both applications with a single command:

./watch-deploy.sh

This command:

  • Watches frontend changes (src/frontend/src)
  • Watches backend changes (src/backend)
  • Automatically builds and deploys when changes are detected

Automatic Deployment with GitHub Actions

For automatic deployment when pushing to GitHub repository:

  1. Go to GitHub repository settings > Secrets and variables > Actions
  2. Add the following secrets:

For Frontend:

  • FTP_HOST: evren.dev
  • FTP_USERNAME: Your FTP username
  • FTP_PASSWORD: Your FTP password

For Backend:

  • FTP_HOST_API: api.evren.dev
  • FTP_USERNAME_API: Your API FTP username
  • FTP_PASSWORD_API: Your API FTP password

πŸ”§ NPM Scripts

Available scripts in the frontend folder:

  • npm run deploy: Build + FTP upload
  • npm run watch-deploy: Watch file changes and auto deploy
  • npm run build: Build only
  • npm run upload: FTP upload only

πŸ“ File Structure

evren.dev/
β”œβ”€β”€ .github/workflows/deploy.yml    # GitHub Actions workflow
β”œβ”€β”€ watch-deploy.sh                 # Auto-watch script
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ frontend/
β”‚   β”‚   β”œβ”€β”€ .env.deploy            # FTP settings (in gitignore)
β”‚   β”‚   β”œβ”€β”€ .env.deploy.example    # FTP settings template
β”‚   β”‚   └── scripts/deploy.js      # Frontend deployment script
β”‚   └── backend/
β”‚       β”œβ”€β”€ .env.deploy            # API FTP settings (in gitignore)
β”‚       β”œβ”€β”€ .env.deploy.example    # API FTP settings template
β”‚       └── scripts/deploy.sh      # Backend deployment script

πŸ”’ Security

  • .env.deploy files should be added to .gitignore
  • Never commit FTP passwords to the repository
  • Use secrets for GitHub Actions

⚠️ Notes

  • Grant execution permissions to script files on first setup:

    chmod +x watch-deploy.sh
    chmod +x src/backend/scripts/deploy.sh
  • lftp is required for backend deployment

  • fswatch is required for file watching

  • If using Windows, WSL or PowerShell scripts may be needed