diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 3d1951b..4ae0765 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -25,7 +25,7 @@ jobs: - name: Build and Push uses: docker/build-push-action@v5 with: - context: Application/ + context: Application/webapp push: true load: false # tags: yuvals41/discordbot:${{ github.run_number }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d8be704 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.env +pycache +venv +mongo-data \ No newline at end of file diff --git a/Application/.gitignore b/Application/.gitignore deleted file mode 100644 index b0b2729..0000000 --- a/Application/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.env -pycache -venv \ No newline at end of file diff --git a/Application/code.py b/Application/code.py deleted file mode 100644 index dbd0091..0000000 --- a/Application/code.py +++ /dev/null @@ -1,6 +0,0 @@ -x = 5 - -if 5 < 4: - print("yes") -else: - print("no") \ No newline at end of file diff --git a/Application/Main.py b/Application/discord/Main.py similarity index 100% rename from Application/Main.py rename to Application/discord/Main.py diff --git a/Application/QuickSendLinkA17.py b/Application/discord/QuickSendLinkA17.py similarity index 100% rename from Application/QuickSendLinkA17.py rename to Application/discord/QuickSendLinkA17.py diff --git a/Application/QuickSendLinkGokuBlack.py b/Application/discord/QuickSendLinkGokuBlack.py similarity index 100% rename from Application/QuickSendLinkGokuBlack.py rename to Application/discord/QuickSendLinkGokuBlack.py diff --git a/Application/QuickSendLinkGokuBlue.py b/Application/discord/QuickSendLinkGokuBlue.py similarity index 100% rename from Application/QuickSendLinkGokuBlue.py rename to Application/discord/QuickSendLinkGokuBlue.py diff --git a/Application/WebScrap_A17.py b/Application/discord/WebScrap_A17.py similarity index 100% rename from Application/WebScrap_A17.py rename to Application/discord/WebScrap_A17.py diff --git a/Application/WebScrap_GokuBlack.py b/Application/discord/WebScrap_GokuBlack.py similarity index 100% rename from Application/WebScrap_GokuBlack.py rename to Application/discord/WebScrap_GokuBlack.py diff --git a/Application/WebScrap_GokuBlue.py b/Application/discord/WebScrap_GokuBlue.py similarity index 100% rename from Application/WebScrap_GokuBlue.py rename to Application/discord/WebScrap_GokuBlue.py diff --git a/Application/experiment.py b/Application/discord/experiment.py similarity index 100% rename from Application/experiment.py rename to Application/discord/experiment.py diff --git a/Application/test.py b/Application/discord/test.py similarity index 100% rename from Application/test.py rename to Application/discord/test.py diff --git a/Application/pymongo.py b/Application/pymongo.py deleted file mode 100644 index 7e55db7..0000000 --- a/Application/pymongo.py +++ /dev/null @@ -1,4 +0,0 @@ -import pymongo - -myclient = pymongo.MongoClient("mongodb://localhost:27017/") - diff --git a/Application/.dockerignore b/Application/webapp/.dockerignore similarity index 65% rename from Application/.dockerignore rename to Application/webapp/.dockerignore index 71f0450..625f521 100644 --- a/Application/.dockerignore +++ b/Application/webapp/.dockerignore @@ -1,4 +1,5 @@ .env .gitignore Jenkinsfile -*.md \ No newline at end of file +*.md +mongo-data \ No newline at end of file diff --git a/Application/Dockerfile b/Application/webapp/Dockerfile similarity index 100% rename from Application/Dockerfile rename to Application/webapp/Dockerfile diff --git a/Application/webapp/docker-compose.yaml b/Application/webapp/docker-compose.yaml new file mode 100644 index 0000000..9b952b0 --- /dev/null +++ b/Application/webapp/docker-compose.yaml @@ -0,0 +1,33 @@ +version: "3.8" + +services: + webapp: + build: + context: "." + dockerfile: Dockerfile + container_name: webapp + restart: always + env_file: .env + networks: + - webapp + ports: + - 5000:5000 + + mongodb: + image: mongo:6.0.13-jammy + container_name: mongodb + restart: always + environment: + - MONGO_INITDB_ROOT_USERNAME=admin + - MONGO_INITDB_ROOT_PASSWORD=admin + networks: + - webapp + ports: + - 27017:27017 + volumes: + - ./mongo-data:/data/db + + +networks: + webapp: + \ No newline at end of file diff --git a/Application/webapp/pymongo.py b/Application/webapp/pymongo.py new file mode 100644 index 0000000..805521a --- /dev/null +++ b/Application/webapp/pymongo.py @@ -0,0 +1,16 @@ +from pymongo import MongoClient +from flask import Flask + +app = Flask(__name__) + +client = MongoClient("mongodb://admin:admin@localhost","27017") + +db = client["yuval"] + + +if "githubRepos" not in db.list_collection_names(): + db.create_collection("githubRepos") + +collection = db.get_collection("githubRepos") + +collection.insert_one() \ No newline at end of file diff --git a/Application/requirements.txt b/Application/webapp/requirements.txt similarity index 100% rename from Application/requirements.txt rename to Application/webapp/requirements.txt diff --git a/Application/webapp/templates/error_html.html b/Application/webapp/templates/error_html.html new file mode 100644 index 0000000..ce2edd3 --- /dev/null +++ b/Application/webapp/templates/error_html.html @@ -0,0 +1,55 @@ + + +
+ + +We're sorry, but something went wrong. Please try again later.
+ Go Back Home +