|
| 1 | +# BuildCast 🚀 |
| 2 | + |
| 3 | +**Frontend Deployment Automation Tool** |
| 4 | + |
| 5 | +**Main problem:** `front-dev should manual build and send buildp path on other dev servers` |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +## Table of Contents |
| 12 | +- [Features](#-features) |
| 13 | +- [Installation](#-installation) |
| 14 | +- [Configuration](#-configuration) |
| 15 | +- [Usage](#-usage) |
| 16 | +- [Technical Details](#-technical-details) |
| 17 | + |
| 18 | +## ✨ Features |
| 19 | +- 🔄 Environment variable substitution in `.env` files |
| 20 | +- 🏗️ Build automation with custom commands |
| 21 | +- 🚀 Multi-server SFTP deployment |
| 22 | +- 🔒 Secure credential management |
| 23 | +- 📊 Detailed logging for debugging |
| 24 | + |
| 25 | +## 📦 Installation |
| 26 | + |
| 27 | +### Prerequisites |
| 28 | +- Go 1.18+ |
| 29 | +- Git |
| 30 | + |
| 31 | +### Steps |
| 32 | +```bash |
| 33 | +git clone https://github.com/17neverends/buildcast.git |
| 34 | +cd buildcast |
| 35 | +go mod download |
| 36 | +go build -o buildcast main.go |
| 37 | +``` |
| 38 | + |
| 39 | +## ⚙️ Configuration |
| 40 | + |
| 41 | +- config.json |
| 42 | + |
| 43 | +```json |
| 44 | +{ |
| 45 | + // main settings |
| 46 | + "main_cmd": "npm run build", // cmd for build frontend app |
| 47 | + "build_output": "build", // path name for build files output |
| 48 | + "frontend_env_path": ".env", // path to env file |
| 49 | + "env_host": "REACT_APP_API_URL=", // field in env file for change |
| 50 | + |
| 51 | + // individual remote server settings |
| 52 | + "servers": [ |
| 53 | + { |
| 54 | + "ip": "xx.xx.xx.xxx", // IP for connect |
| 55 | + "password": "...", // password for connect |
| 56 | + "user": "root", // system username |
| 57 | + "host": "https://test.io", // this value will be override in .env |
| 58 | + "sftp_port": 22, // sftp connection port |
| 59 | + "path": "/home/project" // path for download files on remore server |
| 60 | + } |
| 61 | + ] |
| 62 | +} |
| 63 | +``` |
| 64 | + |
| 65 | +## 🚀 Usage |
| 66 | + |
| 67 | +- Basic commands |
| 68 | + |
| 69 | + `./buildcast --config=config.json --service=admin_dashboard` |
| 70 | + |
| 71 | + |
| 72 | +- Command Line Options |
| 73 | + |
| 74 | + | Flag | Description | |
| 75 | + |------ |------------- | |
| 76 | + | --config | Path to configuration file | |
| 77 | + |--service | Service name suffix for deployment path | |
| 78 | + |
| 79 | +## 🛠 Technical Details |
| 80 | + |
| 81 | +### Workflow |
| 82 | +1. Reads configuration file |
| 83 | + |
| 84 | +2. Backs up original .env file |
| 85 | + |
| 86 | +3. For each server: |
| 87 | + - Updates environment variables |
| 88 | + |
| 89 | + - Executes build command |
| 90 | + |
| 91 | + - Cleans target directory |
| 92 | + |
| 93 | + - Deploys via SFTP |
| 94 | + |
| 95 | + - Restores original .env |
| 96 | + |
| 97 | +### Dependencies |
| 98 | +- github.com/pkg/sftp |
| 99 | + |
| 100 | +- golang.org/x/crypto/ssh |
0 commit comments