Jump to content

loranger

Members
  • Posts

    4
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

loranger's Achievements

Newbie

Newbie (1/14)

2

Reputation

  1. C'est exactement le problème que j'avais : Partager la base de données d'un Prestashop pour bosser localement à plusieurs, tout en gardant chaque poste accessible en http depuis le réseau local (et donc sur des ips et hostname différents). On s'est inspirés du rewritter fourni par l'image docker prestashop officielle. On a donc modifié le vhost de l'apache du docker pour ajouter cette directive php : php_value auto_prepend_file /docker_prepend.php Dorénavant, chaque page appelée depuis le prestashop hébergé dans l'un de nos environnements docker est prepended par ces quelques lignes de PHP : <?php $pdo_dsn = sprintf('mysql:host=%s;dbname=%s', getenv('DB_SERVER'), getenv('MYSQL_DATABASE')); $DBHandler = new PDO($pdo_dsn, getenv('DB_USER_FRONT'), getenv('DB_PASSWD')); $DBStatement = $DBHandler->prepare("UPDATE `ps_shop_url` SET `domain` = :domain, `domain_ssl` = :domain WHERE `id_shop` = :shop_id AND `domain` != :domain;"); $DBStatement->execute([ 'domain' => $_SERVER['HTTP_HOST'], 'shop_id' => getenv('SHOP_ID'), ]); Si la requête (HTTP) courante provient d'un HTTP_HOST différent du domaine souhaité (celui du shop_id voulu), le domain est alors ré-écrit juste avant que Prestashop soit initialisé. C'est pas joli-joli, mais c'est Presta qu'a commencé. En tout cas, ça fonctionne et ça nous permet de tous travailler sur nos environnements locaux à partir de la même base de données, tout en nous permettant de joindre le serveur des autres dans jamais se soucier du hostname.
  2. And finally I found a crappy solution : Inspired by the rewriter provided with the official prestashop docker image, I modified my docker's apache vhost and added the following line : php_value auto_prepend_file /docker_prepend.php From now, each webpage called from the prestashop hosted inside our docker dev environment is now preprended with these few php lines : <?php $pdo_dsn = sprintf('mysql:host=%s;dbname=%s', getenv('DB_SERVER'), getenv('MYSQL_DATABASE')); $DBHandler = new PDO($pdo_dsn, getenv('DB_USER_FRONT'), getenv('DB_PASSWD')); $DBStatement = $DBHandler->prepare("UPDATE `ps_shop_url` SET `domain` = :domain, `domain_ssl` = :domain WHERE `id_shop` = :shop_id AND `domain` != :domain;"); $DBStatement->execute([ 'domain' => $_SERVER['HTTP_HOST'], 'shop_id' => getenv('SHOP_ID'), ]); If the current request comes from an http_host which is not the same as the domain used by the targetted shop_id, the domain is rewritten just before prestashop is initiated. That's not perfect, but it definitely works and allows all of us to work on our local environments, sharing the same database, reaching any local server without taking care of the hostname. Edit : Oh and of course, this setup, as the prestashop codebase are now shared and deployed by using git.
  3. Hooo yes ! That's what I did, but in order to finalize the whole development flow, I'd like to give each developer his own (locally reachable) dev environment, with a shared database (because of its actual size), but I can't figure out how to do…
  4. Hello ! I am now in charge of an e-commerce multi websites running prestashop 1.6.0.11. It runs for a decade, its source code is way too much customized and its database became really huuuge. I've been hired in order to unbloat this application, but I'm facing issue with the very first step : The development environment. It does not exists. Developers make modifications live, using FTP. I'd like to give them a local dev environment. I've setup a local web server which gets a fresh dump every night but each developer cannot use it as prestashop seems to require a canonical url for any shop, so my developers cannot use their brand new bob.myshop.local, dylan.myshop.local, kevin.myshop.local and so on… Another solution would be to dump the whole database for each developer, and alter ps_shop_url after every import but as I said, its really huge (its folder inside /var/lib/mysql/ weights 13GB) and we are 5 developers working on this application… Do you already have to deal with multi-developers environment ? Is there a way to bypass this prestashop url verification ? Thanks for your clues
×
×
  • Create New...