Skip to content

🚀 release: v1.0.0-beta.2 #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Jun 22, 2025
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2b91b56
Initial plan for issue
Copilot Jun 21, 2025
23241e1
Add Dockerfile and .dockerignore for containerized deployment
Copilot Jun 21, 2025
a291fa6
Update README with Docker deployment instructions
Copilot Jun 21, 2025
71ab6e2
Streamline .dockerignore to focus on Node.js essentials only
Copilot Jun 21, 2025
65b8834
Initial plan for issue
Copilot Jun 21, 2025
4b1bdd6
Add security notice to Docker section in README.md
Copilot Jun 21, 2025
147c40d
Bump version to 1.0.0-beta.2 for Docker feature addition
Copilot Jun 21, 2025
76e53ec
Merge pull request #23 from wgtechlabs/copilot/fix-beefc49d-d8f9-4185…
warengonzaga Jun 21, 2025
bad476e
Refactor Docker preinstall approach to use environment variables inst…
Copilot Jun 21, 2025
4c232fd
Merge pull request #22 from wgtechlabs/copilot/fix-56e5a116-4122-4aee…
warengonzaga Jun 21, 2025
b7d44f5
📦 new: add docker support
warengonzaga Jun 21, 2025
687bdb9
☕ chore: update redis urls in readme
warengonzaga Jun 21, 2025
d01d68f
☕ chore: remove docker files
warengonzaga Jun 22, 2025
a964225
📦 new: add docker support
warengonzaga Jun 22, 2025
c2ca55d
✨ tweak: refactor Docker setup and enhance documentation for Unthread…
warengonzaga Jun 22, 2025
24473cf
☕ chore: update environment variables
warengonzaga Jun 22, 2025
ef2fa31
📦 new: add workflows and update env
warengonzaga Jun 22, 2025
cfd7ea8
✨ tweak: update docker-compose for server
warengonzaga Jun 22, 2025
9ec4797
🐛 fix: security issues
warengonzaga Jun 22, 2025
1360e34
✨ tweak: update dockerfile and dependencies
warengonzaga Jun 22, 2025
995171d
✨ tweak: update node version and dependencies
warengonzaga Jun 22, 2025
7c0900a
✨ tweak: enhance documentation and security measures
warengonzaga Jun 22, 2025
16aa102
✨ tweak: update sbom generation script
warengonzaga Jun 22, 2025
fc79c45
✨ tweak: update sbom generation script
warengonzaga Jun 22, 2025
5941366
✨ tweak: update sbom generation
warengonzaga Jun 22, 2025
8d2c395
✨ tweak: improve sbom script checks
warengonzaga Jun 22, 2025
a9a8a38
✨ tweak: update sbom script dependencies
warengonzaga Jun 22, 2025
ffbf58b
✨ tweak: update node version
warengonzaga Jun 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Include any files or directories that you don't want to be copied to your
# container here (e.g., local build artifacts, temporary files, etc.).
#
# For more help, visit the .dockerignore file reference guide at
# https://docs.docker.com/go/build-context-dockerignore/

**/.classpath
**/.dockerignore
**/.env
**/.env.local
**/.env.development
**/.env.production
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.next
**/.cache
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/charts
**/docker-compose*
**/compose.y*ml
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
**/dist
**/*.log
**/coverage
**/.nyc_output
**/README.md
**/LICENSE
**/CONTRIBUTING.md
**/CODE_OF_CONDUCT.md
**/SECURITY.md
**/*.test.ts
**/*.spec.ts
**/build
**/dist
LICENSE
README.md
35 changes: 29 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
# =============================================================================
# UNTHREAD TELEGRAM BOT - ENVIRONMENT CONFIGURATION
# =============================================================================
# Copy this file to .env and fill in your actual values
# =============================================================================

# ======= Bot Configuration =======
TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here
UNTHREAD_API_KEY=your_unthread_api_key_here
UNTHREAD_CHANNEL_ID=your_unthread_channel_id_here
UNTHREAD_SLACK_CHANNEL_ID=your_unthread_slack_channel_id_here
UNTHREAD_WEBHOOK_SECRET=your_unthread_webhook_secret_here
PLATFORM_REDIS_URL=your_platform_redis_url_here
WEBHOOK_REDIS_URL=your_webhook_redis_url_here
POSTGRES_URL=postgresql://username:password@localhost:5432/unthread_bot
WEBHOOK_POLL_INTERVAL=1000

