Collection of utility scripts and tools.
sudo bash scripts/install-docker.shOr from a remote clone:
curl -fsSL https://raw.githubusercontent.com/vthang87/script-tools/main/scripts/install-docker.sh | sudo bashCoolify is a self-hosting platform. The script installs Docker first if it is missing, then runs the official Coolify installer.
Requirements:
- Linux server (Ubuntu 22.04 / 24.04 LTS recommended)
- Root or sudo
- Ports
80,443, and8000open
sudo bash scripts/install-coolify.shOr from a remote clone:
curl -fsSL https://raw.githubusercontent.com/vthang87/script-tools/main/scripts/install-coolify.sh | sudo bashAfter install, open http://YOUR_SERVER_IP:8000.
Optional root user env vars (passed through to Coolify):
sudo ROOT_USERNAME=admin \
ROOT_USER_EMAIL=admin@example.com \
ROOT_USER_PASSWORD='your-password' \
bash scripts/install-coolify.shPublic installer shared across private projects. It prompts for GitHub credentials and repo info, downloads the private deploy/ folder onto the server, and optionally runs bootstrap.sh.
Convention: each private project keeps deploy scripts under deploy/ (or another path you choose).
curl -fsSL https://raw.githubusercontent.com/vthang87/script-tools/main/scripts/install-private-deploy.sh | bashOr locally:
bash scripts/install-private-deploy.shInteractive prompts:
| Input | Default |
|---|---|
| GitHub username | (required) |
| GitHub PAT | (required, secret) |
Repo (owner/name) |
(required) |
| Branch/tag | main |
| Path in repo | deploy |
| Install directory | /opt/<project-name> |
Run bootstrap.sh? |
y if present |
| Bootstrap arguments | optional (e.g. uat) |
Script cần PAT để đọc repo private. Nên tạo token chỉ đọc, giới hạn repo cần deploy, và đặt expiry ngắn (30–90 ngày).
- Đăng nhập GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic)
- Generate new token (classic)
- Điền:
- Note: ví dụ
deploy-server-readonly - Expiration: 30 hoặc 90 ngày
- Note: ví dụ
- Chọn scopes (roles):
| Scope | Bắt buộc? | Mục đích |
|---|---|---|
repo |
Có (repo private) | Đọc nội dung repo / tải tarball deploy/ |
read:packages |
Có nếu image private trên GHCR | docker login ghcr.io + docker pull |
- Generate token → copy chuỗi
ghp_...(chỉ hiện một lần) - Nếu org bật SSO: bấm Configure SSO / Authorize bên cạnh token cho org sở hữu repo
Classic PAT không tách được “chỉ Contents read” khỏi
repo; scoperepogồm cả quyền ghi. Chỉ dùng token này trên server tin cậy, không commit vào git.
- Settings → Developer settings → Personal access tokens → Fine-grained tokens
- Generate new token
- Điền:
- Token name: ví dụ
deploy-scripts-readonly - Expiration: 30 hoặc 90 ngày
- Resource owner: user hoặc org chứa repo
- Repository access: Only select repositories → chọn đúng project cần deploy
- Token name: ví dụ
- Permissions (Repository permissions):
| Permission | Access | Mục đích |
|---|---|---|
| Contents | Read-only | Tải thư mục deploy/ (tarball / API) |
| Metadata | Read-only | Tự bật khi chọn Contents; bắt buộc để API thấy repo |
| Packages | Read-only | Chỉ khi bootstrap pull image private từ GHCR |
- Generate token → copy chuỗi
github_pat_... - Org có thể yêu cầu admin approve fine-grained token trước khi dùng
| Việc | Classic PAT | Fine-grained PAT |
|---|---|---|
install-private-deploy.sh tải deploy/ |
repo |
Contents: Read |
bootstrap / docker pull GHCR private |
thêm read:packages |
thêm Packages: Read |
| Push code / ghi repo | Không cần | Không cấp |
Interactive (script sẽ hỏi username + token):
curl -fsSL https://raw.githubusercontent.com/vthang87/script-tools/main/scripts/install-private-deploy.sh | bashNon-interactive:
NON_INTERACTIVE=1 \
GITHUB_USER=your-github-username \
GITHUB_TOKEN=ghp_xxx \
DEPLOY_REPO=owner/project \
DEPLOY_REF=main \
DEPLOY_HOME=/opt/project \
RUN_BOOTSTRAP=1 \
BOOTSTRAP_ARGS=uat \
bash scripts/install-private-deploy.sh- Không commit token vào repo,
.envpublic, hoặc chat log - Trên server có thể export tạm:
export GITHUB_TOKEN=...rồi xóa sau khi cài (unset GITHUB_TOKEN) - Revoke token cũ tại tokens settings khi hết dùng hoặc nghi lộ
- Account GitHub phải có quyền read trên repo private (collaborator / org member với role tối thiểu Read)