vagrant-spk, on some platform stacks, MySQL is available by
default. To connect use:
- Username: root
- Password: (empty string)
- Host: localhost
Some apps insist on non-empty MySQL passwords, and some apps insist
that the database be created before the app starts. For those apps, consider
adding the following to
echo "CREATE DATABASE IF NOT EXISTS app; GRANT ALL on app.* TO 'app'@'localhost' IDENTIFIED BY 'app';" | mysql -uroot
Once you do that, you can use database
app with username
app on the host
The above applies to the following platform stacks:
- lemp (PHP)
- uwsgi (Python)
Removing MySQL support: If you have an app that does not need the
database, you can remove MySQL support from your package. To do that,
look in the
launcher.sh script and remove any line that refers to
mysql (case-insensitive). Doing this will make grains launch faster.
It can also make the package smaller, so long as you re-generate
sandstorm-files.list after removing MySQL invocations from
If your app needs Redis, PostgreSQL, or any other service, you can support for it to your package. To do that, keep the following in mind.
One user ID. Sandstorm only provides a single user ID inside the grain, so you need to adjust the init scripts and configuration files to use one user ID.
Create what you need in /var. Each Sandstorm grains runs with an empty, fresh
/varat grain creation time, so you'll have to ensure that any necessary directories or files are created in
One service per grain. Where possible, it's best to embed the service into each app instance. If you are a large-scale system administrator, this might sound strange. This approach has the advantage that if one grain is insecure or malicious, no other data are compromised.
For details on how to configure this properly, consider using
vagrant-spk to initialize a
lemp virtual machine, and examine the
scripts generated by that.