From a02c6df708f24dfd584cb208947a7837919be6fb Mon Sep 17 00:00:00 2001 From: zevaryx Date: Thu, 27 Oct 2022 20:25:41 -0600 Subject: [PATCH] Initial commit, fully working stack --- .gitignore | 6 ++++++ README.md | 23 +++++++++++++++++++++++ config.example.yaml | 29 +++++++++++++++++++++++++++++ docker-compose.yaml | 24 ++++++++++++++++++++++++ fetch.ps1 | 17 +++++++++++++++++ fetch.sh | 18 ++++++++++++++++++ 6 files changed, 117 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 config.example.yaml create mode 100644 docker-compose.yaml create mode 100644 fetch.ps1 create mode 100755 fetch.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e358b0c --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +# Cloned repos +jarvis-bot/ +jarvis-tasks/ + +# Configs +config.yaml \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..abdd70b --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# JARVIS + +## What is this repo? + +This repository is a repo designed to self-host a full-stack JARVIS instance from the ground up with no extra work. + +## How to run + +To use, first create a `config.yaml` based on `config.example.yaml` + +Then, run `fetch.sh` if you're on Linux/macOS, or `fetch.ps1` if you're on Windows + +Finally, run `docker compose up -d` + +## How to update + +First, re-run `fetch.sh` or `fetch.ps1` +Then, run `docker compose up -d --build` + +## Prerequisites + +- git +- docker \ No newline at end of file diff --git a/config.example.yaml b/config.example.yaml new file mode 100644 index 0000000..c3c77b2 --- /dev/null +++ b/config.example.yaml @@ -0,0 +1,29 @@ +--- + # Replace ... with actual values + token: ... + twitter: + consumer_key: ... + consumer_secret: ... + access_token: ... + access_token_secret: ... + bearer_token: ... + reddit: + client_secret: ... + client_id: ... + + # Leave these values alone + mongo: + connect: + username: + password: + host: mongodb + port: 27017 + database: jarvis + redis: + host: redis://cache + username: + password: + max_messages: 10000 + log_level: INFO + sync: True + urls: \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..5875245 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,24 @@ +version: "3.8" + +services: + cache: + image: redis + restart: always + command: redis-server --save 20 1 --loglevel warning + + mongodb: + image: mongo + command: mongod + + bot: + build: ./jarvis-bot + depends_on: + - cache + - mongodb + + tasks: + build: ./jarvis-tasks + stop_grace_period: 5s + depends_on: + - cache + - mongodb diff --git a/fetch.ps1 b/fetch.ps1 new file mode 100644 index 0000000..c33b190 --- /dev/null +++ b/fetch.ps1 @@ -0,0 +1,17 @@ +if (Test-Path -Path ".\jarvis-bot") { + Push-Location ".\jarvis-bot" + git pull + Pop-Location +} else { + git clone https://git.zevaryx.com/stark-industries/jarvis/jarvis-bot.git +} +if (Test-Path -Path ".\jarvis-tasks") { + Push-Location ".\jarvis-tasks" + git pull + Pop-Location +} else { + git clone https://git.zevaryx.com/stark-industries/jarvis/jarvis-tasks.git +} + +cp config.yaml .\jarvis-bot\config.yaml +cp config.yaml .\jarvis-tasks.\config.yaml \ No newline at end of file diff --git a/fetch.sh b/fetch.sh new file mode 100755 index 0000000..150a8d2 --- /dev/null +++ b/fetch.sh @@ -0,0 +1,18 @@ +#!/bin/bash +if [ ! -d jarvis-bot ]; then + git clone https://git.zevaryx.com/stark-industries/jarvis/jarvis-bot.git +else + pushd jarvis-bot + git pull + popd +fi +if [ ! -d jarvis-tasks ]; then + git clone https://git.zevaryx.com/stark-industries/jarvis/jarvis-tasks.git +else + pushd jarvis-tasks + git pull + popd +fi + +cp -v config.yaml jarvis-bot/config.yaml +cp -v config.yaml jarvis-tasks/config.yaml \ No newline at end of file