Skip to content

Deploy on platform.sh

PierreGauthier edited this page Jul 24, 2024 · 23 revisions

Prerequisites

Create a platform.sh account

First, head to https://console.platform.sh/ and create an account if you don't have one.

The free testing of Platform.sh is suitable enough for testing Gally. Of course, we recommend purchasing a paid plan with them if you want to deploy into production.

Create a project on platform.sh

Click on New Project then Create from scratch.

Choose a project Name and a region to deploy, and then click on Create project

Install the platformsh cli

Documentation for installing platformsh cli can be found here : https://docs.platform.sh/administration/cli.html#cli-command-line-interface

Init your project locally

If you are starting from scratch and you just want to deploy quickly, simply clone the Gally repository :

git clone [email protected]:Elastic-Suite/gally.git

Optional : If you plan to develop on Gally locally before deploying, refer to the guide to install the project locally

Configure platform.sh deployment

Set the platform.sh remote

platform project:set-remote <YOUR PSH PROJECT ID>

OR

git remote add platform <YOUR PSH PROJECT ID>@<YOUR PSH GIT REPO>

Optional step : Add the Gally Premium bundles (if you have access to it)

If you are a Gally Premium user, you've been provided with credentials that we will refer now to as "yourcustomername" and "yourpassword".

composer config -d api repositories.elasticsuite composer https://elasticsuite.repo.packagist.com/yourcustomername/
composer config -d api --auth http-basic.elasticsuite.repo.packagist.com yourcustomername yourpassword
composer require -d api gally/gally-premium --ignore-platform-reqs

And commit the composer.json, composer.lock, symfony bundle and symfony lock files.

git add api/composer.lock api/composer.json api/symfony.lock api/config/bundles.php
git commit -m 'Adding Gally Premium packages'

For security purposes, we don't recommend to commit the auth.json file but instead to store your composer credentials in a platform.sh env var :

platform variable:create --level project --name env:COMPOSER_AUTH \
  --json true --visible-runtime false --sensitive true --visible-build true \
  --value '{"http-basic": {"elasticsuite.repo.packagist.com": {"username": "token", "password": "<yourToken>"}}}'

Deploy

Push on the platform.sh remote

platform environment:push --target main

OR

git push -u platform main

Initialization steps on the first deployment

On the first deployment, you need to :

  1. connect on ssh to the "api" service on platform.sh
platform ssh

Then select "api" by inputing the proper number.

  1. Create your Gally user
bin/console gally:user:create

Your user should have the role : ROLE_ADMIN

  1. Initialize the default catalog structure
bin/console hautelook:fixtures:load

Check your deployment

You will be able to get your Gally instance url with the following command.

platform url

Then head into the /login page to access the Gally Back Office.