Ongoing server management

Wiping server data

If you are deploying a demo server of Orion, you may want to periodically wipe out all user data, but preserve account names and passwords. This is done as follows:

 .metadata\.plugins\org.eclipse.core.runtime (contains server configuration file)
 .metadata\.plugins\org.eclipse.orion.server.user.securestore (contains user account information)
#!/bin/bash

BASE_PATH=/home/admin
ECLIPSE_PATH=eclipse-orion-0.2M6


cd $BASE_PATH || die "Cannot access home directory"

kill $(ps aux | grep "[o]rg.eclipse.equinox.http.jetty.http.port=8080" | awk {'print $2'})
rm -rf $ECLIPSE_PATH/serverworkspace.old
mv $ECLIPSE_PATH/serverworkspace/ $ECLIPSE_PATH/serverworkspace.old
mkdir $ECLIPSE_PATH/serverworkspace
mkdir -p $ECLIPSE_PATH/serverworkspace/.metadata/.plugins/org.eclipse.core.runtime/
rsync -av $ECLIPSE_PATH/serverworkspace.old/.metadata/.plugins/org.eclipse.core.runtime/ $ECLIPSE_PATH/serverworkspace/.metadata/.plugins/org.eclipse.core.runtime/
rsync -av $ECLIPSE_PATH/serverworkspace.old/.metadata/.plugins/org.eclipse.orion.server.user.securestorage/ $ECLIPSE_PATH/serverworkspace/.metadata/.plugins/org.eclipse.orion.server.user.securestorage/

$BASE_PATH/start_orion


Automating account creation with curl

To automate account creation with curl, you need to issue one curl command to log into the Orion server and capture the returned cookie. Subsequent curl calls must include the authentication cookie, and a POST payload, to create an account.

#!/bin/bash

# Create accounts on Orion server
CURL=/usr/bin/curl
SERVER=localhost

# Log in
$CURL -c curl_cookies.txt \ # Store cookies in this file
      -d 'store=Orion'    \ # POST value: store type
      -d 'login=admin'    \ # POST value: login
      -d 'password=yourpass' http://$SERVER/login

# Create one account
# Loop here to create multiple accounts
$CURL -b curl_cookies.txt    \ # Use this cookies file
      -H "Orion-Version:1"   \ # Specify Orion version as an HTTP header
      -d 'login=someaccount' \ # POST value: create account called someaccount
      -d 'password=abc123'   \ # POST value: password is abc123
      http://$SERVER/users



Server admin guide Server admin guide