install realms wiki | zuhdi.org

Install Realms Wiki /archive

Environment

  • Debian 9.7 x64
  • Python 2.7.13
  • node 12.2.0
  • pip 19.1.1
  • Realms Wiki 0.9.3

Excerpt https://github.com/scragg0x/realms-wiki

Pre-requisite

Log 2019 / 05

1. Install realms-wiki

root@athos:~# apt-get update && apt-get -y upgrade && apt-get -y dist-upgrade

root@athos:~# apt-get -y --no-install-recommends install git build-essential python-dev 

root@athos:~# git clone https://github.com/scragg0x/realms-wiki
Cloning into 'realms-wiki'...
remote: Enumerating objects: 3872, done.
remote: Total 3872 (delta 0), reused 0 (delta 0), pack-reused 3872
Receiving objects: 100% (3872/3872), 2.57 MiB | 852.00 KiB/s, done.
Resolving deltas: 100% (2334/2334), done.

root@athos:~# npm install bower -g
npm WARN deprecated bower@1.8.8: We don't recommend using Bower for new projects. 
Please consider Yarn and Webpack or Parcel. You can read how to migrate legacy 
  project here: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
  /root/.nvm/versions/node/v12.2.0/bin/bower 
  -> /root/.nvm/versions/node/v12.2.0/lib/node_modules/bower/bin/bower
+ bower@1.8.8
added 1 package from 1 contributor in 2.281s

root@athos:~# pip install -U pipenv
(truncated)
Successfully installed certifi-2019.3.9 enum34-1.1.6 pipenv-2018.11.26 
  setuptools-41.0.1 typing-3.6.6 virtualenv-16.6.0 virtualenv-clone-0.5.3

root@athos:~# cd realms-wiki/
root@athos:~/realms-wiki# bower install --allow-root
bower keymaster#*           not-cached https://github.com/madrobby/keymaster.git#*
bower keymaster#*              resolve https://github.com/madrobby/keymaster.git#*
(truncated)

root@athos:~/realms-wiki# pipenv install --two
Creating a virtualenv for this project...
Pipfile: /root/realms-wiki/Pipfile
Using /usr/bin/python (2.7.13) to create virtualenv...
⠧ Creating virtual environment...Already using interpreter /usr/bin/python
New python executable in /root/.local/share/virtualenvs/realms-wiki-svlj3Kgm/bin/python
Installing setuptools, pip, wheel...
done.

✔ Successfully created virtual environment!
Virtualenv location: /root/.local/share/virtualenvs/realms-wiki-svlj3Kgm
Installing dependencies from Pipfile.lock (d234ff)...
  🐍   |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 39/39 — 00:01:44
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.

2. Setup realms-wiki

root@athos:~/realms-wiki# pipenv run ./realms-wiki setup
Enter site title. [Realms]:
Enter base URL. [http://localhost]:
Enter port number. [5000]: 80
Enter secret key. [5bkLIMFvnLEflYNKMKTMzTpBZqA6pMUvAiFlHA2tEYqDgV4wwCqaOiJvnpUnqJRu]:
Enter wiki data directory. [/tmp/wiki]: /root/data/wiki
Allow anonymous edits? [Y/n]: n
Enable registration? [Y/n]: n
Cache type? [simple]:
Search type? [simple]:
Database URI? Examples: http://goo.gl/RyW0cl [sqlite:////tmp/wiki.db]: 
  sqlite:////root/data/wiki.db
Config saved to ./realms-wiki.json
Note: You can move file to /etc/realms-wiki/realms-wiki.json

Type "realms-wiki start" to start server
Type "realms-wiki dev" to start server in development mode
Full usage: realms-wiki --help

root@athos:~/realms-wiki# cat realms-wiki.json
{
    "ALLOW_ANON": false,
    "BASE_URL": "http://localhost",
    "CACHE_TYPE": "simple",
    "DB_URI": "sqlite:////root/data/wiki.db",
    "PORT": 80,
    "REGISTRATION_ENABLED": false,
    "SEARCH_TYPE": "simple",
    "SECRET_KEY": "5bkLIMFvnLEflYNKMKTMzTpBZqA6pMUvAiFlHA2tEYqDgV4wwCqaOiJvnpUnqJRu",
    "SITE_TITLE": "Realms",
    "WIKI_PATH": "/root/data/wiki"
}

root@athos:~/realms-wiki# mkdir -p /root/data/

root@athos:~/realms-wiki# pipenv run ./realms-wiki start
Server started. Port: 80
Using config: ./realms-wiki.json

root@athos:~/realms-wiki# pipenv run ./realms-wiki version
0.9.3

3. Create User

3.1. Using realms-wiki

pipenv run ./realms-wiki auth.local create_user \
  zuhdi zuhdi@spam.org

root@athos:~/realms-wiki# pipenv run ./realms-wiki auth.local create_user \
>   zuhdi zuhdi@spam.org
User zuhdi created
Password: MaExiNGWPApv

3.2. Using sqlite3

root@athos:~# apt-get install -y --no-install-recommends sqlite3

root@athos:~# sqlite3 /root/data/wiki.db
SQLite version 3.16.2 2017-01-06 16:32:41
Enter ".help" for usage hints.

sqlite> .tables
users

sqlite> .schema users
CREATE TABLE users (
        id INTEGER NOT NULL,
        username VARCHAR(128),
        email VARCHAR(128),
        password VARCHAR(60),
        PRIMARY KEY (id),
        UNIQUE (username),
        UNIQUE (email)
);

INSERT INTO
  users 
VALUES
  (
    2, 'nadia', 'nadia@spam.org', 
      '$2a$12$GysA4lOJ6Mw0FQu5Nvut3O9tWb03a7I/H4A5mQVunRiTOFgmnpOEa'
  )
;

sqlite> INSERT INTO
   ...>   users
   ...> VALUES
   ...>   (
   ...>     2, 'nadia', 'nadia@spam.org',
   ...>       '$2a$12$GysA4lOJ6Mw0FQu5Nvut3O9tWb03a7I/H4A5mQVunRiTOFgmnpOEa'
   ...>   )
   ...> ;

sqlite> SELECT * FROM users;
1|zuhdi|zuhdi@spam.org|$2b$12$i8JjOwYqrS2QAvS1gbkFku5EfCOZScmqB0iDuwQ.Pk2yCr9D/Z87G
2|nadia|nadia@spam.org|$2a$12$GysA4lOJ6Mw0FQu5Nvut3O9tWb03a7I/H4A5mQVunRiTOFgmnpOEa

Hugo. Malte Kiefer & Zuhdi Najib.