Difference between revisions of "AMuleWeb"

From AMule Project FAQ
Jump to: navigation, search
Line 43: Line 43:
 
Please check [[Webserver-old|this page]] for archived instructions (educational purposes!).
 
Please check [[Webserver-old|this page]] for archived instructions (educational purposes!).
  
== Connecting to aMuleWeb ==
+
== Running aMuleWeb ==
 
+
There's 2 options for activating aMuleWeb.
To run aMuleWeb run '''''amuleweb''''' on a terminal.
+
*First, and preffered, is to enable aMuleWeb activation on aMule preferences. This option works for amuled as well. When started, aMule will attempt to execute '''amuleweb''' command, asuming it's in the search path. Upon exit, aMuleWeb will be automatically terminated.
 +
*Second options is to run aMuleWeb manually, using '''''amuleweb''''' command on a terminal.
  
 
Once aMuleWeb is running, open a web browser and connect to:
 
Once aMuleWeb is running, open a web browser and connect to:
Line 148: Line 149:
  
 
That's it!
 
That's it!
 +
 +
== Template language and development  ==
 +
Simply put, aMuleWeb templates are ordinary HTML files. In order to make them "interactive", server-side language is embedded inside. This language is scaled down dialect of PHP. More detailed information can be found on [[aMuleWeb_PHP]].
  
 
== Where to report problems and questions? ==
 
== Where to report problems and questions? ==

Revision as of 20:52, 17 October 2006

Description

aMuleWeb is a utility that listens for HTTP connections at port 4711 (by default, although it can be changed through Preferences) and allows remote users to control aMule using just a web browser.

aMule itself doesn't support listening to HTTP connections, so the external utility aMuleWeb is used. This utility listens for remote connections, and once the link between aMuleWeb and the remote user is established, it connects to the aMule main program using the External Connections mechanism.

Compiling aMuleWeb

Compile aMule normally, just add --enable-amuleweb when running configure.

Setting up aMuleWeb with aMule

aMuleWeb with aMule 2.0.0 or later

  • For users running the monotlithic aMule application:
    • Go to "Preferences"->"Remote Controls" (in aMule) and...
      • Enable "Accept External Connections".
      • Enable "Use TCP ports instead of unix local sockets" (This option doesn't exist since version 2.1.0)
      • Enter a password for External Connections. If you don't do this, aMuleWeb will not communicate with aMule.
NOTE: When you change your aMuleWeb and External Connections ports here, make sure to restart aMule.
  • For users running the aMule daemon:
    • Shutdown aMuled if it is still running.
    • Run amuleweb -w to generate ~/.aMule/remote.conf and edit it for these options. It previously were on ~/.aMule/amule.conf, but the lines are still on this file, so edit both if in doubt.
      • [ExternalConnect] <- Section header
      • AcceptExternalConnections=1 <-- To enable aMule listening for External Connections.
      • ECUseTCPPort=1 <-- To use the TCP port. Very important since Unix sockets are disabled.
      • ECPassword=ca3c365274907c6fd527068788e14639 <-- To find the MD5 string for your password, do:
$ echo -n yourpasswordhere | md5sum | cut -d ' ' -f 1
ca3c365274907c6fd527068788e14639
    • If you get FATAL ERROR: Cannot find template: default it's because you didn't run make install. If you don't want to install aMule, copy the src/webserver/default/ directory into ~/.aMule/webserver/ (create it if needed). If you want any other template (probably php-default), copy it too. Then go back to the previous step.
    • Restart aMule


NOTE: Every password must be md5sum,also webserver one/s. aMule embedded webserver works without remote.conf,you just need to edit amule.conf. A good trick if you have somewhere an X server is to configure amule using the GUI and then copy the amule.conf configuration file where you want to run the daemon.

Thanks to Stefanero, from who I shamelessly stole a lot from his tutorial.

NOTE: aMuleWeb uses cookies to hold session id. Make sure that cookies are enabled in your browser.

aMuleWeb with aMule pre-2.0.0 final

Please check this page for archived instructions (educational purposes!).

Running aMuleWeb

There's 2 options for activating aMuleWeb.

  • First, and preffered, is to enable aMuleWeb activation on aMule preferences. This option works for amuled as well. When started, aMule will attempt to execute amuleweb command, asuming it's in the search path. Upon exit, aMuleWeb will be automatically terminated.
  • Second options is to run aMuleWeb manually, using amuleweb command on a terminal.

Once aMuleWeb is running, open a web browser and connect to:

http://host:port

where host stands for your host's name (try with localhost) and port stands for the aMuleWeb port (NOT the External Connections port).

For example: http://localhost:4711

Shakraw

Standard ports

The ports can be set to anything, but this are the most used (the standard ones):

Make sure you do not confuse with what each of them is.

Template (skin) location

aMuleWeb looks for its files in a number of places:

  • In your home directory: $HOME/.aMule/webserver/[skin name]/
  • And at it's install location, in this order (by default, /usr/local/share/amule/webserver if you compiled aMule, or /usr/share/amule/webserver if you installed it from a package).

Default template name is 'default'.

If, after installing aMule, aMuleWeb refuses to run because of not being able to load template:

  • Please report this situation to us, and then
  • Create the directories webserver/default in the .aMule subdirectory of your home directory, and copy the contents of the src/webserver directory there from the aMule tarball (I mean to $HOME/.aMule/webserver/default).

GonoszTopi

How to start aMule Daemon and aMuleWeb with your computer

The best way to start both the processes aMule Daemon and aMuleWeb with your server is to add a shell script /etc/init.d/amule like this:

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/amuled
WEB=/usr/bin/amuleweb
NAME=amuled
DESC=amuled
RUNAMULE=no
USER=youramuleuser

test -x $DAEMON || exit 0

# Include amule defaults if available
if [ -f /etc/default/amule ] ; then
    . /etc/default/amule
fi
if [ "$RUNAMULE" != "yes" ];then
    echo "Amule not to be started. Edit /etc/default/amule first."
    exit 1
fi

set -e

case "$1" in
  start)
    echo -n "Starting $DESC: "
       su $USER -c "$DAEMON -f"
       sleep 20
       su $USER -c "$WEB --quiet &"
    echo "$NAME."
    ;;
  stop)
    echo -n "Stopping $DESC: "
       killall --quiet --ignore-case $WEB
       killall --quiet --ignore-case $DAEMON
    echo "$NAME."
    ;;
  restart|force-reload)
    echo -n "Restarting $DESC: "
       killall --quiet --ignore-case $WEB
       killall --quiet --ignore-case $DAEMON
    sleep 1
       su $USER -c "$DAEMON -f"
       sleep 20
       su $USER -c "$WEB --quiet &"
    echo "$NAME."
    ;;
  *)
    N=/etc/init.d/$NAME
    echo "Usage: $N {start|stop|restart|force-reload}" >&2
    exit 1
    ;;
esac

exit 0

Then just set that script to be run at start up. On Debian this would be doen with the following command:

update-rc.d amule defaults

Then, for the deamons to start you just have to create a file /etc/default/amule which contains a single line:

RUNAMULE=yes

That's it!

Template language and development

Simply put, aMuleWeb templates are ordinary HTML files. In order to make them "interactive", server-side language is embedded inside. This language is scaled down dialect of PHP. More detailed information can be found on aMuleWeb_PHP.

Where to report problems and questions?

For Problems or Questions just report on http://forum.amule.org forum or join IRC channel #amule at irc.freenode.net

Other sources of information

Read the aMuleWeb man page, which is available in English, French, German, Hungarian and Spanish.

For further information read the aMuleWeb FAQ.