Getting Drupal up and running is pretty simple. There are a few things to be aware of when launching Drupal on Pagoda Box. After reading this, you should be able to:
- Create a local instance of Drupal
- Take your local instance of Drupal and deploy it to Pagoda Box
- Create a Pagoda database and access it from your Drupal app
- Bask in the combined awesomeness of Drupal and Pagoda Box
Launching Your Drupal App
Create a Local Instance of Drupal
Important: No Auto-Installers on Pagoda Box
You are not able to run auto-installers on Pagoda Box. If you use Drupal's auto-installer, run it locally to generate all the necessary configuration files, then deploy your app to Pagoda Box.
During development, we recommend configuring Drupal to display errors in the admin panel. By default Drupal is configured to display "All messages", so unless you've changed that, you should be ready to go.
Create a Git Repo for Your Drupal App
Set up Git, if you haven't already. Then initialize your app as a git repo.
Move Drupal into Subdirectory
Because Drupal needs a Temporary Directory that is not accessible over the web, move your entire Drupal application(excluding .git/ & .gitignore) into a subdirectory. We suggest naming the directory "drupal" so it coincides with the below Boxfile. You don't need to create the actual temporary directory as the below Boxfile will create it for you when your app is deployed.
Edit .gitignore file
Depending on your version of Drupal, it may have come with a default .gitignore file. Remove the line with the settings.php file as Pagoda will need this included in your repo. Then also prepend the "files" and "private" directories with the new "drupal" directory added in the last step.
GITEdit .gitignore File
The All-Powerful Boxfile
Create a file named "Boxfile" in the base directory of your git repo and paste in the following code snippet. The Boxfile is your Pagoda Box config file. If you want the Boxfile explained in more detail, click here.
PHPDrupal Boxfile Example
Identifying sites/default/files as a writable directory will allow your application to write images, uploads, etc. to that directory and then share them among application clones. The PHP extensions are those required by the Drupal System Requirements.
Your directory structure should now look something like this:
If you want to know more about writing your own or customizing your Boxfile, check out Boxfile Guide.
Local vs. Live Environments
Since Drupal doesn’t natively accommodate database settings for multiple environments(Local vs Live), we recommend adding some additional logic to your sites/default/settings.php file to dynamically switch database settings based on an environment variable. Note that the Pagoda database credentials have been replaced with auto-created global variables instead of the actual credentials. But, you can also hard code the credentials if you prefer.
PHPSet Your Database Credentials
Deploy Your App on Pagoda Box
Just go through the normal process of deploying your app.
Create a Database
If you used the example Boxfile from above, an empty database has already been created for you. If not, you can manually create a database from the dashboard.
Create Environment Variable
Create an environment variable with the key and value of PLATFORM = PAGODABOX so your app will know which database to connect to.
Get your local database to Pagoda
Export your local database with your favorite local database administration tool(e.g. phpMyAdmin, Sequel Pro, etc.).
Import your database into your live app on Pagoda using the database tunnel
Now when you go to yourapp.pagodabox.com you should see your Drupal app running on Pagoda!
Lastly, configure Drupal to use the "tmp" you created in your Boxfile, by going to yourapp.pagodabox.com/admin/config/media/file-system and entering "/tmp" as the "Temporary directory".
If you set errors to display, now would be a good time to turn it off, unless you're still debugging your Drupal app.
Post-launch Workflow Recommendations
Things to Note
Pagoda Box makes managing and updating your Drupal app really easy, but there’s some things you should know.
For security reasons, Pagoda Box only allows SSH or FTP access to your writable directories, but not your application code. This means that any updates, plugins, themes, or any other code changes need to be done on your local instance first, then pushed to your repo and deployed through your app dashboard.
Remember that your local database and your live database are two completely separate databases. Anytime you want to publish a new post or add media to your Drupal app, it needs to be done through your live admin, not your local admin. Your Drupal content is not stored in your repo so any content you add locally will not be pushed live with your repo.
Table of Contents
- Create a Local Instance of Drupal
- Display Errors
- Create Your Git Repo
- Move Drupal into Subdirectory
- Edit .gitignore
- Edit .gitignore File
- Local vs. Live Environments
- Connecting Drupal to your Database
- Deploying Your App to Pagoda Box
- Creating a Database
- Create Environment Variable
- Get your local database to Pagoda