diff --git a/Jenkinsfile b/Jenkinsfile index 629d1db9..8a8d284c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,17 +7,8 @@ def BRANCH_ENV = [ node { stage('Setup') { - env.MAIN_REPLICAS = 1 - env.CRON_REPLICAS = 0 env.NODE_ENV = BRANCH_ENV[env.BRANCH_NAME] ?: 'dev' - switch (env.BRANCH_NAME) { - case 'master': - env.MAIN_REPLICAS = 3 - env.CRON_REPLICAS = 1 - break - } - echo "NODE_NAME: ${env.NODE_NAME}" echo "WORKSPACE: ${env.WORKSPACE}" } @@ -26,7 +17,6 @@ pipeline { agent any environment { PROJECT_NAME = 'hedera-web' - STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" } stages { stage('Debuild') { @@ -76,15 +66,19 @@ pipeline { branch 'test' } } - environment { - DOCKER_HOST = "${env.SWARM_HOST}" - } steps { script { def packageJson = readJSON file: 'package.json' env.VERSION = packageJson.version } - sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}" + withKubeConfig([ + serverUrl: "$KUBERNETES_API", + credentialsId: 'kubernetes', + namespace: 'salix' + ]) { + sh 'kubectl set image deployment/hedera-web-$BRANCH_NAME hedera-web-$BRANCH_NAME=$REGISTRY/hedera-web:$VERSION' + sh 'kubectl set image deployment/hedera-web-cron-$BRANCH_NAME hedera-web-cron-$BRANCH_NAME=$REGISTRY/hedera-web:$VERSION' + } } } } diff --git a/README.md b/README.md index 589b7f4c..039cd909 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,12 @@ Hedera is the main web shop page for Verdnatura. ## Prerequisites Required applications. - * PHP >= 7.0 - * Node.js >= 8.0 - * [php-vn-lib](https://gitea.verdnatura.es/verdnatura/php-vn-lib) + * PHP >= 8.4 + * Node.js >= 20.0 + +Take a look to *debian/control* file to see additional dependencies. + +Copy config.php to *config.my.php* and place your DB config there. ### Installing dependencies and launching diff --git a/config.php b/config.php index 7e853029..160790fd 100644 --- a/config.php +++ b/config.php @@ -24,7 +24,7 @@ return [ ,'port' => 3306 ,'schema' => 'hedera' ,'user' => 'hedera-web' - ,'pass' => '' + ,'pass' => '' // base64 encoded ,'tz' => 'Europe/madrid' ] ]; diff --git a/debian/changelog b/debian/changelog index ce2d6687..85ed2fd6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (24.14.3) stable; urgency=low +hedera-web (24.14.6) stable; urgency=low * Initial Release. diff --git a/debian/cron.d b/debian/cron.d index 846174c7..f8bd5beb 100755 --- a/debian/cron.d +++ b/debian/cron.d @@ -3,7 +3,6 @@ MAILTO=webmaster */2 * * * * root hedera-web.php -m edi/load 0 23 * * * root hedera-web.php -m edi/clean 0 5 * * * root hedera-web.php -m edi/update -0 5 * * * root hedera-web.php -m misc/exchange-rate 0 0 * * * root hedera-web.php -m image/sync 0 1 * * * root /usr/share/hedera-web/utils/image-clean.sh > /dev/null 0 */1 * * * root /usr/share/hedera-web/utils/update-browscap.sh > /dev/null diff --git a/docker-compose.yml b/docker-compose.yml index 5f5d238e..0a1a862d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,41 +7,6 @@ services: dockerfile: Dockerfile args: - VERSION=${VERSION:?} - ports: - - 80 - configs: - - source: config - target: /etc/hedera-web/config.my.php - volumes: - - /mnt/appdata:/mnt/storage - - /mnt/appdata/image:/var/lib/hedera-web/image-db - - /mnt/appdata/vn-access:/var/lib/hedera-web/vn-access - deploy: - replicas: ${MAIN_REPLICAS:?} - placement: - constraints: - - node.role == worker - resources: - limits: - memory: 2G cron: image: registry.verdnatura.es/hedera-web:${VERSION:?} command: 'cron -f' - configs: - - source: config - target: /etc/hedera-web/config.my.php - volumes: - - /mnt/appdata:/mnt/storage - - /mnt/appdata/image:/var/lib/hedera-web/image-db - deploy: - replicas: ${CRON_REPLICAS:?} - placement: - constraints: - - node.role == worker - resources: - limits: - memory: 1G -configs: - config: - external: true - name: ${PROJECT_NAME:?}-${BRANCH_NAME:?} diff --git a/forms/account/address/ui.xml b/forms/account/address/ui.xml index 66c71144..f18e96a5 100644 --- a/forms/account/address/ui.xml +++ b/forms/account/address/ui.xml @@ -65,8 +65,8 @@ one-way="true" one-time="true"> - SELECT id, country FROM vn.country - ORDER BY country + SELECT id, name FROM vn.country + ORDER BY name diff --git a/forms/ecomerce/checkout/ui.xml b/forms/ecomerce/checkout/ui.xml index 8506152f..cfe7f03e 100644 --- a/forms/ecomerce/checkout/ui.xml +++ b/forms/ecomerce/checkout/ui.xml @@ -120,7 +120,7 @@ form-id="iter" on-change="onAddressChange"> - SELECT a.id, a.nickname, p.name province, a.city, a.street, a.isActive, c.country + SELECT a.id, a.nickname, p.name province, a.city, a.street, a.isActive, c.name FROM myAddress a LEFT JOIN vn.province p ON p.id = a.provinceFk JOIN vn.country c ON c.id = p.countryFk diff --git a/package.json b/package.json index e09b7755..45911592 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hedera-web", - "version": "24.14.3", + "version": "24.14.6", "description": "Verdnatura web page", "license": "GPL-3.0", "repository": { diff --git a/rest/misc/exchange-rate.php b/rest/misc/exchange-rate.php deleted file mode 100644 index 6e0dc96d..00000000 --- a/rest/misc/exchange-rate.php +++ /dev/null @@ -1,41 +0,0 @@ - - */ -class ExchangeRate extends Vn\Lib\Method { - function run($db) { - $db->selectDb('vn'); - - // Indica la URL del archivo - - $xml = new SimpleXMLElement( - 'http://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist-90d.xml', 0, TRUE); - - $date = $db->getValue("SELECT MAX(dated) fecha FROM referenceRate"); - $maxDate = $date ? DateTime::createFromFormat('Y-m-d', $date) : NULL; - - foreach ($xml->Cube[0]->Cube as $cube) { - $xmlDate = new DateTime($cube['time']); - - // Si existen datos más recientes de la máxima fecha los añade - - if ($maxDate <= $xmlDate) - foreach ($cube->Cube as $subCube) - if ($subCube['currency'] == 'USD') { - $params = [ - 'date' => $xmlDate, - 'rate' => $subCube['rate'] - ]; - $db->query( - 'REPLACE INTO referenceRate(currencyFk, dated, `value`) - VALUES(2, #date, #rate)', - $params - ); - } - } - - $db->queryFromFile(__DIR__.'/exrate-add'); - } -} diff --git a/rest/misc/exrate-add.sql b/rest/misc/exrate-add.sql deleted file mode 100644 index ada56a9c..00000000 --- a/rest/misc/exrate-add.sql +++ /dev/null @@ -1,6 +0,0 @@ -INSERT INTO reference_rate (moneda_id, date, rate) - SELECT 2, TIMESTAMPADD (DAY, 1, r1.date), r1.rate - FROM reference_rate r1 - LEFT JOIN reference_rate r2 - ON TIMESTAMPADD(DAY, 1, r1.date) = r2.date - WHERE r2.date IS NULL AND r1.date < TIMESTAMPADD (DAY, -2, CURDATE())