Skip to content

Commit

Permalink
Executa dump postgres no db updates quando system_role não é encontrada
Browse files Browse the repository at this point in the history
  • Loading branch information
lpirola committed Jul 5, 2024
1 parent 7c47827 commit 8efe62c
Show file tree
Hide file tree
Showing 9 changed files with 915 additions and 869 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ jobs:
# subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
# subject-digest: ${{ steps.push.outputs.digest }}
# push-to-registry: true
-
name: Create private-files folder
run: docker compose run --rm web mkdir var/private-files
-
name: Start services
run: docker compose up database redis mailhog web --wait --no-build
Expand All @@ -94,6 +91,9 @@ jobs:
-
name: Run db-updates
run: docker compose exec -T web php mapas/src/tools/apply-updates.php
-
name: Run db-updates
run: docker compose exec -T web php mapas/src/tools/apply-multicore-db-update.php
-
name: Run migrations
run: docker compose exec -T web bin/console -e test doctrine:migrations:migrate --no-interaction
Expand Down
15 changes: 8 additions & 7 deletions api/.env.sample
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
BUILD_ASSETS=0
DATABASE_URL=postgresql://mapas:mapas@database:5432/mapas?serverVersion=14&charset=utf8
DATABASE_URL=postgresql://mapas:mapas@database:5432/mapas?serverVersion=14 &
charset=utf8
DATADIR=/opt/postgres/data
GOOGLE_RECAPTCHA_SECRET=6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe
GOOGLE_RECAPTCHA_SITEKEY=6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI
Expand All @@ -8,18 +9,18 @@ MAILER_FROM=sysadmin@localhost
MAILER_TRANSPORT=smtp://mailhog:1025
MC_UPDATES_PROCESSES=1
MERCURE_JWT_SECRET=!ChangeThisMercureHubJWTSecretKey!
MERCURE_PUBLIC_URL=https://localhost/.well-known/mercure
MERCURE_PUBLIC_URL=http://web/.well-known/mercure
MERCURE_PUBLISHER_JWT_KEY=!ChangeThisMercureHubJWTSecretKey!
MERCURE_SUBSCRIBER_JWT_KEY=!ChangeThisMercureHubJWTSecretKey!
MERCURE_URL=http://php/.well-known/mercure
MERCURE_URL=http://web/.well-known/mercure
NUM_PROCESSES=1
PENDING_PCACHE_RECREATION_INTERVAL=5
POSTGRES_DB=mapas
POSTGRES_PASSWORD=mapas
POSTGRES_USER=mapas
PWA_UPSTREAM=pwa:3000
REDIS_CACHE=
REDIS_CACHE=redis://redis:6379
SERVER_NAME=http://
SESSIONS_SAVE_PATH=
TRUSTED_HOSTS=^${SERVER_NAME:-example\.com|localhost}|php$$
TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
SESSIONS_SAVE_PATH=/var/sessions
TRUSTED_HOSTS=^${SERVER_NAME:-example\.com|localhost} | php$$
TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.17.0.0/12,192.168.0.0/16
41 changes: 21 additions & 20 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile" ]
FROM frankenphp_base AS frankenphp_dev

ENV APP_ENV=dev XDEBUG_MODE=off
VOLUME /app/var/
# VOLUME /app/var/
COPY --link . /app

RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"

Expand All @@ -80,28 +81,28 @@ COPY --link frankenphp/conf.d/app.dev.ini $PHP_INI_DIR/conf.d/
CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile", "--watch" ]

# Prod FrankenPHP image
FROM frankenphp_base AS frankenphp_prod
# FROM frankenphp_base AS frankenphp_prod

ENV APP_ENV=prod
ENV FRANKENPHP_CONFIG="import worker.Caddyfile"
# ENV APP_ENV=prod
# ENV FRANKENPHP_CONFIG="import worker.Caddyfile"

RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
# RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"

COPY --link frankenphp/conf.d/app.prod.ini $PHP_INI_DIR/conf.d/
COPY --link frankenphp/worker.Caddyfile /etc/caddy/worker.Caddyfile
# COPY --link frankenphp/conf.d/app.prod.ini $PHP_INI_DIR/conf.d/
# COPY --link frankenphp/worker.Caddyfile /etc/caddy/worker.Caddyfile

# prevent the reinstallation of vendors at every changes in the source code
COPY --link composer.* symfony.* ./
RUN set -eux; \
composer install --no-cache --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress
# # prevent the reinstallation of vendors at every changes in the source code
# COPY --link composer.* symfony.* ./
# RUN set -eux; \
# composer install --no-cache --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress

# copy sources
COPY --link . ./
RUN rm -Rf frankenphp/
# # copy sources
# COPY --link . ./
# RUN rm -Rf frankenphp/

RUN set -eux; \
mkdir -p var/cache var/log; \
composer dump-autoload --classmap-authoritative --no-dev; \
composer dump-env prod; \
composer run-script --no-dev post-install-cmd; \
chmod +x bin/console; sync;
# RUN set -eux; \
# mkdir -p var/cache var/log; \
# composer dump-autoload --classmap-authoritative --no-dev; \
# composer dump-env prod; \
# composer run-script --no-dev post-install-cmd; \
# chmod +x bin/console; sync;
14 changes: 13 additions & 1 deletion api/mapas/app/bin/doctrine
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,22 @@ require dirname(__DIR__, 2) . '/public/bootstrap.php';

use Doctrine\ORM\Tools\Console\ConsoleRunner;
use Doctrine\ORM\Tools\Console\EntityManagerProvider\SingleManagerProvider;
use Doctrine\Migrations\Tools\Console\Command;

$entityManager = $app->em ?? null;

$commands = [];
$commands = [
new Command\DumpSchemaCommand(),
new Command\ExecuteCommand(),
new Command\GenerateCommand(),
new Command\LatestCommand(),
new Command\ListCommand(),
new Command\MigrateCommand(),
new Command\RollupCommand(),
new Command\StatusCommand(),
new Command\SyncMetadataCommand(),
new Command\VersionCommand(),
];

ConsoleRunner::run(
new SingleManagerProvider($entityManager),
Expand Down
Loading

0 comments on commit 8efe62c

Please sign in to comment.