by Drew Pearce
• August 15, 2016
DreamFactory is an incredible piece of software, but like with any new tech, there’s something to learn every day.
Where is everything?How to backup dataCreating an API keyChecking the log fileUsing the testing tool
Here are the default locations:
This is completely custom. I hope you paid attention while installing =)The location used in the documentation is /opt/dreamfactory.
Before you make changes to your installation (like upgrading) you should make a backup, and with DreamFactory, it’s a piece of pie (cake is overrated.)
You need to make a copy of the installation directory (see tip #1). So, if I have a directory called /backups I can copy my Bitnami Cloud VM install directory like this:
cp -r /opt/bitnami/apps/dreamfactory/htdocs /backups/htdocs.old
Or, if you want to get really fancy, you can compress it and add the date to the file name
tar -czf /backups/htdocs-$(date +"%Y%m%d%H%M").tar.gz /opt/bitnami/apps/dreamfactory/htdocs
The point is no matter what Operating System or tools you use, you really just need to copy those files. They’re important.
Did you use sqlite as the system db? Then you already did your backup with file backup above. The sqlite system database is just a file:
MySQL? You can use the mysqldump command to do a backup, or if you have a tool like phpMyAdmin (comes with Bitnami local installs), you just log in, select the database and click the Export tab. The default settings should be fine (Quick method and SQL format.) Click Go. This file can be used to restore the data in the system database if you need to revert changes made.
In DreamFactory nearly all calls need an API Key. There are a few exceptions (calls made with admin user session info and calls for logging in,) but generally, assume you need an API Key to make your calls. Not sure what API Key to use? You can create one or get an existing one from Apps tab of the admin console. If your API Key has a default Role associated with it, that’s all you need to make your call. If not, you’ll need a session token too. The DreamFactory authorization and authentication system is heavily documented with a plethora of examples.
4. Check the log file
The DreamFactory log file is a key part of the troubleshooting process. If you’re having trouble with a service or API call, you can find valuable information in the log.
The DreamFactory log file is located in:
By default the application is not writing full debug information to the log file. You’ll want to enable debug logging by setting the DF_LOG_LEVEL equal to DEBUG in the .env file and clearing the config cache and the application cache.
Let’s take the example of a mysql service. I’ve put in my connection information, but when I try to load the schema in the schema editor, nothing happens.
I take a look at the log file and see:
SQLSTATE[HY000]  Access denied for user 'localadmin'@'localhost' (using password: YES)
AHA! I must have put in the wrong credentials. I can now fix my service configuration and proceed with my API masterpiece. These types of hints in the log can be a huge help in figuring out what went wrong.
Swagger (API Docs) is great for learning how your API calls work, but it has a lot of overhead for your browser, and it grows and grows as you add more services. What if you’ve gotten a handle on how the DreamFactory APIs work, and you just need to test a quick API call? Enter Test Rest.
Join the DreamFactory newsletter list.