Skip to content

Commit

Permalink
improve stacks
Browse files Browse the repository at this point in the history
  • Loading branch information
bailletced committed Jan 23, 2025
1 parent 8e6ae66 commit 8983d63
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 7 deletions.
9 changes: 7 additions & 2 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ services:
- bootstrap.memory_lock=true
- ES_JAVA_OPTS=-Xms512m -Xmx512m # 512mo HEAP
- ELASTIC_PASSWORD=admin
healthcheck:
test: "curl -s -u elastic:$$ELASTIC_PASSWORD -f -X GET localhost:9200/_cluster/health || exit 1"
interval: 10s
timeout: 5s
retries: 30
networks:
- app-network
ports:
Expand Down Expand Up @@ -65,7 +70,7 @@ services:
SERVER_NAME: localhost api.openchurch.local admin.openchurch.local
APP_ENV: dev
APP_SECRET: "secret"
DATABASE_URL: mysql://root:openchurch@db:3306/openchurch?serverVersion=11.5.2-MariaDB&charset=utf8mb4
DATABASE_URL: mysql://root:openchurch@db:3306/openchurch?serverVersion=10.11.6-MariaDB&charset=utf8mb4
REDIS_URL: redis://redis:6379
HOST_API: https://api.openchurch.local/api
HOST_ADMIN: admin.openchurch.local
Expand All @@ -83,7 +88,7 @@ services:
environment:
SERVER_NAME: :80
APP_ENV: prod
DATABASE_URL: "mysql://openchurch:openchurch@db:3306/openchurch?serverVersion=8.0&charset=utf8mb4"
DATABASE_URL: mysql://root:openchurch@db:3306/openchurch?serverVersion=10.11.6-MariaDB&charset=utf8mb4
HOST_API: api-preprod-openchurch.hozana.org
APP_SECRET: JK6nAUJQhFXMwiBvqHE_3UX8RyCeFEec
JWT_TOKEN_TTL: 120
Expand Down
1 change: 1 addition & 0 deletions docker/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ RUN docker-php-ext-install \
xsl \
pcntl \
opcache \
intl \
gmp

# add PECL extensions
Expand Down
9 changes: 8 additions & 1 deletion scripts/synchro.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ def update_dioceses(self, sparqlData, client):
response = client.upsert_wikidata_entities('/communities/upsert', wikidataEntities)
self.print_logs(response, 1)
return response
return "skipped"

def update_parishes(self, sparqlData, client):
wikidataEntities = {'wikidataEntities': []}
Expand All @@ -344,6 +345,7 @@ def update_parishes(self, sparqlData, client):
response = client.upsert_wikidata_entities('/communities/upsert', wikidataEntities)
self.print_logs(response, 1)
return response
return "skipped"

def update_churches(self, sparqlData, client):
wikidataEntities = {'wikidataEntities': []}
Expand All @@ -356,6 +358,7 @@ def update_churches(self, sparqlData, client):
response = client.upsert_wikidata_entities('/places/upsert', wikidataEntities)
self.print_logs(response, 1)
return response
return "skipped"

def print_logs(self, data, required_level):
if self.verbosity_level >= required_level:
Expand Down Expand Up @@ -448,7 +451,11 @@ def process_batch(self, data, method, run_id):
self.redis_client.hset(key_batch, "runId", run_id)
print("Processing batch %s/%s" % (iteration, len(batches)))
res = getattr(self.q, method)(batch, self.client)
if res:
if res == "skipped":
self.redis_client.hset(key_batch, "successCount", "skipped")
self.redis_client.hset(key_batch, "failureCount", "skipped")
self.redis_client.hset(key_batch, "status", "skipped")
elif res:
success_count = sum(1 for value in res.values() if value in {'Updated', 'Inserted'})
self.redis_client.hset(key_batch, "successCount", success_count)
self.redis_client.hset(key_batch, "failureCount", len(res) - success_count)
Expand Down
2 changes: 2 additions & 0 deletions src/Dashboard/Infrastructure/Twig/detail.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
green
{% elseif data.status == 'processing' %}
orange
{% elseif data.status == 'skipped' %}
blue
{% else %}
red
{% endif %}">
Expand Down
2 changes: 1 addition & 1 deletion tests/Agent/Integration/DoctrineAgentRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Tests\FieldHolder\Community\Integration\Doctrine;
namespace App\Tests\Agent\Integration;

use App\Agent\Infrastructure\Doctrine\DoctrineAgentRepository;
use App\Tests\Agent\DummyFactory\DummyAgentFactory;
Expand Down
2 changes: 1 addition & 1 deletion tests/Field/Integration/DoctrineFieldListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Tests\Field\Integration\Doctrine;
namespace App\Tests\Field\Integration;

use App\Core\Domain\Search\Helper\SearchHelperInterface;
use App\Core\Domain\Search\Service\SearchServiceInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Tests\FieldHolder\Community\Integration\Doctrine;
namespace App\Tests\FieldHolder\Community\Integration;

use App\Core\Domain\Search\Helper\SearchHelperInterface;
use App\Core\Domain\Search\Service\SearchServiceInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Tests\FieldHolder\Community\Integration\Doctrine;
namespace App\Tests\FieldHolder\Community\Integration;

use App\Field\Domain\Enum\FieldCommunity;
use App\FieldHolder\Community\Domain\Enum\CommunityType;
Expand Down
4 changes: 4 additions & 0 deletions usr/local/bin/docker-php-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ if [ "$ROLE" == 'cli' ]; then
mv /etc/cron.d/openchurch_env /etc/cron.d/backend

# Initialize elastic indexes
until curl -s -u elastic:$ELASTIC_PASSWORD -f -X GET $ELASTICSEARCH_IRI/_cluster/health > /dev/null; do
echo "Waiting for elasticsearch to be ready..."
sleep 5
done
bin/console -vvv app:write:indexes
fi

Expand Down

0 comments on commit 8983d63

Please sign in to comment.