Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to pull data from platform.sh #298

Open
q0rban opened this issue Jul 21, 2021 · 1 comment
Open

Document how to pull data from platform.sh #298

q0rban opened this issue Jul 21, 2021 · 1 comment

Comments

@q0rban
Copy link
Contributor

q0rban commented Jul 21, 2021

No description provided.

@nlighteneddesign
Copy link

We use Platform.sh in a mulitapp architecture. This means that we have several Drupal sites in one project, they are not multisites.
In order to achieve this there is a main repositories that uses git submodules to point to the actual Drupal repositories. Because of this there are a few steps that required for us that may not be required for more standard installs.

In the tugboat repository settings we need an environment variable for the platform cli it must be named PLATFORMSH_CLI_TOKEN
Instructions for generating the token: https://docs.platform.sh/development/cli/api-tokens.html

In the php service init command we install the platform.sh cli:

# Install platform cli
- curl -fsS https://platform.sh/cli/installer | php

In the php service update command we grab the database.

- /root/.platformsh/bin/platform --project=${PROJECT_ID} --environment=${BRANCH} --app=${APP} --relationship=${DATABASE} db:dump --gzip
- vendor/bin/drush sql-drop -y
- zcat ${PROJECT_ID}--${BRANCH}-${CUSTOMER_ID}--mariadb--${APP}--dump.sql.gz | mysql --host=mysql -u tugboat -ptugboat tugboat
- rm ${PROJECT_ID}--${BRANCH}-${CUSTOMER_ID}--mariadb--${APP}--dump.sql.gz

${PROJECT_ID} is the id of the project you can see it in the url when you are on the platform dashboard looking at the project.
${BRANCH} is the branch/environment you want to pull the database from usually main or master.
${APP} is the name of the app defined in .platform.app.yaml
${DATABASE} is the name of the database relationship in .platform.app.yaml
${CUSTOMER_ID} can be found in the default urls that platform provides each project.

I also assume mariadb in the string depends on the service you use for your database, but I only have mariadb on platform.

We do not need the typical mysql update command that is there by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants