It is somewhat similar to kusaba, wakaba, pyib etc, but many things are done differently (sometimes better).
The current release is 0.9.
mod_proxy_http
, or something like lighttpd or nginx (recommended). img2 operates as a long running process with an embedded http server. You setup your webserver to proxy requests (except for static content or uploaded files) to img2.
/trunk/
directory.
/branches/X.Y/
, where X.Y is the version number, for example 0.9
. The current contents of /trunk/
are copied to this new directory.
/branches/X.Y
the only changes to that directory will be bug fixes - main development will continue in /trunk/
.
svn up
to receive bug fixes.
/branches/0.9
) from svn:
mkdir ~/img2 cd ~/img2 svn co http://svn.xp-dev.com/svn/img2_img2/branches/0.9 .
mod_proxy
, and add something like this to your config file:
$HTTP["host"] == "img2.example.com" { server.document-root = "<path-to-where-you-checked-out-img2>/webroot" server.max-request-size = 2048 url.rewrite-once = ( "^/favicon\.ico$" => "/static/favicon.ico", "^/robots\.txt$" => "/static/robots.txt", "^/~(static|uploaded)/(.*)$" => "/$1/$2" ) $HTTP["url"] =~ "^/(?!static|uploaded|favicon\.ico|robots\.txt)" { proxy.server = ("/" => (( "host" => "127.0.0.1", "port" => 63331, )) ) } $HTTP["url"] =~ "^/(static|uploaded)/" { expire.url = ( "" => "access 1 months" ) } }
server { listen 80; server_name img2.example.com; client_max_body_size 2m; rewrite ^/(favicon\.ico|robots\.txt)$ /static/$1; rewrite ^/~(uploaded|static)(.*)$ /$1/$2; location / { proxy_pass http://127.0.0.1:63331/; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ~ /(static|uploaded) { root "<path-to-where-you-checked-out-img2>/webroot" } }
chmod +x bootstrap.py
and then ./bootstrap.py
.-p <port>
argument./etc/init.d/img2
, and place this in it (edit IMG2USER
, IMG2PATH
and IMG2PORT
as appropriate). Note that this script requires the start-stop-daemon
program to be installed:
#!/bin/sh ### BEGIN INIT INFO # Provides: img2 # Required-Start: $all # Required-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: starts img2 imageboard # Description: starts img2 imageboard as a daemon ### END INIT INFO IMG2USER=<your-username> IMG2PATH=<path-to-your-img2-install> IMG2PORT=63331 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin case "$1" in start) echo "starting img2..." start-stop-daemon --start --pidfile $IMG2PATH/img2.pid --chuid $IMG2USER --chdir $IMG2PATH --startas ./bootstrap.py --background -- -p $IMG2PORT ;; stop) echo "stopping img2..." start-stop-daemon --stop --retry -15/1/-9 --pidfile $IMG2PATH/img2.pid ;; restart) $0 stop $0 start ;; *) echo "usage: $0 {start|stop|restart}" exit 1 ;; esac
update-rc.d img2 defaults
.
/etc/init.d/img2 start
to start img2 (This will be automatically called at system startup).
/etc/init.d/img2 stop
to stop img2.
/etc/init.d/img2 restart
to restart (stop and then start) img2.
update-rc.d -f img2 remove
and delete the file: /etc/init.d/img2
.
database/
and uploaded_files/
directories! You might make a mistake and delete the originals!
svn switch http://svn.xp-dev.com/svn/img2_img2/branches/0.9 .
databases/
(but not the directory itself) to the new databases/
.
uploaded_files/
(but not the directory itself) to webroot/uploaded/
.
databases/
- database files.
img2/
- python code.
webroot/
- files to be served by the main webserver (not img2's embedded one)
static/
- non-dynamic resources needed for web pages, eg. css.
uploaded/
- files people uploaded with posts.
templates/
- templates, look in img2/util/templates.py
for info on the template format.
locale/
- translation files.
bootstrap.py
- the script you run to start img2.
readme.html
- this file
log
- any errors will be logged to this file (will be created if it doesn't exist)
403.html
, 404.html
and 500.html
in templates/
webroot/static/
and change the board settings to use it.CACHING = False
in img2/common.py
(restart required)../bootstrap.py -g
(g
means generate).
locale/your-locale-code/messages.po
.
messages.po
to contain your translations.
./bootstrap -g
again and the new strings will be appended to the end of the file.
./bootstrap -m
to create a default admin account.
You can import posts from futaba style boards that generate cached html pages. It works for kusaba and wakaba, and probably for kusaba/wakaba forks. You can import any number of boards at a time.
./bootstrap.py -i path
where path
is a path to the root of a kusaba/kusabax/wakaba installation.