Setup an open-source digital asset management system for your studio on AWS Cloud

In this post, we will take a look at ResourceSpace, an open-source digital asset management solution and walk you through the process of setting up your instance in the cloud.

Photo by Guilherme Vasconcelos on Unsplash

Digital content creation requires managing digital assets at scale. It is very important to have simple systems that can support various types of metadata about the content, yet provide a fast and intuitive user experience for artists to find what they are looking for.

We will be using AWS EC2 for compute and AWS EBS for storage of our digital assets. There are a zillion tutorials on the web on how to setup your own EC2 instance. So, we are gonna skip those details and dive right in to the setup of ResourceSpace.

For reference, this is the configuration that we will be using for the tutorial.

  • EC2 t2.small instance running Ubuntu 18.04
  • 100Gb of EBS Storage

It’s recommended that you take your studio’s traffic and storage requirements in to consideration while setting up your own instance.

Prerequisites

Install dependencies

sudo apt-get update
sudo apt-get install nano imagemagick apache2 mysql-server subversion
sudo apt-get install ghostscript antiword xpdf postfix libimage-exiftool-perl cron wget
sudo apt-get install php php-dev php-gd php-mysql php-mbstring php-zip libapache2-mod-php ffmpeg exiftool

Once you have gained SSH access to the EC2 instance, you can check the attached volumes using command

lsblk
xvda    202:0    0    8G  0 disk 
 └─xvda1 202:1    0    8G  0 part /
 xvdb    202:16   0  100G  0 disk 

As you can see from above, I have 2 volumes, xvda1 that is 8Gb for my OS root and xvdb which has 100Gb(attached EBS volume)

Check the filesystem on the root volume using command

sudo file -s /dev/xvda1
/dev/xvda1: Linux rev 1.0 ext4 filesystem data, UUID=c03b791b-60ef-4ae1-82b5-5c9ab6b4d08f, volume name "cloudimg-rootfs" (needs journal recovery) (extents) (64bit) (large files) (huge files)

Create the same filesystem for the attached volume as well(xvdb)

sudo mkfs -t ext4 /dev/xvdb
mke2fs 1.44.1 (24-Mar-2018)
 Creating filesystem with 26214400 4k blocks and 6553600 inodes
 Filesystem UUID: 56936773-33e1-46a3-99da-0b7067183ac5
 Superblock backups stored on blocks: 
     32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
     4096000, 7962624, 11239424, 20480000, 23887872
 Allocating group tables: done                            
 Writing inode tables: done                            
 Creating journal (131072 blocks): done
 Writing superblocks and filesystem accounting information: done

Mount the volume under /data

sudo mkdir /data
sudo mount /dev/xvdb /data

Setup ResourceSpace

At the time of writing, the latest version of ResourceSpace available is 9.1

Checkout ResourceSpace repository to the install location.

cd /var/www
mkdir resourcespace
cd resourcespace
sudo svn co https://svn.resourcespace.com/svn/rs/releases/9.1 .
sudo chmod 777 /data
sudo chmod -R 777 include

Create database and a user for ResourceSpace to access the database. We will be needing this credentials later during the first launch of ResourceSpace

sudo mysql
CREATE DATABASE resourcespace CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'resourcespace_rw'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON resourcespace.* To 'resourcespace_rw'@'localhost';
quit

ResourceSpace uses LAMP stack. Configure Apache and add a VirtualHost for your ResourceSpace installation.

sudo vi /etc/apache2/sites-enabled/example.com.conf
# Replace example.com with your domain/subdomain

Add the following entry to the site config file

<VirtualHost *:80>
    ServerName example.com
    DocumentRoot /var/www/resourcespace
    <Directory /var/www/resourcespace>
        Options  FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Enable the site using a2ensite command

sudo a2ensite example.com.conf

Setup SSL certificate. If you already own an SSL certificate for your domain, you can use that one. For the purpose of this tutorial, we will be using LetsEncrypt.

sudo add-apt-repository ppa:certbot/certbot
sudo apt install python-certbot-apache
sudo certbot --apache -d example.com -d www.example.com

Configure ResourceSpace

ResourceSpace default configuration is stored under include directory.

sudo vi include/config.default.php

Search for the following settings in the config

$storagedir

You will come across a section that looks like this

Uncomment and set next two lines to configure storage locations (to use another server for file storage)
#
Note - these are really only useful on Windows systems where mapping filestore to a remote drive or other location is not trivial.
On Unix based systems it's usually much easier just to make '/filestore' a symbolic link to another location.
#
#$storagedir="/path/to/filestore"; # Where to put the media files. Can be absolute (/var/www/blah/blah) or relative to the installation. Note: no trailing slash
#$storageurl="http://my.storage.server/filestore"; # Where the storagedir is available. Can be absolute (http://files.example.com) or relative to the installation. Note: no trailing slash

Uncomment the line which says storagedir and set that to

$storagedir="/var/www/resourcespace/filestore";

The above path will be used by ResourceSpace to store all your data. As we have mounted our storage volume under /data, we will create a symlink from /var/www/resourcespace/filestore to /data

ln -s /data /var/www/resourcespace/filestore

Edit Apache PHP.INI to set ResourceSpace recommended settings

sudo vi /etc/php/7.2/apache2/php.ini

Set the following values in the config file

memory_limit = 200M
post_max_size = 100M
upload_max_filesize = 100M

First Launch

Time to finish your setup by navigating to the domain you configured on Apache.

Verify Installation check on the right to see if the recommended settings were configured correctly.

Scroll down further to fill in the database configuration as well as set the admin password.

Use the database credentials that we had setup earlier in Database setup section.

Once the installation is complete, you need to change the permissions to your installation include directory.

cd /var/www/resourcespace
sudo chmod -R 750 include/
cd ..
sudo chgrp -R www-data resourcespace/

That’s it! You have your very own Digital Asset Management System.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.