test #61
|
@ -7,17 +7,8 @@ def BRANCH_ENV = [
|
||||||
|
|
||||||
node {
|
node {
|
||||||
stage('Setup') {
|
stage('Setup') {
|
||||||
env.MAIN_REPLICAS = 1
|
|
||||||
env.CRON_REPLICAS = 0
|
|
||||||
env.NODE_ENV = BRANCH_ENV[env.BRANCH_NAME] ?: 'dev'
|
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 "NODE_NAME: ${env.NODE_NAME}"
|
||||||
echo "WORKSPACE: ${env.WORKSPACE}"
|
echo "WORKSPACE: ${env.WORKSPACE}"
|
||||||
}
|
}
|
||||||
|
@ -26,7 +17,6 @@ pipeline {
|
||||||
agent any
|
agent any
|
||||||
environment {
|
environment {
|
||||||
PROJECT_NAME = 'hedera-web'
|
PROJECT_NAME = 'hedera-web'
|
||||||
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Debuild') {
|
stage('Debuild') {
|
||||||
|
@ -76,15 +66,19 @@ pipeline {
|
||||||
branch 'test'
|
branch 'test'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
environment {
|
|
||||||
DOCKER_HOST = "${env.SWARM_HOST}"
|
|
||||||
}
|
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
def packageJson = readJSON file: 'package.json'
|
def packageJson = readJSON file: 'package.json'
|
||||||
env.VERSION = packageJson.version
|
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'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,12 @@ Hedera is the main web shop page for Verdnatura.
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
Required applications.
|
Required applications.
|
||||||
* PHP >= 7.0
|
* PHP >= 8.4
|
||||||
* Node.js >= 8.0
|
* Node.js >= 20.0
|
||||||
* [php-vn-lib](https://gitea.verdnatura.es/verdnatura/php-vn-lib)
|
|
||||||
|
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
|
### Installing dependencies and launching
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ return [
|
||||||
,'port' => 3306
|
,'port' => 3306
|
||||||
,'schema' => 'hedera'
|
,'schema' => 'hedera'
|
||||||
,'user' => 'hedera-web'
|
,'user' => 'hedera-web'
|
||||||
,'pass' => ''
|
,'pass' => '' // base64 encoded
|
||||||
,'tz' => 'Europe/madrid'
|
,'tz' => 'Europe/madrid'
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
hedera-web (24.14.3) stable; urgency=low
|
hedera-web (24.14.6) stable; urgency=low
|
||||||
|
|
||||||
* Initial Release.
|
* Initial Release.
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ MAILTO=webmaster
|
||||||
*/2 * * * * root hedera-web.php -m edi/load
|
*/2 * * * * root hedera-web.php -m edi/load
|
||||||
0 23 * * * root hedera-web.php -m edi/clean
|
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 edi/update
|
||||||
0 5 * * * root hedera-web.php -m misc/exchange-rate
|
|
||||||
0 0 * * * root hedera-web.php -m image/sync
|
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/image-clean.sh > /dev/null
|
||||||
0 */1 * * * root /usr/share/hedera-web/utils/update-browscap.sh > /dev/null
|
0 */1 * * * root /usr/share/hedera-web/utils/update-browscap.sh > /dev/null
|
||||||
|
|
|
@ -7,41 +7,6 @@ services:
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
args:
|
args:
|
||||||
- VERSION=${VERSION:?}
|
- 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:
|
cron:
|
||||||
image: registry.verdnatura.es/hedera-web:${VERSION:?}
|
image: registry.verdnatura.es/hedera-web:${VERSION:?}
|
||||||
command: 'cron -f'
|
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:?}
|
|
||||||
|
|
|
@ -65,8 +65,8 @@
|
||||||
one-way="true"
|
one-way="true"
|
||||||
one-time="true">
|
one-time="true">
|
||||||
<db-model property="model">
|
<db-model property="model">
|
||||||
SELECT id, country FROM vn.country
|
SELECT id, name FROM vn.country
|
||||||
ORDER BY country
|
ORDER BY name
|
||||||
</db-model>
|
</db-model>
|
||||||
</htk-combo>
|
</htk-combo>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -120,7 +120,7 @@
|
||||||
form-id="iter"
|
form-id="iter"
|
||||||
on-change="onAddressChange">
|
on-change="onAddressChange">
|
||||||
<db-model property="model" id="addresses">
|
<db-model property="model" id="addresses">
|
||||||
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
|
FROM myAddress a
|
||||||
LEFT JOIN vn.province p ON p.id = a.provinceFk
|
LEFT JOIN vn.province p ON p.id = a.provinceFk
|
||||||
JOIN vn.country c ON c.id = p.countryFk
|
JOIN vn.country c ON c.id = p.countryFk
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "hedera-web",
|
"name": "hedera-web",
|
||||||
"version": "24.14.3",
|
"version": "24.14.6",
|
||||||
"description": "Verdnatura web page",
|
"description": "Verdnatura web page",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ejemplo:
|
|
||||||
* <Cube><Cube time="2010-12-10"><Cube currency="USD" rate="1.3244"/>
|
|
||||||
*/
|
|
||||||
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');
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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())
|
|
Loading…
Reference in New Issue