# ======= Infrastructure =======
# Database Credentials (CHANGE THESE IN PRODUCTION!)
POSTGRES_USER=postgres
POSTGRES_PASSWORD=your_secure_password_here

# Local: redis://localhost:6379, redis://localhost:6380
# Docker: redis://redis-platform:6379, redis://redis-webhook:6379
PLATFORM_REDIS_URL=redis://localhost:6379
WEBHOOK_REDIS_URL=redis://localhost:6380

# Local: postgresql://postgres:postgres@localhost:5432/unthread_telegram_bot
# Docker: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres-platform:5432/unthread_telegram_bot
POSTGRES_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:5432/unthread_telegram_bot

# ======= Application Settings =======
NODE_ENV=development
COMPANY_NAME=Unthread
WEBHOOK_POLL_INTERVAL=1000
COMPANY_NAME=Unthread

# SSL Configuration (true=secure default, false=local Docker only)
DATABASE_SSL_VALIDATE=true
75 changes: 75 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Build

on:
push:
branches: [dev]

env:
REGISTRY_DOCKERHUB: wgtechlabs/unthread-telegram-bot
REGISTRY_GHCR: ghcr.io/wgtechlabs/unthread-telegram-bot

jobs:
build-dev:
name: Build Development Images
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
run: |
echo "short_sha=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
echo "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT

