Setting up the Asset Server

Reference Manual > Asset Server Guide > Setting up the Asset Server

Server-side Installation

The Asset Server is architectured to be a simple one-time installation on a server machine. Interacting with the Asset Server is done through Unity. Unity can be installed on the server machine, but it does not need to be. It must be administrated from a Client machine, where Projects and Users can be added. Each additional client must be configured to synchronize with a Project, using a specific User credential.

You can install the Asset Server on any Mac OS X machine or on Linux. Download Unity Asset Server

The installer will install all necesary files, setup a database and launch the Asset Server. At the end of the process you will be asked for an Admin password. This password is required to administer the Asset Server from within Unity. You must connect to the Asset Server as the administrator before you can create any projects or users.

Administrating the Asset Server

The Asset Server allows any number of Users to connect to a Project. The Administrator must first connect to the Server with Unity as a client and create new Projects and Users.

To access the Administrator controls, launch Unity and select Server->Asset Server Administration....


The Server Administration dialog

In the Server Address field, enter either the ip address or host name of the computer running the Asset Server that you want to administrate. If the Asset Server is installed on your local machine, you can use "localhost" as the Server Address. Next, provide the administrator name and password. The administrator name is always "admin", and the password is what was entered when installing the Asset Server. Finally, hit the Connect button. You're now connected to the Asset Server, and can perform the initial setup.

Creating a new Project and adding Users

Each Server can contain several Projects, and each User can have permission to one or more Projects. Projects are generally orthogonal, and unique in asset collections. It is best to think "one Project equals one game".

New Projects can be created by clicking on the New Project button in the Server Administration dialog.


When prompted, enter a name for the new project

New users can be created by first selecting an existing project and then clicking on the New User button.


Creating a new user

After a user has been created in one Project, the user can be added to another project by enabling the checkbox on the left of the user name in the users list.

Asset Server Client Setup

Once you have been provided a Project and User account, you can synchronize your local Project with any server Project. You will have to establish a connection with the server initially, and you can only be connected to one server at any given time. Every time you want to change servers, you will need to follow this process.

Establishing a Client Connection

Every client must connect to the machine running the Asset Server. To access the Connection Settings dialog, open choose Server->Connection Settings... from the menu bar.


The Connection Settings dialog

Notice there are two tabs, Local projects and Internet projects. If you have the server installed on your local machine, or if you are on a LAN with the server machine, then you will use the Local Projects tab. It uses Bonjour to find all Projects in all Asset Servers on the LAN. You will see the Project appear in the box. Double-click it to open that Project.

The Internet projects tab will allow you to specify a remote server address in the Server field. You can use either the machine's ip address or host name. You must enter a valid project name in the Project Name field to connect to the correct Project on the server. For this reason, the Project information provided to each remote user must be exact and accurate.


The Internet projects tab is used when working remotely

Note: If you are running your Asset Server on a local Linux machine instead of Mac OS X, the Projects on the server will not show up in the Local projects pane. Use the Internet projects pane to connect to Projects hosted on Linux machines.

Firewall settings

The Unity Asset Server uses TCP port 10733. You might need to enable connections to this port in your firewall and/or router.

Advanced

The Asset Server is built using a modified version of PostgreSQL. Accessing the SQL database directly requires a bit of technical knowledge about SQL and Unix/Linux command lines. User discretion is advised.

Accessing the Asset Server Database

To view the tables in a Project database, first you need to figure out the name of the actual database. Run this command line command on the machine hosting the Asset Server:

Mac OS X
/Library/UnityAssetServer/bin/psql -U admin -h localhost -d postgres -c 'select * from all_databases__view'

Linux
/opt/unity_asset_server/bin/psql -U admin -h localhost -d postgres -c 'select * from all_databases__view'

This and other commands will prompt you for a password. Every time this happens, enter the admin password for the database, which was set during the installation. The result will be a table that follows this basic layout:

    databasename    |    projectname     |       description        | version 
--------------------+--------------------+--------------------------+---------
 sandbox            | Sandbox            | Created with Unity 2.0.0 | 1.0
 game               | Game               | Created with Unity 2.0.0 | 1.0
 my_game_project    | My Game Project    | Created with Unity 2.0.0 | 1.0
(3 rows)

Now you need to identify the "databasename" of the Project you want to back up. When creating a database, the default "databasename" is same as the "projectname" as shown inside Unity, but in lowercase and spaces replaced with underscores.

Backing up

To create a backup of an Asset Server database, run the following command, replacing DATABASENAME with the name of the desired database, pulled from your "databasename" list produced earlier.

Mac OS X
/Library/UnityAssetServer/bin/pg_dump -U admin -h localhost DATABASENAME -bo -F c > DATABASENAME.pgdump

Linux
/opt/unity_asset_server/bin/pg_dump -U admin -h localhost DATABASENAME -bo -F c > DATABASENAME.pgdump

Restoring a Backup

To create a backup of an Asset Server database, run the following command, replacing DATABASENAME with the name of the desired database, pulled from your "databasename" list produced earlier.

Mac OS X
/Library/UnityAssetServer/bin/pg_restore -U admin -h localhost -c -F c -d DATABASENAME < DATABASENAME.pgdump

Linux
/opt/unity_asset_server/bin/pg_restore -U admin -h localhost -c -F c -d DATABASENAME < DATABASENAME.pgdump

If you are restoring a database to a new database that doesn't exist yet, you should create a new Project first inside the Asset Server Administration dialog, then restore to this empty database. This is much more ideal than using the -C option.

Deleting a Database

Note: You cannot undo this command, so it is recommended that you have a backup first.

To delete an Asset Server database including all data, run the following command, replacing DATABASENAME with the name of the desired database, pulled from your "databasename" list produced earlier.

Mac OS X
/Library/UnityAssetServer/bin/dropdb -U admin -h localhost -d DATABASENAME

Linux
/opt/unity_asset_server/bin/dropdb -U admin -h localhost -d DATABASENAME

Deleting User Accounts

Note: Be careful not to remove any system accounts (such as admin or unitysrv) or you might render your Asset Server installation unusable.

You can enable or disable user access for individual projects in the built-in administration tool, but to completely remove a user from the server, run the following command, replacing USERNAME with the user name of the user you want to remove.

Mac OS X
/Library/UnityAssetServer/bin/dropuser -U admin -h localhost -d USERNAME

Linux
/opt/unity_asset_server/bin/dropuser -U admin -h localhost -d USERNAME

Additional SQL Functions

These and all other commands use tools from the PostgreSQL distribution. You can read more about what those and others actually do here: http://www.postgresql.org/docs/8.2/interactive/reference-client.html