Skip to content

Commit

Permalink
fix(devops): add deployment workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
apogiatzis committed Nov 21, 2024
1 parent 12c2e16 commit 9f9c0c4
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 52 deletions.
39 changes: 0 additions & 39 deletions .circleci/config.yml

This file was deleted.

57 changes: 57 additions & 0 deletions .github/workflows/deploy_bot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Deploy Bot

on:
push:
branches:
- main

jobs:
dump-env:
runs-on: ubuntu-latest
environment: PROD

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

- name: Write Secret to .env File
env:
ENV_FILE: ${{ secrets.ENV_FILE }}
run: |
echo "$ENV_FILE" > .env
echo ".env file created with the contents of ENV_FILE secret"
- name: Set up SSH for Deployment
env:
SSH_USER: ${{ secrets.SSH_USER }}
SSH_PASSWORD: ${{ secrets.SSH_PASSWORD }}
SSH_HOST: ${{ secrets.SSH_HOST }}
run: |
apt-get update && apt-get install -y sshpass
sshpass -p "$SSH_PASSWORD" ssh -o StrictHostKeyChecking=no "$SSH_USER@$SSH_HOST" "mkdir -p ~/ovisbot"
- name: Upload Code to Server
env:
SSH_USER: ${{ secrets.SSH_USER }}
SSH_PASSWORD: ${{ secrets.SSH_PASSWORD }}
SSH_HOST: ${{ secrets.SSH_HOST }}
run: |
sshpass -p "$SSH_PASSWORD" rsync -avz --exclude '.git' ./ "$SSH_USER@$SSH_HOST:~/ovisbot"
- name: Deploy Application
env:
SSH_USER: ${{ secrets.SSH_USER }}
SSH_PASSWORD: ${{ secrets.SSH_PASSWORD }}
SSH_HOST: ${{ secrets.SSH_HOST }}
run: |
sshpass -p "$SSH_PASSWORD" ssh -o StrictHostKeyChecking=no "$SSH_USER@$SSH_HOST" << 'EOF'
cd ~/ovisbot
if [ -f docker-compose.yml ]; then
docker compose -f docker-compose.yml -f docker-compose.prod.yml down || true
docker compose -f docker-compose.yml -f docker-compose.prod.yml pull
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
else
echo "docker-compose.yml not found in the repository!"
exit 1
fi
EOF
8 changes: 0 additions & 8 deletions Dockerfile-prod

This file was deleted.

7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<a href="https://github.com/ambv/black">
<img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="Code Style: Black">
</a>
</a>
</p>

<p align="center">
Expand All @@ -41,7 +41,7 @@

# Overview

OvisBot is a modular, feature-extensive Discord bot for managing CTF teams through discord. It facilitates collaboration and organisation by providing well defined commands to create/delete/update discord category/channels in order to structure CTF problems and provide more efficient team commmunication. In addition the bot provides basic utility functions to assist the solving process of CTF challenges (encoding schemes, etc.. ). Finally, promotes competitiveness amongst team members by providing a aut-synchronised leaderboard to common cybersecurity training platforms such as <a href="https://cryptohack.org/">CryptoHack</a> and <a href="https://www.hackthebox.eu/">Hack The Box</a>,
OvisBot is a modular, feature-extensive Discord bot for managing CTF teams through discord. It facilitates collaboration and organisation by providing well defined commands to create/delete/update discord category/channels in order to structure CTF problems and provide more efficient team commmunication. In addition the bot provides basic utility functions to assist the solving process of CTF challenges (encoding schemes, etc.. ). Finally, promotes competitiveness amongst team members by providing a aut-synchronised leaderboard to common cybersecurity training platforms such as <a href="https://cryptohack.org/">CryptoHack</a> and <a href="https://www.hackthebox.eu/">Hack The Box</a>,

Note that the majority of the features are provided by isolated plugins and thus they can be enabled/disabled on demand.

Expand Down Expand Up @@ -70,7 +70,7 @@ OvisBot cli provides the `setupenv` command which assists the creation of a .env
```
ovisbot setupenv
```
At the end of the process a new `.env` file will be create in your current directory.
At the end of the process a new `.env` file will be create in your current directory.

Finally to launch the bot, run:
```
Expand Down Expand Up @@ -107,6 +107,7 @@ Have a feature request? Make a GitHub issue and feel free to contribute. To get
- [npitsillos](https://github.com/npitsillos)
- [Sikkis](https://github.com/Sikkis)
- [ishtar](https://github.com/xmpf)
- [cfalas](https://github.com/cfalas)

# License

Expand Down
3 changes: 1 addition & 2 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
services:
bot:
build:
dockerfile: Dockerfile-prod
image: ghcr.io/cybermouflons/ovisbot:latest
volumes: []

0 comments on commit 9f9c0c4

Please sign in to comment.