How to get a Project locally
You can setup a Project on your own preferred dev stack. To do this you need to clone the code repository and get a database dump.
Prerequisites¶
SSH key¶
Before you can get projects installed locally, you will need to make sure you have set up an SSH key. For information on how to do so, see the Manage SSH keys page.
Using your local stack¶
We’re not going to tell you how to set up your own stack (since there are many options), but it is doable to get the Project repository and database so you can run a Project in the solution of your choice. We recommend DDEV.
1. Repo¶
You can find the repository location in the ‘General’ tab of your Project or even Project Environment.
2. Technical info¶
Relevant information, such as the PHP or Node JS version this Project Environment is running (which you want to mirror in your local setup), can be found in the ‘Technical’ tab.
3. Dependencies¶
Our Drupal (and Mautics) are composer-based, so it’s important to run the appropriate commands according to the readme files included in those projects, or specific information provided in that Project’s Space in Confluence. The Rocketship projects, for example, have an extensive installation & development guide.
For javascript-based projects, dependency management will depend on the type of framework used. Again, refer to the
included readme file(s) for more information but they will usually contain at least a package.json file referencing node
modules. At the very least there will be a version of Node JS and NPM required, and an npm install
you’ll have to run.
4. Database¶
There are several ways to get the database of a project, depending on your Project type and options in your local Stack.
General
You can export an Environment database, via the 'Backups' tab of any Environment that supports backups.
Drupal
In the case of a Drupal project, the easiest way to be able to sync your local and a remote databases, or simply
downsync, would be to use drush and drush aliases. Your project already contains the right files in etc/drush
.
We won’t go over how to work with aliases, but it should just be a matter of either pointing your local setup to the
file location or move the files to the expected place (eg. in DDEV, it needs to be in drush/sites/
)
The ‘Common commands’ item of the ‘Technical Info’ tab contains some example commands for database & file syncing, it
looks something like this: ddev drush sql:sync @<my project>.staging @self
Alternatively, you have SSH access to the non-production environment servers, so you could feasibly connect and get
to the database that way. The SSH command is also in the ‘General’ tab of the Environment. You can find database
information for the remote environments, in settings files located in etc/drupal
Binlog and MySQL
Certain projects may have MySQL running with binlog enabled (e.g. Highly Available projects). In this case,
if you take a database dump or trigger a sql:sync
, the import will fail with the message
Access denied; you need (at least one of) the SUPER, BINLOG ADMIN privilege(s) for this operation
To fix this issue either grant your local database user super privileges or take
the dump with --set-gtid-purged=OFF
. To accomplish the latter, add this to your drush dump or sql:sync command:
--extra-dump="--set-gtid-purged=OFF"