====== Quick Start ======
Through out this guide you see ''%%xxxxxxx%%''. This is to be replaced with **your** username from your welcome email.
===== Preflight =====
* Information from your Joyent Facebook Welcome email.
* Your Server Name **.fb.joyent.us**
* Your User name is **xxxxxxxx** part of the Server Name.
* A method to [[shared:kb:sftp|SFTP]] your files onto your accelerator.
* In a browser go to **http://xxxxxxxx.fb.joyent.us** and check that you see the "Welcome Home" webpage.
* If you require a database, then in a browser log into **https://xxxxxx.fb.joyent.us:10000/** as **admin** and please follow [[facebook:kb:start#databases|these instructions]].
===== PHP =====
==== Copy Files ====
* SFTP to your server with user xxxxxxxx server xxxxxxxx.fb.joyent.us
* Place your files into ''%%/home/xxxxxxxx/web/public%%''
===== Rails =====
==== Copy Files ====
* SFTP to your server with user xxxxxxxx server xxxxxxxx.fb.joyent.us
* Place your rails application into ''%%/home/xxxxxxxx/web%%''
==== Migration ====
* Follow the instructions above on creating your database(s) if you have not already done so.
* Follow the instructions below on running a command from the server to do your migration
- In **Command to run** enter:
* cd /home/xxxxxx/web && rake db:migrate RAILS_ENV=production
==== Create a bootup action ====
- Log into https://xxxxxxxx.fb.joyent.us:10000 as **admin**
- Click **Service** in the left-hand navigation, then click **Bootup Actions**
- From the top of boot-up actions page, click **Add Mongrel**.
- Enter a short name (letters, digits, '-' or '_' are allowed, but not spaces) into the **Action name** field.
- Enter a description into **Description**.
- Choose whether you want the action to start (and keep running) right away using the **Started?** option. You'll most likely want to leave this as **Yes**
- Enter the port number you wish to run the application on into **Port number** field. This can be a path to a binary or to a script with optional parameters etc. Typically 8001.
- Enter the rails application root into **Rails root directory** field. Typically it will be /home/xxxxxxxx/web/.
- Select which environment to run from **Environment** field. Typically production.
- Click **Create**.
==== Apache proxy ====
- Log into https://xxxxxxxx.fb.joyent.us:10000 as **admin**
- Click **Server Configuration**, then **Edit Proxy Website**.
- Set //Proxying enabled?// to **Yes**.
- For //Proxy to URL//, enter the destination URL of your application, e.g. %%http://127.0.0.1:8001/%%, replacing //8001// with the port number you entered on step 7 above.
- Click **Save and Apply**.
Do not forget the trailing slash on the //Proxy to URL//. The correct proxying URL ends with a port number **followed by a slash**. Failing to provide the slash can result in non-functional URLs on your application.
===== Python =====
mod_python is not enabled in apache by default to save on memory for the people who do not require python. If you require MySQL then please follow [[jpkgsrc#mysqldb-for-python-django| these instructions]] for building the current version of MySQLdb.
==== Copy Files ====
* SFTP to your server with user xxxxxxxx server xxxxxxxx.fb.joyent.us
* Place your files into ''%%/home/xxxxxxxx/myapps/%%'' (for example)
==== mod_python & handler ====
- In a browser log into https://xxxxxxxx.fb.joyent.us:10000/ as **admin**
- Select **Webmin** below **Joyent Accelerator**
- From the left-hand navigation select **Server**
- Select **Apache Webserver**
- From the right side select the **Global configuration** tab
- Select the **Edit Config Files** icon
- Select the **/opt/local/etc/httpd/includes/dso.cfg** file from the combobox
- Select the **Edit Directives in File:** pushbutton
- Look for the line #LoadModule python_module lib/httpd/mod_python.so and change to LoadModule python_module lib/httpd/mod_python.so
- select **Save**
- From the right side select the **Existing Virtual Hosts** tab
- Select the **Virtual Server** for your django application xxxxxxxx.fb.joyent.us
- Select the **Edit Directives** icon
- Add your handler something like shown below:
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonDebug On
PythonPath "['/home/xxxxxxx/myapps'] + sys.path"
- Select the **Save** pushbutton
- From the upper right select **Apply changes** to restart apache
====== Running a command on the server ======
If you need to run any commands on the server you are able to ssh as xxxxxxxx@xxxxxxxx.fb.joyent.us. You are also able to do it from your browser. Below is shown how to run a rails migration. The basic format for any command is
cd /path/to/current/directory && COMMAND_TO_EXECUTE param1, param2
* Log into https://xxxxxxxx.fb.joyent.us:10000 as **admin**
* Select **Webmin** from the left-hand navibation
* Select **System**
* Select **Running Processes**
- In **Command to run** enter:
* cd /home/xxxxxx/web && rake db:migrate RAILS_ENV=production
- Select "Run"