= Short Demo

In this short demo (~5 minutes), we will set up a runing James demo very quickly
using a prepared Docker image.
Then you will add a domain, and a user account within that domain.


Requirements: 

 * Docker

== Set up the demo server

To begin, run the James demo server using Docker:

[source,bash]
----
docker run -d -p "25:25" -p "143:143" --name james apache/james:demo-3.6.2
----

Explanation:

 * `docker run` runs the provided image with the given parameters
 * The `-d` parameter runs the container in "detached" mode
 * `-p "25:25" -p "143:143"` attaches the image ports to the ports 25 (SMTP) and 143 (IMAP) on the host machine
 * The `--name james` parameter gives the running container a name to make it easier to manipulate
 * `linagora/james-jpa-sample:3.4.0` is the image that is used for this demo

Docker will pull the image and start the container.

== Connect via the CLI

****
To run commands using the James CLI, you can use the running container via Docker:

----
docker exec james james-cli <<COMMAND>>
----

****

As an example, list all the domains currently in use by James:

[source,bash]
----
docker exec james james-cli listDomains
----

You should notice that a default domain, james.local, has been created

List all the current users:

[source,bash]
----
docker exec james james-cli listUsers
----

You should see users ``user01@james.local``, ``user02@james.local``, and ``user03@james.local``.

Create a new "test.local" domain:

[source,bash]
----
docker exec james james-cli addDomain test.local
----

List the domains again to ensure that "test.local" has successfully been added:

[source,bash]
----
docker exec james james-cli listDomains
----

Add the user "testuser" to the "test.local" domain with password "password":

[source,bash]
----
docker exec james james-cli addUser testuser@test.local password
----

You should now see your newly created user:

[source,bash]
----
docker exec james james-cli listUsers
----

And that's a wrap!

== Stop the server

To stop the demo:

[source,bash]
----
docker stop james ; docker rm james
----