- name: Build and push development images
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64
tags: |
${{ env.REGISTRY_DOCKERHUB }}:dev
${{ env.REGISTRY_DOCKERHUB }}:dev-${{ steps.meta.outputs.short_sha }}
${{ env.REGISTRY_GHCR }}:dev
${{ env.REGISTRY_GHCR }}:dev-${{ steps.meta.outputs.short_sha }}
labels: |
org.opencontainers.image.title=Unthread Telegram Bot
org.opencontainers.image.description=Turn private Telegram groups into real-time support ticket hubs — powered by Unthread.io.
org.opencontainers.image.version=dev-${{ steps.meta.outputs.short_sha }}
org.opencontainers.image.created=${{ steps.meta.outputs.build_date }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.licenses=GPL-3.0
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Development build summary
run: |
echo "## 🔨 Development Build Complete" >> $GITHUB_STEP_SUMMARY
echo "**Images built and pushed:**" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ env.REGISTRY_DOCKERHUB }}:dev\`" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ env.REGISTRY_DOCKERHUB }}:dev-${{ steps.meta.outputs.short_sha }}\`" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ env.REGISTRY_GHCR }}:dev\`" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ env.REGISTRY_GHCR }}:dev-${{ steps.meta.outputs.short_sha }}\`" >> $GITHUB_STEP_SUMMARY
echo "**Test the dev image:**" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
echo "docker pull ${{ env.REGISTRY_DOCKERHUB }}:dev" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
139 changes: 139 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Release

on:
release:
types: [published]

env:
REGISTRY_DOCKERHUB: wgtechlabs/unthread-telegram-bot
REGISTRY_GHCR: ghcr.io/wgtechlabs/unthread-telegram-bot

jobs:
build-production:
name: Build Production Images
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: read
packages: write
security-events: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: cloud
endpoint: "wgtechlabs/unthread-bot-builder"
install: true

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract version from package.json
id: version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "major=$(echo $VERSION | cut -d. -f1)" >> $GITHUB_OUTPUT
echo "minor=$(echo $VERSION | cut -d. -f1-2)" >> $GITHUB_OUTPUT
echo "patch=$(echo $VERSION | cut -d. -f1-3)" >> $GITHUB_OUTPUT
echo "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT

- name: Generate Docker tags
id: tags
run: |
VERSION="${{ steps.version.outputs.version }}"
MAJOR="${{ steps.version.outputs.major }}"
MINOR="${{ steps.version.outputs.minor }}"
PATCH="${{ steps.version.outputs.patch }}"

# Docker Hub tags (no 'v' prefix)
DOCKERHUB_TAGS="${{ env.REGISTRY_DOCKERHUB }}:latest"
DOCKERHUB_TAGS="$DOCKERHUB_TAGS,${{ env.REGISTRY_DOCKERHUB }}:$VERSION"
DOCKERHUB_TAGS="$DOCKERHUB_TAGS,${{ env.REGISTRY_DOCKERHUB }}:$PATCH"
DOCKERHUB_TAGS="$DOCKERHUB_TAGS,${{ env.REGISTRY_DOCKERHUB }}:$MINOR"
DOCKERHUB_TAGS="$DOCKERHUB_TAGS,${{ env.REGISTRY_DOCKERHUB }}:$MAJOR"

# GitHub Container Registry tags (with 'v' prefix)
GHCR_TAGS="${{ env.REGISTRY_GHCR }}:latest"
GHCR_TAGS="$GHCR_TAGS,${{ env.REGISTRY_GHCR }}:v$VERSION"
GHCR_TAGS="$GHCR_TAGS,${{ env.REGISTRY_GHCR }}:v$PATCH"
GHCR_TAGS="$GHCR_TAGS,${{ env.REGISTRY_GHCR }}:v$MINOR"
GHCR_TAGS="$GHCR_TAGS,${{ env.REGISTRY_GHCR }}:v$MAJOR"

# Combine all tags
ALL_TAGS="$DOCKERHUB_TAGS,$GHCR_TAGS"
echo "tags=$ALL_TAGS" >> $GITHUB_OUTPUT

- name: Build and push production images
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.tags.outputs.tags }}
labels: |
org.opencontainers.image.title=Unthread Telegram Bot
org.opencontainers.image.description=Turn private Telegram groups into real-time support ticket hubs — powered by Unthread.io.
org.opencontainers.image.version=${{ steps.version.outputs.version }}
org.opencontainers.image.created=${{ steps.version.outputs.build_date }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.url=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.licenses=GPL-3.0
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
continue-on-error: true
with:
image-ref: ${{ env.REGISTRY_DOCKERHUB }}:${{ steps.version.outputs.version }}
format: 'sarif'
output: 'trivy-results.sarif'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
if: always() && hashFiles('trivy-results.sarif') != ''
with:
sarif_file: 'trivy-results.sarif'

- name: Production release summary
run: |
echo "## 🚀 Production Release Complete" >> $GITHUB_STEP_SUMMARY
echo "**Version:** \`${{ steps.version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
echo "**Release:** \`${{ github.event.release.tag_name }}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Docker Hub Images:**" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ env.REGISTRY_DOCKERHUB }}:latest\`" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ env.REGISTRY_DOCKERHUB }}:${{ steps.version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ env.REGISTRY_DOCKERHUB }}:${{ steps.version.outputs.patch }}\`" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ env.REGISTRY_DOCKERHUB }}:${{ steps.version.outputs.minor }}\`" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ env.REGISTRY_DOCKERHUB }}:${{ steps.version.outputs.major }}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**GitHub Container Registry Images:**" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ env.REGISTRY_GHCR }}:latest\`" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ env.REGISTRY_GHCR }}:v${{ steps.version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ env.REGISTRY_GHCR }}:v${{ steps.version.outputs.patch }}\`" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ env.REGISTRY_GHCR }}:v${{ steps.version.outputs.minor }}\`" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ env.REGISTRY_GHCR }}:v${{ steps.version.outputs.major }}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Deploy with:**" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
echo "docker pull ${{ env.REGISTRY_DOCKERHUB }}:latest" >> $GITHUB_STEP_SUMMARY
echo "# OR" >> $GITHUB_STEP_SUMMARY
echo "docker pull ${{ env.REGISTRY_GHCR }}:latest" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
37 changes: 37 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Validate

on:
pull_request:
branches: [dev, main]

jobs:
validate:
name: Validate Changes
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Type checking
run: yarn type-check

- name: Build TypeScript
run: yarn build

- name: Test Docker build (no push)
run: |
echo "Testing Docker build..."
docker build -t test-build .
echo "Build successful, cleaning up..."
docker image rm test-build
echo "✅ Docker build test completed"
Loading