how to set up a recent version of booktype
  • I followed the manual guide and set up a dev-environment but used a virtualenv for safety reasons. I dont have a full domain yet because I'm in the process of evaluating if Booktype fits all my needs. For some reason I'm unable to log in in my Booktype instance, despite the fact that I created a superuser with ./manage.py createsuperuser.


    User does not exist.
    Password is wrong! Please try again.
    Your account is inactive! Please, contact site support.
    Unknown error!

    There are errors and I would be glad if you could give me some suggestions to solve my issues. This is how booktype looks like now.


    image

    Dependencies


    $ sudo apt-get install postgresql php5-cli php5-gd apache2-mpm-prefork libapache2-mod-wsgi git-core python-setuptools python-dev python-virtualenv libjpeg-dev libpq-dev libxml2-dev libxslt-dev rabbitmq-server redis-server tidy nano
    $ easy_install pip
    $ pip install virtualenv

    Setup postgres database


    $ su - postgres
    $ createuser -SDRP booktype-user
    $ createdb -E utf8 -T template0 -O booktype-user booktype-db
    $ exit
    $ sudo service postgresql restart

    Setup PDF renderer


    $ cd /tmp/
    $ sudo mkdir -p /var/www/
    $ wget http://www.mpdfonline.com/repos/MPDF_6_0.zip
    $ sudo unzip MPDF_6_0.zip -d /var/www/
    $ cd /var/www/mpdf60/
    $ sudo chown www-data.www-data examples/test.pdf graph_cache/ tmp/ ttfontdata/
    $ cd /var/www/mpdf60/examples/
    $ sudo sed -i 's;www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin;www-data:x:33:33:www-data:/var/www:/bin/bash;' /etc/passwd
    $ sudo su www-data
    $ for i in example*.php; do php $i > /tmp/$i.pdf; done

    Setup Booktype


    $ cd /usr/local/src/
    $ virtualenv --distribute mybooktype
    $ source mybooktype/bin/activate
    $ mkdir -p mybooktype/local/src/booktype
    $ sudo git clone https://github.com/sourcefabric/Booktype.git --branch master --depth 1 $ mybooktype/local/src/booktype
    $ sudo pip install -r mybooktype/local/src/booktype/requirements/dev.txt
    $ sudo pip install -r mybooktype/local/src/booktype/requirements/prod.txt
    $ sudo pip install ebooklib
    $ sudo mkdir /var/www/booktype/
    $ sudo chown www-data:www-data /var/www/booktype/
    $ sudo chown -R www-data:www-data mybooktype/local/src/booktype/

    Log in with user www-data


    $ sudo su -s /bin/sh www-data 
    $ cd /usr/local/src/mybooktype/local/src/booktype/scripts/
    $ ./createbooktype -p dev --check-versions --database postgresql /var/www/booktype/instance1
    $ cd /var/www/booktype/instance1/
    $ nano instance1_site/settings/base.py
    $ nano instance1_site/settings/dev.py
    $ . ./booktype.env
    $ ./manage.py migrate
    $ ./manage.py createsuperuser
    $ ./manage.py runserver 0.0.0.0:8005

    In another terminal


    $ cd /var/www/booktype/instance1/
    $ sudo su -s /bin/sh www-data
    $ ./manage.py celery worker --concurrency=10 -l debug

    logiles & terminal output


    configs



    logs


    Post edited by tristank at 2017-01-25 10:42:06
  • 5 Comments sorted by
  • Vote Up0Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    Hi, this failure to load the interface is a common issue when using a domain that doesn't exist or a local IP address. If you do not have a real domain to use yet, I suggest setting up a fake one in /etc/hosts

    Please take a look at the source of the login page around line 18 and see where the link to CSS is pointing. For a prod (production) profile it should be something like:
    <link rel="stylesheet" href="/static/CACHE/css/a9ea424f1e42.css" type="text/css" />

    but for a dev profile the static files are not collected into a cache.

    If this link does not point to a real file, please let me know. Also I note that you say you are using the prod profile, but in the console output above you have edited settings/dev.py so please check that you have enabled the correct profile in which case you would edit settinng/prod.py for the instance.

    Cheers!

    Daniel
  • Hi Daniel, thanks for looking into my issue. I'm sorry this was a oversight. I meant dev-environment. I'm not using a virtual machine, so I editing etc/hosts wont do it. I set up a temporary subdomain at booktype.tristank.de and edited instance1_site/settings/dev.py accordingly. Are there any other variables I'll have to change except THIS_BOOKTYPE_SERVER and BOOKTYPE_URL in dev.py. What about THIS_BOOKTYPE_SERVER and BOOKTYPE_URL in base.py?

    This is how the source of the login page looks like, still broken.

    <link href='http://booktype.tristank.de/static/core/css/bootstrap.css' rel='stylesheet' type='text/css' />
    <link href='http://booktype.tristank.de/static/core/css/bootstrap-theme.css' rel='stylesheet' type='text/css' />
    <link href='http://booktype.tristank.de/static/core/css/bootstrap-custom.css' rel='stylesheet' type='text/css' />
    <link href='http://booktype.tristank.de/static/core/css/font-awesome/css/font-awesome.min.css' rel="stylesheet" />
    <link href='http://booktype.tristank.de/static/core/css/booki-new.css' rel='stylesheet' type='text/css' />
    <link href='http://booktype.tristank.de/static/core/css/bt20.css' rel='stylesheet' type='text/css' />
    <link href='http://booktype.tristank.de/static/core/css/aloha.css' rel='stylesheet' type='text/css' />

    Does this seem appropriate for a dev env? If I'm not mistaken the port-number is missing.

    Please have a look for yourself at http://booktype.tristank.de:8005
    Post edited by tristank at 2017-01-25 10:35:33
  • Vote Up0Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    Hi, I'll break this down into points :-)

    1. You can use /etc/hosts to point to any machine, whether virtual or not. This is useful if your subdomain does not exist in DNS, but in this case you don't need it any more.

    2. If you have set values in dev.py or prod.py you do not need to set the same values in base.py also.

    3. Using the command
    runserver 0.0.0.0:8005
    is really just for testing. If you want your server to be available to the outside world, I suggest using a normal web server such as Apache on port 80. Please see 'Apache configuration' in http://sourcefabric.booktype.pro/booktype-21-for-authors-and-publishers/manual-installation-on-gnulinux/ replacing booktype.example.com with booktype.tristank.de in the examples of course.

    Let us know how you get on, you're nearly there!

    Daniel
  • It's up and running. But I'm getting frequent page errors and the book export isnt working. So far I'm impressed and it's only the tip of the iceberg. Kudos to you! I've several other question. Should I open other threads or keep the discussion here. 
  • Vote Up0Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    Hi, good to hear you got it working! I think a new thread for each type of error is a good idea, it helps others to find the solutions. I suggest we start with the page errors, please start a new thread with full details.

    Cheers!

    Daniel