Skip to content

Deploy without docker

PierreGauthier edited this page Feb 11, 2025 · 9 revisions

Install

Prerequisites

This documentation explains how to deploy Gally on a Linux server without docker. The following commands assume a debian like distribution, but you can adapt them for any Linux distribution.

Gally architecture is composed of 7 services:

  • 3 databases:
    • PostgreSQL
    • Opensearch
    • Redis
  • 2 webservices
    • Php-fpm
    • NodeJs
  • 1 Full page cache
    • Varnish
  • 1 Router
    • Nginx

It is up to you to deploy these services on a single server or on multiple one according to your management process.


Databases

PostgreSQL & Redis

Install redis 6 and postgresql 16 packages and enable the services in your system.

Then you should create the default user and database in postgres :

sudo -upostgres psql
CREATE ROLE "api-platform" WITH SUPERUSER LOGIN;
ALTER USER "api-platform" WITH password '!ChangeMe!';
CREATE DATABASE api;

Opensearch

In order to be able to use vector search request (gally premium), you will need at least two nodes in your opensearch cluster.

  • one node data node
  • one node ml node So you will need to repeat the following steps on two different servers or configure two different services on your server.

Install opensearch 2.18 and the plugins analysis-icu and analysis-phonetic. You'll also need openssl libssl3 libs for security plugin of opensearch.

Get the configuration according to the node you are configuring and put it in /etc/opensearch/opensearch.yml:

Adapt the value of the following config according to your architecture and your security settings :

  • network.host
  • discovery.seed_hosts
  • cluster.initial_cluster_manager_nodes
  • plugins.security

Then enable the services on your system.


Webserver

Deploy the gally sources in your server, the following step will assume that gally sources are located in /var/www/gally in your server.

Php & Php-fpm

Install php 8.3 and all required extension

  • curl
  • dom
  • fpm
  • intl
  • mbstring
  • opcache
  • pgsql
  • redis
  • zip

Copy this FPM configuration file in /etc/php/8.3/mods-available/ (adapt the opcache.preload according to your source location)

Make this configuration available for Cli and Fpm :

ln -s /etc/php/8.3/mods-available/app.ini /etc/php/8.3/fpm/conf.d/app.ini
ln -s /etc/php/8.3/mods-available/app.ini /etc/php/8.3/cli/conf.d/app.ini

Enable & start the services.

NodeJs

Install nodejs 16, npm 8 and yarn.

Create a gally-next systemd service by creating the file /etc/systemd/system/gally-next.service with this content

Enable & start the services

Nginx & Varnish

Install nginx 1.26 and varnish 7.

Update your varnish vcl (/etc/varnish/default.vcl) according to this example Update your nginx configuration (/etc/nginx/sites-enabled/default) according to this example

Place your SSL certificate in /etc/nginx/certs/live/[Your server name]/fullchain.pem and the key in /etc/nginx/certs/live/[Your server name]/privkey.pem

Enable & start the services.

Your webserver should be well configured at this point.


Deployment

Update your gally sources in /var/www/gally.

Define env var or update the .env file with value that match your architecture. There is an example of an .env for a gally with every service on the same server (except OpenSearch)

And then run

cd /var/www/gally/api
composer install --no-cache --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress
composer dump-autoload --classmap-authoritative --no-dev
composer dump-env prod
composer run-script --no-dev post-install-cmd

bin/console lexik:jwt:generate-keypair --skip-if-exists
bin/console doctrine:migrations:migrate --no-interaction --all-or-nothing
bin/console gally:vector-search:upload-model # If gally premium bundles are installed
bin/console hautelook:fixture:load
bin/console gally:user:create

cd /var/www/gally/front
yarn install --frozen-lockfile --network-timeout 120000
yarn cache clean
yarn build