23 Aug 2015

Usergrid Docker Setup Cheatsheet

Cheatsheet on setting up Usergrid with Docker.

Install Cassandra & Usergrid Docker Images

I'm running two Usergrid servers on Linux. On my development machine I'm using Docker to run a server based on the gaborwnuk/usergrid image.

docker run -p 9042:9042 -d --name cass1 poklet/cassandra
docker pull gaborwnuk/usergrid
docker run -d -p 8080:8080 --link cass1:cassandra gaborwnuk/usergrid

usergrid-custom.properties

Usergrid server properties can be set by creating a file called usergrid-custom.properties in the tomcat lib directory. There's an example file here and another good example file here and here. On my systems the file is

/usr/share/tomcat7/lib/usergrid-custom.properties

Create your usergrid-custom.properties file as described below and then restart the docker usergrid container

docker stop gaborwnuk/usergrid
docker start gaborwnuk/usergrid

First Time Server Setup

Follow the Usergrid server installation instructions here. This is a summary:

Run Usergrid Database & Super User Setup

Start Tomcat and use your web browser to visit the URLs below. While you do this you might want to watch the logs under tomcat/logs for clues, just in case anything goes wrong.

Database setup URL - http://localhost:8080/system/database/setup

You'll be prompted to login. Use the sysadmin credentials you entered in the usergrid properties file.

Superuser setup URL - http://localhost:8080/system/superuser/setup

Portal Login & Organization Setup

Login to the Usergrid portal and create an Organization

http://localhost:8080/usergrid-portal/?api_url=http://localhost:8080

 

Usergrid Properties File Settings

Start with the Admin user setup values:

usergrid.sysadmin.login.name=superuser
usergrid.sysadmin.login.email=myself@example.com     <--- Change this
usergrid.sysadmin.login.password=pw123               <--- Change this
usergrid.sysadmin.login.allowed=true
usergrid.sysadmin.email=myself@example.com           <--- Change this

Mail Server Settings

Create the following entries in your properties file and set them for your mail server. For gmail, when I first sent a password reset, I received a warning that an app was using my account and had to approve use of the account by the app.

mail.transport.protocol=smtps
mail.smtps.host=smtp.gmail.com
mail.smtps.port=465
mail.smtps.auth=true
mail.smtps.username=
mail.smtps.password=
mail.smtps.quitwait=false

URL Settings

Add the following to your properties file and set the hostname value with your server name.

usergrid.user.activation.url=http://:8080/%s/users/%s/activate
usergrid.user.confirmation.url=http://<host>:8080/%s/%s/users/%s/confirm
usergrid.user.resetpw.url=http://<host>:8080/%s/%s/users/%s/resetpw

email Form

The following entry can be used to configure the email sent to the user on reset:

usergrid.management.email.user-password-reset=\
 <p>To reset your password, click here:</p>\n\
 <p><a href="${reset_url}">${reset_url}</a></p>

For admin user resets:

usergrid.management.email.admin-password-reset=\
 <p>To reset your password, click here:</p>\n\
 <p><a href="${reset_url}">${reset_url}</a></p>

HTML Forms

There are four HTML forms associated with resetting passwords. They're all under the directory:

/usr/share/tomcat7/webapps/ROOT/WEB-INF/jsp/org/apache/usergrid/rest

The reset email form can be found here:

management/users/UsersResource/resetpw_email_form.jsp

The reset email form can be found here:

management/users/UserResource/resetpw_email_form.jsp

The reset user form is here:

applications/users/UsersResource/resetpw_email_form.jsp

The reset user form is here:

applications/users/UserResource/resetpw_email_form.jsp

Tags:
0 comments