1
0
mirror of https://github.com/MrDetonia/Maki.git synced 2024-11-22 03:44:18 -05:00

Docker! Updated README and added build/run scripts. Bootstrap script is obsolete.

This commit is contained in:
Zac Herd 2019-02-25 14:04:27 +00:00
parent b0b64a835e
commit ee144453e9
6 changed files with 17 additions and 35 deletions

5
Dockerfile Normal file
View File

@ -0,0 +1,5 @@
FROM python:3.5-alpine
WORKDIR /maki
COPY ["requirements.txt", "*.py", "./"]
RUN pip install -r requirements.txt
CMD ["python", "./bot.py"]

View File

@ -4,8 +4,11 @@
--- ---
## Running Maki ## Running Maki
Maki uses Python 3.4 with discord.py. Install python3.4 and use pip to install asyncio and discord.py. Maki relies on Python 3.4+ and the latest discord.py version.
To run Maki, simply run bot.py. A Dockerfile exists to handle these requirements automatically. Use `build.sh` to create the maki container image, and `run.sh` to start the bot.
Be sure to have created `secret.py` with the required tokens before running `build.sh`.
If you would prefer not to use docker, ensure you have at least Python 3.4, and use `pip install -r requirements.txt` to install the required Python libraries. Then run `bot.py`.
## Required Files ## Required Files
- You will require a Discord Application for Maki to use, the token for which should be stored in a file called secret.py: - You will require a Discord Application for Maki to use, the token for which should be stored in a file called secret.py:
@ -14,10 +17,10 @@ token = '<Discord Application Token>'
lfmkey = '<last.fm API key>' lfmkey = '<last.fm API key>'
steamkey = '<Steam API key>' steamkey = '<Steam API key>'
``` ```
- Maki uses JSON files to store data persistently. These will be created automatically in a data directory. - Maki uses JSON files to store data persistently. These will be created automatically in the `persist` directory.
## License ## License
Copyright 2018, Zac Herd. Copyright 2019, Zac Herd.
All Rights Reserved. All Rights Reserved.
Licensed under the BSD 3-clause License. Licensed under the BSD 3-clause License.
See LICENSE.md for a full copy of the license text. See LICENSE.md for a full copy of the license text.

View File

@ -1,30 +0,0 @@
#!/bin/bash
# user to effectively run bot as (so we can safely run as root for pip)
puser="admin"
while :
do
date
echo Updating repository...
runuser -m $puser -c 'git pull origin master'
# if root we can update discord.py
if [ "$EUID" -eq 0 ]
then
echo Updating discord.py...
python3 -m pip install -U https://github.com/Rapptz/discord.py/archive/master.zip#egg=discord.py[voice]
fi
echo Starting Maki...
runuser -m $puser -c 'rm -f ./reload'
runuser -m $puser -c 'python3 bot.py'
# okay to quit if there is no reload file
if [ ! -f ./reload ]
then
echo no reload file, stopping for realsies...
exit
fi
done

2
build.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
docker build -t maki .

View File

@ -2,7 +2,7 @@
# ---- # ----
# Discord bot by MrDetonia # Discord bot by MrDetonia
# #
# Copyright 2018 Zac Herd # Copyright 2019 Zac Herd
# Licensed under BSD 3-clause License, see LICENSE.md for more info # Licensed under BSD 3-clause License, see LICENSE.md for more info
# IMPORTS # IMPORTS

2
run.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
docker run -v maki:/maki/persist -t maki