Skip to content

Deploy bare metal

Pierre Gauthier edited this page Nov 21, 2024 · 2 revisions

Deploy Gally on bare metal server

⚠️ Please note that the Makefile is meant to be used on local environment for development purposes. It must not be used in production environment.
  1. Deploy the source on your environment

  2. Initialize environment variables on your environment (via .env file or any feature your system has to define env vars):

    • SERVER_NAME: The domain on which gally should respond
    • APP_ENV : The environment in which the application runs
    • APP_SECRET : This is a string that should be unique to your application and it's commonly used to add more entropy to security related operations.
    • POSTGRES_PASSWORD : Password of the database
  3. Optional: Install with premium packages

    • Install gally/gally-premium composer package on your code base
    • These files api/composer.json, api/composer.lock and api/bundles.json should contain gally-premium bundles requirements at this point.
    • Add Gally composer credentials in a new environment variable COMPOSER_AUTH with this format :
      COMPOSER_AUTH='{"http-basic": {"elasticsuite.repo.packagist.com": {"username": "token", "password": "XXX"}}}'
  4. Run the application:

    docker compose -f compose.yml build --no-cache
    docker compose -f compose.yml up -d
  5. Install the application (Only on the first deployment):

    docker compose -f compose.yml run --rm php bin/console lexik:jwt:generate-keypair
    docker compose -f compose.yml exec php bin/console hautelook:fixtures:load
  6. Create a new admin account (available roles are ROLE_ADMIN and ROLE_CONTRIBUTOR):

    docker compose -f compose.yml exec php bin/console gally:user:create
  7. The application should be available from the port 443 of your server

Install premium bundles for testing on production like environment

⚠️ This method is only for testing purpose. If you need to properly add premium package on your production env, you need to install it on your development environment and then deploy your updated sources.
# Logout from backoffice
docker compose -f compose.yml exec php composer config repositories.gally-premium composer https://elasticsuite.repo.packagist.com/[YOUR_CUSTOMER_NAME]/
docker compose -f compose.yml exec php composer require gally/gally-premium:[REQUIRED_VERSION]
docker compose -f compose.yml cp php:/app/composer.json api/
docker compose -f compose.yml cp php:/app/composer.lock api/
docker compose -f compose.yml cp php:/app/symfony.lock api/
docker compose -f compose.yml cp php:/app/config/bundles.php api/config/
docker compose -f compose.yml build php
docker compose -f compose.yml up -d
docker compose -f compose.yml exec php bin/console cache:clear