diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index b5bcf75..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,39 +0,0 @@ -# Python CircleCI 2.0 configuration file -# -# Check https://circleci.com/docs/2.0/language-python/ for more details -# -version: 2 -jobs: - deploy: - docker: - # specify the version you desire here - # use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers` - - image: google/cloud-sdk - - # Specify service dependencies here if necessary - # CircleCI maintains a library of pre-built images - # documented at https://circleci.com/docs/2.0/circleci-images/ - # - image: circleci/postgres:9.4 - - working_directory: ~/repo - - steps: - - checkout - - add_ssh_keys: - fingerprints: - - "2c:9f:ce:34:dd:df:74:fc:ec:24:c1:09:41:f7:db:0a" - - run: - name: Deploy Bot to AWS - command: | - ssh -o "StrictHostKeyChecking no" -t ubuntu@ec2-35-180-156-137.eu-west-3.compute.amazonaws.com "sudo rm -rf ovisbot && git clone $OVISBOT_GIT_REPO ovisbot" - env | grep OVISBOT > .env && scp -o "StrictHostKeyChecking no" .env ubuntu@ec2-35-180-156-137.eu-west-3.compute.amazonaws.com:./ovisbot/.env - ssh -o "StrictHostKeyChecking no" -t ubuntu@ec2-35-180-156-137.eu-west-3.compute.amazonaws.com "cd ovisbot && docker-compose up --build -d" - -workflows: - version: 2 - build-deploy: - jobs: - - deploy: - filters: - branches: - only: master \ No newline at end of file diff --git a/.github/workflows/deploy_bot.yml b/.github/workflows/deploy_bot.yml new file mode 100644 index 0000000..c23ce71 --- /dev/null +++ b/.github/workflows/deploy_bot.yml @@ -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 \ No newline at end of file diff --git a/Dockerfile-prod b/Dockerfile-prod deleted file mode 100644 index 6bff6f4..0000000 --- a/Dockerfile-prod +++ /dev/null @@ -1,8 +0,0 @@ -FROM python:3.9 - -COPY . /ovisbot - -WORKDIR /ovisbot - -RUN pip install pipenv -RUN pipenv install . diff --git a/README.md b/README.md index e733d01..5c04ae3 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Code Style: Black - +

@@ -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 CryptoHack and Hack The Box, +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 CryptoHack and Hack The Box, Note that the majority of the features are provided by isolated plugins and thus they can be enabled/disabled on demand. @@ -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: ``` @@ -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 diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 2ed1518..0bb8a7d 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -1,5 +1,4 @@ services: bot: - build: - dockerfile: Dockerfile-prod + image: ghcr.io/cybermouflons/ovisbot:latest volumes: [] \ No newline at end of file