-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
150 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Deploying | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: SSH into server and deploy Pagu | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
port: ${{ secrets.SSH_PORT }} | ||
key: ${{ secrets.SSH_KEY }} | ||
script: | | ||
cd source | ||
git pull | ||
export PAGU_DB_ROOT_PASSWORD=${{ secrets.PAGU_DB_ROOT_PASSWORD }} | ||
export PAGU_DB_USER=${{ secrets.PAGU_DB_USER }} | ||
export PAGU_DB_USER_PASSWORD=${{ secrets.PAGU_DB_USER_PASSWORD }} | ||
export PHPMYADMIN_PORT=${{ secrets.PHPMYADMIN_PORT }} | ||
bash ./deployment/deploy.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Builder stage | ||
FROM golang:1.23.3-alpine AS builder | ||
RUN apk add --no-cache bash make | ||
WORKDIR /pagu | ||
COPY .. . | ||
RUN make build-discord build-telegram | ||
|
||
# Discord bot | ||
FROM alpine:3.14 AS discord | ||
WORKDIR /bin | ||
COPY --from=builder /pagu/build/pagu-discord . | ||
CMD ["./pagu-discord", "-c", "/pagu/config.yml", "run"] | ||
|
||
# Telegram bot | ||
FROM alpine:3.14 AS telegram | ||
WORKDIR /bin | ||
COPY --from=builder /pagu/build/pagu-telegram . | ||
CMD ["./pagu-telegram", "-c", "/pagu/config.yml", "run"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
## Auto-Deployment for Pagu Project | ||
|
||
This project includes an automated deployment process for | ||
both the `stable` and `latest` versions of the Pagu Discord and Telegram bots. | ||
|
||
### Deployment Overview | ||
|
||
The deployment system uses the following mechanisms: | ||
|
||
- **Stable Version**: Activated when a Git tag is pushed to the repository. | ||
- **Latest Version**: Activated when changes are pushed to the `main` branch. | ||
|
||
### How to Create a Tag: | ||
|
||
To create a tag and push it to the repository, follow these steps: | ||
|
||
1. Ensure that the origin is set to the current repository, not your fork. | ||
2. Ensure that the Pagu's [version](../version.go) is updated. | ||
3. Run the following commands: | ||
|
||
```bash | ||
VERSION=0.?.? | ||
git pull origin | ||
git tag -s -a v${VERSION} -m "Version ${VERSION}" | ||
git push origin v${VERSION} | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
DOCKER_TAG="latest" | ||
|
||
TAG=$(git describe --tags --exact-match 2> /dev/null) || echo "" | ||
|
||
if [[ -n "$TAG" ]]; then | ||
DOCKER_TAG="stable" | ||
fi | ||
|
||
echo "Building ${DOCKER_TAG} version" | ||
|
||
docker build -t pagu-discord:${DOCKER_TAG} -f ./deployment/Dockerfile . --target discord | ||
docker build -t pagu-telegram:${DOCKER_TAG} -f ./deployment/Dockerfile . --target telegram | ||
|
||
docker compose -f ./deployment/docker-compose.yml down | ||
docker compose -f ./deployment/docker-compose.yml up -d | ||
|
||
## Some cleanup | ||
echo "Cleanup" | ||
|
||
docker builder prune -f | ||
docker image prune -f | ||
docker container prune -f |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,115 +1,87 @@ | ||
version: '3' | ||
|
||
networks: | ||
pagu-network: | ||
external: true | ||
|
||
services: | ||
pagu-db: | ||
image: mysql:5.7.42-debian | ||
image: mysql:8.0.40-debian | ||
hostname: pagu-db | ||
environment: | ||
MYSQL_ROOT_PASSWORD: ${PAGU_DB_PASSWORD} | ||
MYSQL_DATABASE: pagu | ||
expose: | ||
- 4417 | ||
ports: | ||
- "4417:3306" | ||
MYSQL_ROOT_PASSWORD: ${PAGU_DB_ROOT_PASSWORD} | ||
MYSQL_USER: ${PAGU_DB_USER} | ||
MYSQL_PASSWORD: ${PAGU_DB_USER_PASSWORD} | ||
container_name: pagu-db | ||
networks: | ||
pagu-network: | ||
volumes: | ||
- pagu-db-data:/var/lib/mysql | ||
- ${HOME}/mysql_data:/var/lib/mysql | ||
networks: | ||
- pagu-network | ||
healthcheck: | ||
test: ["CMD", "mysqladmin" ,"ping", "-h", pagu-db] | ||
timeout: 5s | ||
retries: 10 | ||
|
||
pagu-phpmyadmin: | ||
image: phpmyadmin/phpmyadmin | ||
environment: | ||
PMA_HOST: pagu-db | ||
container_name: pagu-phpmyadmin | ||
ports: | ||
- "4418:80" | ||
networks: | ||
pagu-network: | ||
- "${PHPMYADMIN_PORT}:80" | ||
depends_on: | ||
- pagu-db | ||
pagu-cli: | ||
build: | ||
context: ../. | ||
dockerfile: deployment/cli/Dockerfile | ||
hostname: pagu-cli | ||
container_name: pagu-cli | ||
pagu-db: | ||
condition: service_healthy | ||
networks: | ||
pagu-network: | ||
depends_on: | ||
- pagu-db | ||
volumes: | ||
- ../config/config.yml:/config/config.yml | ||
- ../config/wallets/main_wallet:/config/wallets/main_wallet | ||
- ../config/wallets/test_wallet:/config/wallets/test_wallet | ||
pagu-discord: | ||
build: | ||
context: ../. | ||
dockerfile: deployment/discord/Dockerfile.Mainnet | ||
hostname: pagu-discord-mainnet | ||
container_name: pagu-discord | ||
- pagu-network | ||
|
||
pagu-discord-mainnet: | ||
image: pagu-discord:stable | ||
container_name: pagu-discord-mainnet | ||
networks: | ||
pagu-network: | ||
depends_on: | ||
- pagu-db | ||
- pagu-phpmyadmin | ||
volumes: | ||
- ../config/config.mainnet.yml:/config/config.yml | ||
- ../config/wallets/main_wallet:/config/wallets/main_wallet | ||
pagu-discord-mod: | ||
build: | ||
context: ../. | ||
dockerfile: deployment/discord/Dockerfile.Mod | ||
hostname: pagu-discord-mod | ||
container_name: pagu-discord-mod | ||
- ${HOME}/pagu-discord-mainnet:/pagu | ||
|
||
pagu-discord-staging: | ||
image: pagu-discord:latest | ||
container_name: pagu-discord-staging | ||
networks: | ||
pagu-network: | ||
depends_on: | ||
- pagu-db | ||
- pagu-phpmyadmin | ||
volumes: | ||
- ../config/config.mod.yml:/config/config.yml | ||
- ../config/templates:/config/templates | ||
- ../config/wallets/main_wallet:/config/wallets/main_wallet | ||
- ${HOME}/pagu-discord-staging:/pagu | ||
|
||
pagu-discord-testnet: | ||
build: | ||
context: ../. | ||
dockerfile: deployment/discord/Dockerfile.Testnet | ||
hostname: pagu-discord-testnet | ||
image: pagu-discord:latest | ||
container_name: pagu-discord-testnet | ||
networks: | ||
pagu-network: | ||
depends_on: | ||
- pagu-db | ||
- pagu-phpmyadmin | ||
volumes: | ||
- ../config/config.testnet.yml:/config/config.yml | ||
- ../config/wallets/testnet_wallet:/config/wallets/testnet_wallet | ||
pagu-telegram: | ||
build: | ||
context: ../. | ||
dockerfile: deployment/telegram/Dockerfile.Mainnet | ||
hostname: pagu-telegram-mainnet | ||
container_name: pagu-telegram | ||
- ${HOME}/pagu-discord-testnet:/pagu | ||
|
||
pagu-discord-moderator: | ||
image: pagu-discord:stable | ||
container_name: pagu-discord-moderator | ||
networks: | ||
pagu-network: | ||
depends_on: | ||
- pagu-db | ||
- pagu-phpmyadmin | ||
volumes: | ||
- ../config/config.mainnet.yml:/config/config.yml | ||
- ../config/wallets/main_wallet:/config/wallets/main_wallet | ||
pagu-node: | ||
hostname: pagu-node | ||
domainname: pagu-node | ||
container_name: pagu-node | ||
image: pactus/pactus:latest | ||
command: pactus-daemon start -w ./../../../pactus | ||
restart: always | ||
ports: | ||
- "50051:50051" | ||
volumes: | ||
- ./../../../pactus:/pactus | ||
- ${HOME}/pagu-discord-moderator:/pagu | ||
|
||
pagu-telegram-mainnet: | ||
image: pagu-telegram:stable | ||
container_name: pagu-telegram-mainnet | ||
networks: | ||
pagu-network: | ||
depends_on: | ||
- pagu-phpmyadmin | ||
volumes: | ||
- ${HOME}/pagu-telegram-mainnet:/pagu | ||
|
||
volumes: | ||
pagu-db-data: { } | ||
pagu-volume: | ||
|
||
networks: | ||
pagu-network: |
This file was deleted.
Oops, something went wrong.