Skip to content

Add docker deployment #1

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 5 commits into from
Apr 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
78 changes: 78 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Server Configuration
SECRET_KEY=your-secret-key
HOST=http://localhost
PORT=21465
DEVICE_NAME=WppConnect
POWERED_BY=WPPConnect-Server
START_ALL_SESSION=true
TOKEN_STORE_TYPE=file
MAX_LISTENERS=15
CUSTOM_USER_DATA_DIR=./userDataDir/

# Webhook Configuration
WEBHOOK_URL=https://your-webhook-url.com/webhook
WEBHOOK_AUTO_DOWNLOAD=false
WEBHOOK_UPLOAD_S3=false
WEBHOOK_READ_MESSAGE=true
WEBHOOK_ALL_UNREAD_ON_START=false
WEBHOOK_LISTEN_ACKS=true
WEBHOOK_ON_PRESENCE_CHANGED=true
WEBHOOK_ON_PARTICIPANTS_CHANGED=true
WEBHOOK_ON_REACTION_MESSAGE=true
WEBHOOK_ON_POLL_RESPONSE=true
WEBHOOK_ON_REVOKED_MESSAGE=true
WEBHOOK_ON_LABEL_UPDATED=true
WEBHOOK_ON_SELF_MESSAGE=false
WEBHOOK_IGNORE=status@broadcast

# WebSocket Configuration
WEBSOCKET_AUTO_DOWNLOAD=false
WEBSOCKET_UPLOAD_S3=false

# Chatwoot Configuration
CHATWOOT_SEND_QR_CODE=true
CHATWOOT_SEND_STATUS=true

# Archive Configuration
ARCHIVE_ENABLE=false
ARCHIVE_WAIT_TIME=10
ARCHIVE_DAYS_TO_ARCHIVE=45

# Log Configuration
LOG_LEVEL=silly
LOG_LOGGER=console,file

# Browser Arguments
# BROWSER_ARGS=--disable-web-security,--no-sandbox,--disable-web-security

# Link Preview API Servers
# LINK_PREVIEW_API_SERVERS=https://www.yourserver.com/wa-js-api-server

# Mapper Configuration
MAPPER_ENABLE=false
MAPPER_PREFIX=tagone-

# MongoDB Configuration
MONGODB_DATABASE=tokens
MONGODB_COLLECTION=
MONGODB_USER=
MONGODB_PASSWORD=
MONGODB_HOST=
MONGODB_IS_REMOTE=true
MONGODB_URL_REMOTE=
MONGODB_PORT=27017

# Redis Configuration
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=
REDIS_DB=0
REDIS_PREFIX=docker

# AWS S3 Configuration
AWS_S3_REGION=sa-east-1
AWS_S3_ACCESS_KEY_ID=
AWS_S3_SECRET_KEY=
AWS_S3_DEFAULT_BUCKET_NAME=
AWS_S3_ENDPOINT=
AWS_S3_FORCE_PATH_STYLE=false
44 changes: 44 additions & 0 deletions .github/workflows/build-github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Docker Image CI (GHCR)

on:
push:
branches: [ main ]
tags:
- '*'

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read

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

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

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=tag
type=ref,event=branch
type=sha

- name: Build and Push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
54 changes: 25 additions & 29 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
name: build
name: Docker Image CI

on:
push:
branches:
- '*'
pull_request:
branches:
branches: [ main ]
tags:
- '*'

jobs:
build:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -33,38 +31,36 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-

- name: Install Dependencies
run: yarn install

- name: Build source
run: yarn build

lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Node
uses: actions/[email protected]
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
node-version: 22.14.0

- name: Get yarn cache directory
id: yarn-cache
run: |
echo "::set-output name=dir::$(yarn cache dir)"

- name: Setup yarn cache
uses: actions/cache@v4
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
images: promasoud/wppconnect-server
tags: |
type=ref,event=tag
type=ref,event=branch
type=sha

- name: Install Dependencies
run: yarn install

- name: Lint source
run: yarn lint
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
97 changes: 97 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"secretKey": "THISISMYSECURETOKEN",
"host": "http://localhost",
"port": "21465",
"deviceName": "WppConnect",
"poweredBy": "WPPConnect-Server",
"startAllSession": true,
"tokenStoreType": "file",
"maxListeners": 15,
"customUserDataDir": "./userDataDir/",
"webhook": {
"url": null,
"autoDownload": true,
"uploadS3": false,
"readMessage": true,
"allUnreadOnStart": false,
"listenAcks": true,
"onPresenceChanged": true,
"onParticipantsChanged": true,
"onReactionMessage": true,
"onPollResponse": true,
"onRevokedMessage": true,
"onLabelUpdated": true,
"onSelfMessage": false,
"ignore": ["status@broadcast"]
},
"websocket": {
"autoDownload": false,
"uploadS3": false
},
"chatwoot": {
"sendQrCode": true,
"sendStatus": true
},
"archive": {
"enable": false,
"waitTime": 10,
"daysToArchive": 45
},
"log": {
"level": "silly",
"logger": ["console", "file"]
},
"createOptions": {
"browserArgs": [
"--disable-web-security",
"--no-sandbox",
"--disable-web-security",
"--aggressive-cache-discard",
"--disable-cache",
"--disable-application-cache",
"--disable-offline-load-stale-cache",
"--disk-cache-size=0",
"--disable-background-networking",
"--disable-default-apps",
"--disable-extensions",
"--disable-sync",
"--disable-translate",
"--hide-scrollbars",
"--metrics-recording-only",
"--mute-audio",
"--no-first-run",
"--safebrowsing-disable-auto-update",
"--ignore-certificate-errors",
"--ignore-ssl-errors",
"--ignore-certificate-errors-spki-list"
],
"linkPreviewApiServers": null
},
"mapper": {
"enable": false,
"prefix": "tagone-"
},
"db": {
"mongodbDatabase": "tokens",
"mongodbCollection": "",
"mongodbUser": "",
"mongodbPassword": "",
"mongodbHost": "",
"mongoIsRemote": true,
"mongoURLRemote": "",
"mongodbPort": 27017,
"redisHost": "localhost",
"redisPort": 6379,
"redisPassword": "",
"redisDb": 0,
"redisPrefix": "docker"
},
"aws_s3": {
"region": "sa-east-1",
"access_key_id": null,
"secret_key": null,
"defaultBucketName": null,
"endpoint": null,
"forcePathStyle": null
}
}
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ services:
- "21465:21465"

volumes:
wppconnect_tokens: {}
wppconnect_tokens:
Loading