Setting up Ruby and SRAS (incomplete)

Instructions and Tips about Simple Ruby Asset Server (SRAS)
Post Reply
User avatar
nebadon
Site Admin
Posts: 107
Joined: Mon Feb 11, 2008 5:46 pm

Tue Aug 13, 2013 8:45 pm

Step 1: Setting up RVM (https://rvm.beginrescueend.com/) Ruby Version Manager
Run :

Code: Select all

$ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
This will install ruby version manager and add it to your path in .bashrc file, after this completes you need to edit
the .bashrc file and add the following below the RVM path statement:

Code: Select all

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
now from sudo su run the following to install required packages :

Code: Select all

apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev
libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake
libtool bison subversion
now be sure to exit su and run the following to download and install ruby 1.9.2

Code: Select all

rvm install 1.9.3
one Ruby finishes installing run the following command to make version 1.9.2 the default ruby

Code: Select all

rvm use 1.9.3 --default
check ruby and gem is installed by doing

Code: Select all

ruby -v
gem -v
this concludes the RVM installation now to move on to downloading and setting up SRAS

Step 2: Downloading and Installing SRAS (https://github.com/coyled/sras)
to download the SRAS source code run the following :

Code: Select all

git clone git://github.com/coyled/sras.git
go into the root of the sras project (cd sras) and type the following command to install sras

Code: Select all

gem install sras
once this completes
then copy the following text into
/etc/sras/sras.conf or ~/.srasrc
and edit as appropriate:

Code: Select all

sras:
production:
default_asset_dir: /srv/sras
port: 8004
log_file: /var/log/sras.log
pid_file: /tmp/sras.pid
mysql:
production:
adapter: mysql
host: localhost
username: sras
password: sras
database: sras
now create a database named sras in mysql and import the sras/sql/sras_schema.sql into that database to
create tables.

Running Sras

Code: Select all

sras start

Code: Select all

sras –help
to see additional options
Testing Sras
To test asset creation:

Code: Select all

$ curl -d @test/test.asset -X POST -w '%{http_code}\n' \http://localhost:8004/assets/
You should get a 200 HTTP response, have an entry in your assets table, and have a file contain the asset data
on disk.
To test retrieval of that asset:

Code: Select all

$ curl -X GET -w '%{http_code}\n' \http://localhost:8004/assets/0193663d-44e4-4e6e-9a1c-8dd2febc5fc5/data
this concludes installation of SRAS, stop the SRAS process by doing

Code: Select all

kill -9 `cat /tmp/sras.pid`

Code: Select all

rm /tmp/sras.pid
now move on to migrating the data from Robust to SRAS on page 3.
Step 3: Migrating Data from SRAS to ROBUST.
** Before starting this step be sure to make good backups of your databases.**
Prepare the robust table to create hashes in mysql

Code: Select all

ALTER TABLE `assets` ADD `sha256` CHAR( 64 ) NOT NULL AFTER `description`;
once that completes you will run the php now to dump the asset blobs to disk and create sha256 hashes in the
robust database. Place the copy-assets-to-disk.php into the sras data folder ie:

Code: Select all

/srv/sras
as per this example and edit it to change the following configurations as needed for your configurations (lines 23:31)

Code: Select all

// START MySQL Details //
$SERVER = "localhost";
$USER = "user";
$PSWD = "password";
$DB_NAME = "opensim";
$ASSETS_TBL = "assets";
$ASSET_DIR = "data/";
now go to (cd /srv/sras) and run:

Code: Select all

php copy-assets-to-disk.php
this step will take a few minutes to complete once it does all the asset blobs should be now dumped and
deduped from the robust database to /srv/sras
now to dump database from Robust to Sras Tables in mysql run the following query (adjust to your database
names) :

Code: Select all

INSERT INTO sras.assets (`name`, `description`, `sha256`, `asset_type`, `local`, `temporary`, `id`, `created_at`,
`updated_at`) SELECT `name`, `description`, `sha256`, `assetType`, `local`, `temporary`, `id`, `create_time`,
`access_time` FROM opensim.assets;
once that completes now you need to set set base_dir in database (location of asset blobs) run the following
query in mysql :

Code: Select all

update assets set base_dir = '/srv/data';
this completes the data migration the last step is to remove the asset server configurations from the Robust.ini
on page 4
Step 4 : Reconfigure Robust.ini to remove asset services
edit the OpenSim Robust.ini file and make the following changes
Find :
ServiceConnectors =
"8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XIn
ventoryInConnector,8004/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.S
erver.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInCon
nector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.H
andlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,80
02/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:Pr
esenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/Ope
nSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsSe
rviceConnector,8003/OpenSim.Server.Handlers.dll:MapAddServiceConnector,8002/OpenSim.Server.H
andlers.dll:MapGetServiceConnector"
and change it to:
ServiceConnectors =
"8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8004/OpenSim.Server.Handlers.dll:Fre
eswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Se
rver.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationS
erviceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.H
andlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnecto
r,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll
:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/
OpenSim.Server.Handlers.dll:FriendsServiceConnector,8003/OpenSim.Server.Handlers.dll:MapAddS
erviceConnector,8002/OpenSim.Server.Handlers.dll:MapGetServiceConnector"
basically just removing this:
8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,
then just comment out these lines (lines 60:64)
;[AssetService]
; LocalServiceModule = "OpenSim.Services.AssetService.dll:AssetService"
; DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll"
; AssetLoaderArgs = "./assets/AssetSets.xml"
; AllowRemoteDelete = "false"
This concludes the Robust configuration, now move on to step 5 to configure GridCommon.ini for the simulator
to connect to sras.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest