forked from pwgen2155/dawdle
Remove unnecessary setup folder and install script, elaborated on basic setup in readme
This commit is contained in:
parent
a38b8ea181
commit
c1e0b5634e
29
README.md
29
README.md
|
@ -4,26 +4,21 @@ FriendsRPG is a modified version of DawdleRPG (an IdleRPG clone) written in Pyth
|
|||
|
||||
## Basic Setup
|
||||
|
||||
- Edit `dawdle.conf` to configure your bot.
|
||||
- Run `dawdle.py <path to dawdle.conf>`
|
||||
- The data directory defaults to the parent directory of the
|
||||
configuration file, and dawdlerpg expects files to be in that
|
||||
directory.
|
||||
- Install python-django
|
||||
- Copy dawdle.conf.example to af/dawdle.conf
|
||||
- Edit af/dawdle.conf to configure the bot
|
||||
- Run the following commands:
|
||||
|
||||
## Setup with Website
|
||||
|
||||
The included `install.sh` script will set up the dawdlerpg bot and
|
||||
website on a freshly installed Debian system. It uses nginx, uwsgi,
|
||||
and django for the site. At some point, you should be prompted to
|
||||
edit the dawdle.conf file, and you'll need to edit some configuration
|
||||
parameters explained by the comments in the file.
|
||||
|
||||
```sh
|
||||
./install.sh <hostname>
|
||||
``` sh
|
||||
cd site
|
||||
./manage.py migrate --database=default
|
||||
./manage.py migrate --database=game
|
||||
./manage.py collecstatic --no-input
|
||||
cd ..
|
||||
./dawdle.py --setup af/dawdle.config
|
||||
docker compose up -d --build
|
||||
```
|
||||
|
||||
If you don't have a clean install, you should instead look at the
|
||||
`install.sh` script and use the pieces that work for your setup.
|
||||
|
||||
## Differences from IdleRPG
|
||||
|
||||
|
|
64
install.sh
64
install.sh
|
@ -1,64 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ "$UID" != "0" ]]; then
|
||||
echo This script must be run as root.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "x$1" == "x" ]]; then
|
||||
echo "Usage: install.sh <hostname>" >/dev/stderr
|
||||
exit 1
|
||||
fi
|
||||
|
||||
HOST="$1"
|
||||
|
||||
DIR="$(readlink -f $(dirname $0))"
|
||||
echo "Using $DIR as dawdlerpg directory."
|
||||
|
||||
echo Installing services.
|
||||
apt install -y nginx python3-pip
|
||||
pip install django uwsgi Pillow
|
||||
|
||||
echo Configuring services.
|
||||
sed "s#DAWDLERPG_DIR#${DIR}#g" setup/uwsgi.service >/etc/systemd/system/uwsgi.service
|
||||
sed "s#DAWDLERPG_DIR#${DIR}#g" setup/uwsgi.ini >/etc/uwsgi.ini
|
||||
sed "s#DAWDLERPG_DIR#${DIR}#g" setup/dawdlerpg.service >/etc/systemd/system/dawdlerpg.service
|
||||
sed "s#DAWDLERPG_DIR#${DIR}#g" setup/dawdlerpg.nginx >/etc/nginx/sites-available/dawdlerpg
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
ln -sf /etc/nginx/sites-available/dawdlerpg /etc/nginx/sites-enabled/
|
||||
|
||||
systemctl enable uwsgi
|
||||
systemctl enable dawdlerpg
|
||||
systemctl enable nginx
|
||||
|
||||
echo Setting up dawdlerpg.
|
||||
cp setup/dawdle.conf "$DIR/data"
|
||||
cp setup/events.txt "$DIR/data"
|
||||
pushd "$DIR/site/"
|
||||
SECRET_KEY="$(openssl rand -base64 45)"
|
||||
sed -e "/^SECRET_KEY/ c \\SECRET_KEY = '${SECRET_KEY}'" \
|
||||
-e "/^ALLOWED_HOSTS/ c \\ALLOWED_HOSTS = ['${HOST}']" \
|
||||
-e "/^DEBUG/ c \\DEBUG = False" \
|
||||
setup/project-settings.py \
|
||||
>project/settings.py
|
||||
./manage.py migrate --database=default
|
||||
./manage.py migrate --database=game
|
||||
./manage.py collectstatic --no-input
|
||||
cd "$DIR"
|
||||
echo -n "You should now edit the dawdle.conf file for your particular game. Press RETURN to begin editing."
|
||||
read
|
||||
"$EDITOR" "$DIR/data/dawdle.conf"
|
||||
if [[ $! != 0 ]]; then
|
||||
exit $!
|
||||
fi
|
||||
"$DIR/dawdle.py" --setup "$DIR/data/dawdle.conf"
|
||||
popd
|
||||
|
||||
chown -R www-data:www-data "$DIR"
|
||||
|
||||
echo Starting systems.
|
||||
systemctl start uwsgi
|
||||
systemctl restart nginx
|
||||
systemctl start dawdlerpg
|
||||
|
||||
echo Done.
|
|
@ -1,33 +0,0 @@
|
|||
# DawdleRPG nginx configuration
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
|
||||
# SSL configuration
|
||||
#
|
||||
# listen 443 ssl default_server;
|
||||
# listen [::]:443 ssl default_server;
|
||||
# gzip off
|
||||
#
|
||||
|
||||
root DAWDLERPG_DIR/site/static;
|
||||
charset utf-8;
|
||||
server_name _;
|
||||
|
||||
location /media {
|
||||
alias DAWDLERPG_DIR/site/media;
|
||||
}
|
||||
location /static {
|
||||
alias DAWDLERPG_DIR/site/static;
|
||||
}
|
||||
location /favicon.ico {
|
||||
alias DAWDLERPG_DIR/site/static/favicon.ico;
|
||||
}
|
||||
location /robots.txt {
|
||||
alias DAWDLERPG_DIR/site/static/robots.txt;
|
||||
}
|
||||
location / {
|
||||
uwsgi_pass unix:///tmp/dawdlerpg-uwsgi.sock;
|
||||
include uwsgi_params;
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
[Unit]
|
||||
Description=DawdleRPG IRC Bot
|
||||
After=network.target auditd.service
|
||||
|
||||
[Service]
|
||||
User=www-data
|
||||
Group=www-data
|
||||
ExecStart=DAWDLERPG_DIR/dawdle.py -o daemonize=off DAWDLERPG_DIR/data/dawdle.conf
|
||||
Restart=on-failure
|
||||
RestartPreventExitStatus=255
|
||||
Type=simple
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -1,27 +0,0 @@
|
|||
# Calamities - these add to a player's time to level
|
||||
C was struck by lightning
|
||||
C was mauled by a bear
|
||||
C was cursed by a swamp witch
|
||||
C fell into a bog
|
||||
C DIED... a bit
|
||||
|
||||
# Godsends - these subtract from a player's time to level
|
||||
G was sprinkled with fairy dust
|
||||
G found a pot of gold
|
||||
G met a friendly bard
|
||||
G found a magical spring
|
||||
G drank a potent elixir
|
||||
|
||||
# Quest mode 1 - these are simply timed quests
|
||||
Q1 solve the theft of the five rings of Macala
|
||||
Q1 deliver a priceless scroll to the Azar library
|
||||
Q1 rescue an imprisoned genie from the palace of the Thutharks
|
||||
Q1 impersonate cultists to infiltrate a dark temple
|
||||
Q1 unearth the secret of the Twin Pines
|
||||
|
||||
# Quest mode 2 - these are two-stage navigation quests
|
||||
Q2 464 23 113 187 search for a hostage nymph and heal her broken tree
|
||||
Q2 321 488 137 56 complete the Pisan pilgrimage from the shine of Katu to Mount Irta
|
||||
Q2 304 269 70 417 secretly follow a Esteri assassin and report on her activities
|
||||
Q2 447 432 359 318 travel to the Orod volcano to retrieve a lava-proof circlet and bring it to a country village
|
||||
Q2 326 31 246 133 must spring a Jonast noble from a prison and escort him back to his ancestral lands.
|
|
@ -1,130 +0,0 @@
|
|||
"""
|
||||
Django settings for dawdle project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 2.2.12.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/2.2/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/2.2/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = ''
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'dawdle.apps.DawdleConfig',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'project.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'project.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||
},
|
||||
'game': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(BASE_DIR, 'game.sqlite3'),
|
||||
}
|
||||
}
|
||||
|
||||
# Routers
|
||||
# https://docs.djangoproject.com/en/3.2/topics/db/multi-db/
|
||||
DATABASE_ROUTERS = ['dawdle.router.DawdleRouter']
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/2.2/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_L10N = True
|
||||
|
||||
USE_TZ = True
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/2.2/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, "static")
|
|
@ -1,18 +0,0 @@
|
|||
[uwsgi]
|
||||
# base directory (full path)
|
||||
chdir = DAWDLERPG_DIR/site/
|
||||
# Django's wsgi file
|
||||
module = project.wsgi:application
|
||||
# Set uid/gid to www-data so nginx can access
|
||||
uid = www-data
|
||||
gid = www-data
|
||||
# master
|
||||
master = true
|
||||
# maximum number of worker processes
|
||||
processes = 3
|
||||
# the socket (use the full path to be safe)
|
||||
socket = /tmp/dawdlerpg-uwsgi.sock
|
||||
# ... with appropriate permissions - may be needed
|
||||
chmod-socket = 664
|
||||
# clear environment on exit
|
||||
vacuum = true
|
|
@ -1,13 +0,0 @@
|
|||
[Unit]
|
||||
Description=uWSGI Service
|
||||
After=network.target auditd.service
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=-/etc/default/uwsgi
|
||||
ExecStart=/usr/local/bin/uwsgi --ini /etc/uwsgi.ini
|
||||
Restart=on-failure
|
||||
RestartPreventExitStatus=255
|
||||
type=notify
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in a new issue