Serving your own Rails project

If you want to serve your own Rails project from a Rails app installed via your Opalstack control panel:

1

Upload your project directory to your Rails application directory, for example: /home/myuser/apps/myapp/

2

SSH to your application's shell user account.

3

Set your GEM_HOME and PATH environment to your application and then install your project dependencies with bundle:

export GEM_HOME=$HOME/apps/myapp/env
export PATH=$HOME/apps/myapp/env/bin:$HOME/apps/myapp/newproject/bin:$PATH
cd $HOME/apps/myapp/newproject
bundle install
4

Edit the start and stop scripts in your Rails application directory to change the PROJECTDIR variable on line 4 to point to your project directory.

For example if your project directory is named newproject you would change this...

# change the next line to your Rails project directory
PROJECTDIR='/home/myuser/apps/myapp/myproject'

... to this ...

# change the next line to your Rails project directory
PROJECTDIR='/home/myuser/apps/myapp/newproject'
5

Finally, run the following commands to switch your Rails instance over to your project:

export APPDIR=$HOME/apps/myapp
mkdir -p $APPDIR/newproject/tmp/pids
cp $APPDIR/oldproject/tmp/pids/* $APPDIR/newproject/tmp/pids/
$APPDIR/stop
$APPDIR/start