It is similar to kusaba, wakaba, pyib etc, but has some different features.
The current release is 0.8.
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.8
. 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.8
) from svn:
mkdir ~/img2 cd ~/img2 svn co http://svn.xp-dev.com/svn/img2_img2/branches/0.8 .
static/
and uploaded_files/
from the checkout dir to the web document-root for your chosen domain:
ln -s ~/img2/static <your-doc-root>/static ln -s ~/img2/uploaded_files <your-doc-root>/uploaded_files
127.0.0.1:63331
(or whatever you choose, this is the default...)
mod_proxy_http
, and create a .htaccess
in web root containing:
RewriteEngine On
RewriteRule ^(robots\.txt|favicon\.ico)$ /static/$1 [QSA,L]
RewriteCond %{REQUEST_URI} !^/(static|uploaded_files)
RewriteRule ^(.*)$ http://127.0.0.1:63331/$1 [QSA,P,L]
LimitRequestBody 4194304
mod_proxy
, and add something like this to your config:
$HTTP["host"] == "img2.example.com" { server.document-root = <your-doc-root> $HTTP["url"] =~ "^/(?!static|uploaded_files|favicon\.ico|robots\.txt)" { proxy.server = ("/" => (( "host" => "127.0.0.1", "port" => 63331, )) ) } url.rewrite-once = ( "^/favicon\.ico$" => "/static/favicon.ico", "^/robots\.txt$" => "/static/robots.txt", ) server.max-request-size = 4096 $HTTP["url"] =~ "^/(uploaded_files|static)/" { expire.url = ( "" => "access 1 months" ) } }
server { listen 80; server_name img2.example.com; client_max_body_size 4m; rewrite ^/(favicon\.ico|robots\.txt)$ /static/$1; location / { root <your-doc-root>; 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 { root <your-doc-root>; } location /uploaded_files { root <your-doc-root>; } }
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
.
To move from your current version to the latest version, navigate to the directory you checked out into, then do: svn switch http://svn.xp-dev.com/svn/img2_img2/branches/0.8 .
cache/
- cached pages.
databases/
- database files.
img2/
- python code.
static/
- non-dynamic resources needed for web pages, eg. css.
templates/
- templates, look in img2/util/templates.py
for info on the template format.
uploaded_files/
- files for posts.
locale/
- translation files.
bootstrap.py
- the script you run to start img2.
readme.html
- this file
403.html
, 404.html
and 500.html
in templates/
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 -x
to create a default admin account.
You can transfer posts from futaba style boards that generate cached html pages. It works for kusaba and wakaba, and probably for kusaba/wakaba forks. You must import one board at a time.
./bootstrap.py -t X Y
where X
is the local path to the directory containing the res/
and src/
folders for the board you want to transfer from, and Y
is the dir of the board (in img2) that you wish to transfer to.