Browse Source

Merge branch 'generalize-db-remove-compose'

Kirk Trombley 6 years ago
parent
commit
af6d620874
9 changed files with 9 additions and 61 deletions
  1. 2 1
      Dockerfile
  2. 2 5
      config/config.toml
  3. 0 3
      config/secrets.toml.template
  4. 0 1
      requirements.txt
  5. 1 1
      src/app.py
  6. 1 1
      src/config.py
  7. 3 2
      src/db.py
  8. 0 18
      stack-testing.yml
  9. 0 29
      stack.yml

+ 2 - 1
Dockerfile

@@ -9,4 +9,5 @@ ADD templates/ /rollbot/templates
 ADD config/config.toml /rollbot
 ADD config/secrets.toml /rollbot
 ADD src/ /rollbot
-CMD ["gunicorn", "rollbot:app", "--bind", "0.0.0.0:6070", "--workers", "9"]
+# CMD ["gunicorn", "rollbot:app", "--bind", "0.0.0.0:6070", "--workers", "9"]
+CMD ["python3", "app.py"]

+ 2 - 5
config/config.toml

@@ -1,12 +1,9 @@
+database = "/tmp/rollbot.sqlite"
+
 [plugins]
 simple = [ "info", "isadmin", "debug", "echo", "thanks", "guess", "meme", "unmeme", "greet", "console" ]
 teamspeak = [ "teamspeak" ]
 
-[postgres]
-host = "db"
-user = "postgres"
-db = "postgres"
-
 [teamspeak]
 host = "kirkleon.ddns.net"
 user = "serveradmin"

+ 0 - 3
config/secrets.toml.template

@@ -9,8 +9,5 @@ global = [ ] # List of Global Admin User IDs
 [bots]
 your_chat = "BOT-TOKEN"
 
-[postgres]
-pass = "rollbotpostgres"
-
 [teamspeak]
 pass = "your-teamspeak-serveradmin-password"

+ 0 - 1
requirements.txt

@@ -1,6 +1,5 @@
 toml
 sqlalchemy
-psycopg2-binary
 Flask
 gunicorn
 requests

+ 1 - 1
src/app.py

@@ -83,4 +83,4 @@ def execute():
 
 if __name__ == "__main__":
     # default deployment in debug mode
-    app.run(host="0.0.0.0", port=6071, debug=True)
+    app.run(host="0.0.0.0", port=6070)

+ 1 - 1
src/config.py

@@ -31,4 +31,4 @@ GLOBAL_ADMINS = get_secret("auths.global")
 GROUP_ADMINS = get_secret("auths.group")
 PLUGINS = get_config("plugins")
 API_KEY = get_secret("api_key")
-POSTGRES = f'{get_config("postgres.user")}:{get_secret("postgres.pass")}@{get_config("postgres.host")}/{get_config("postgres.db")}'
+DB_FILE = os.path.abspath(get_config("database"))

+ 3 - 2
src/db.py

@@ -3,10 +3,11 @@ from contextlib import contextmanager
 from sqlalchemy import create_engine
 from sqlalchemy.orm import sessionmaker
 
-from config import POSTGRES
+from config import DB_FILE
 from command_system import ModelBase
 
-engine = create_engine("postgresql://" + POSTGRES)
+
+engine = create_engine("sqlite:///" + DB_FILE)
 Session = sessionmaker(bind=engine)
 
 

+ 0 - 18
stack-testing.yml

@@ -1,18 +0,0 @@
-version: "3.1"
-
-services:
-
-  rollbot:
-    build: .
-    ports:
-      - "6071:6070"
-    restart: always
-    depends_on:
-      - "db"
-    command: [ "python3", "app.py" ]
-
-  db:
-    image: postgres
-    restart: always
-    environment:
-      POSTGRES_PASSWORD: rollbotpostgres

+ 0 - 29
stack.yml

@@ -1,29 +0,0 @@
-version: "3.1"
-
-services:
-
-  rollbot:
-    build: .
-    ports:
-      - "6071:6070"
-    restart: always
-    depends_on:
-      - "db"
-    networks:
-      hiramnet:
-        ipv4_address: "172.18.0.22"
-      default: {}
-
-  db:
-    image: postgres
-    restart: always
-    environment:
-      POSTGRES_PASSWORD: rollbotpostgres
-    volumes:
-      - "/opt/rollbot/data/postgres:/var/lib/postgresql/data"
-    networks:
-      - default
-
-networks:
-  hiramnet:
-    external: true