Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade failed #1434

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONST_create_template/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ acceptance-init: ## Initialize the acceptance tests
docker compose exec -T tools wait-db
docker compose exec -T tools psql --command="DROP EXTENSION IF EXISTS postgis CASCADE"
scripts/db-restore --docker-compose-file=docker-compose.yaml --docker-compose-file=docker-compose-db.yaml \
--arg=--clean --arg=--if-exists --arg=--verbose $(DUMP_FILE)
--arg=--clean --arg=--if-exists --arg=--verbose $(DUMP_FILE) || true
docker compose --file=docker-compose.yaml --file=docker-compose-db.yaml up -d

.PHONY: acceptance
Expand Down
4 changes: 2 additions & 2 deletions CONST_create_template/docker-compose.override.sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ services:
# # Adapt the path for ngeo / gmf contrib to point where you have checkouted the code.
# # volumes:
# # - ./geoportal/${PACKAGE}_geoportal/static-ngeo:/app/${PACKAGE}_geoportal/static-ngeo
# # - ./../ngeo/src:/usr/lib/node_modules/ngeo/src
# # - ./../ngeo/contribs:/usr/lib/node_modules/ngeo/contribs
# # - ./../ngeo/src:/opt/c2cgeoportal/geoportal/node_modules/ngeo/src
# # - ./../ngeo/contribs:/opt/c2cgeoportal/geoportal/node_modules/ngeo/contribs
# volumes_from:
# - config:rw
# extends:
Expand Down
25 changes: 23 additions & 2 deletions CONST_create_template/scripts/db-backup
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ import sys
def main() -> None:
"""Backup the database."""
parser = argparse.ArgumentParser(description="Backup the database.")
parser.add_argument("--verbose", action="store_true", help="Print the command that is executed.")
parser.add_argument(
"--dry-run", action="store_true", help="Only print the command that would be executed."
)
parser.add_argument(
"--env",
default=".env",
Expand Down Expand Up @@ -83,7 +87,20 @@ def main() -> None:
"--dbname={}".format(env["PGDATABASE"]),
*args.arg,
]
print(shlex.join([*command1, *command2_annon, *command3]))
if args.dry_run or args.verbose:
subprocess.run(
[
"docker",
"run",
"--rm",
"camptocamp/postgres:{}".format(env["POSTGRES_TAG"]),
"pg_dump",
"--version",
]
)
print(shlex.join([*command1, *command2_annon, *command3]))
if args.dry_run:
sys.exit(0)
sys.exit(subprocess.run([*command1, *command2, *command3], stdout=file_out).returncode)
else:
command = [
Expand All @@ -97,7 +114,11 @@ def main() -> None:
'pg_dump --format=c --dbname="$PGDATABASE"',
*args.arg,
]
print(shlex.join(command))
if args.dry_run or args.verbose:
subprocess.run(["docker", "compose", "exec", "tools", "pg_dump", "--version"])
print(shlex.join(command))
if args.dry_run:
sys.exit(0)
sys.exit(subprocess.run(command, stdout=file_out).returncode)


Expand Down
25 changes: 23 additions & 2 deletions CONST_create_template/scripts/db-restore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ import sys
def main() -> None:
"""Restore the database backup."""
parser = argparse.ArgumentParser(description="Restore the database backup.")
parser.add_argument("--verbose", action="store_true", help="Print the command that is executed.")
parser.add_argument(
"--dry-run", action="store_true", help="Only print the command that would be executed."
)
parser.add_argument(
"--env",
help="The env file to use to get the connection settings, by default we log in the composition to "
Expand Down Expand Up @@ -89,7 +93,20 @@ def main() -> None:
"--dbname={}".format(env["PGDATABASE"]),
*args.arg,
]
print(shlex.join([*command1, *command2_annon, *command3]))
if args.verbose or args.dry_run:
subprocess.run(
[
"docker",
"run",
"--rm",
"camptocamp/postgres:{}".format(env["POSTGRES_TAG"]),
"pg_restore",
"--version",
]
)
print(shlex.join([*command1, *command2_annon, *command3]))
if args.dry_run:
sys.exit(0)
sys.exit(subprocess.run([*command1, *command2, *command3], stdin=file_in).returncode)
else:
command = [
Expand All @@ -103,7 +120,11 @@ def main() -> None:
"-c",
'pg_restore --dbname="$PGDATABASE" ' + " ".join(args.arg),
]
print(shlex.join(command))
if args.verbose or args.dry_run:
subprocess.run(["docker", "compose", "exec", "tools", "pg_restore", "--version"])
print(shlex.join(command))
if args.dry_run:
sys.exit(0)
sys.exit(subprocess.run(command, stdin=file_in).returncode)


Expand Down
2 changes: 1 addition & 1 deletion CONST_create_template/tests/test_testapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_desktop_alt(url: str) -> None:
assert response.status_code == 200, response.text

assert re.search(
r'<script src="https?://front/static-ngeo-dist/desktop\..*\.js" crossorigin="anonymous"></script>',
r'<script src="https?://front/static-ngeo-dist/desktop-.*\.js" crossorigin="anonymous"></script>',
response.text,
), response.text
assert re.search(r'<html lang="{{mainCtrl.lang}}" ', response.text), response.text
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ acceptance-init: ## Initialize the acceptance tests
docker compose exec -T tools psql --command='CREATE EXTENSION IF NOT EXISTS pg_trgm'
docker compose exec -T tools psql --command='CREATE EXTENSION IF NOT EXISTS hstore'
scripts/db-restore --docker-compose-file=docker-compose.yaml --docker-compose-file=docker-compose-db.yaml \
--arg=--clean --arg=--if-exists --arg=--verbose --arg=--no-privileges --arg=--no-owner $(DUMP_FILE)
--arg=--clean --arg=--if-exists --arg=--verbose --arg=--no-privileges --arg=--no-owner $(DUMP_FILE) || true
docker compose --file=docker-compose.yaml --file=docker-compose-db.yaml up -d

.PHONY: acceptance
Expand Down
15 changes: 15 additions & 0 deletions docker-compose.override.sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,21 @@ services:
# - QGIS_SERVER_LOG_LEVEL=0
# - QGIS_CATCH_SEGV=1 # The result stack traces will be available in /var/log/qgis.log

# For Javascript project development.
# The debug application will be available at ``https://<host>/<entry_point>/dev/<interface>.html``.
# webpack_dev_server:
# # Uncomment these lines when you want to debug respectively the project js, ngeo js and/or the gmf contrib js.
# # Adapt the path for ngeo / gmf contrib to point where you have checkouted the code.
# # volumes:
# # - ./geoportal/${PACKAGE}_geoportal/static-ngeo:/app/${PACKAGE}_geoportal/static-ngeo
# # - ./../ngeo/src:/opt/c2cgeoportal/geoportal/node_modules/ngeo/src
# # - ./../ngeo/contribs:/opt/c2cgeoportal/geoportal/node_modules/ngeo/contribs
# volumes_from:
# - config:rw
# extends:
# file: docker-compose-lib.yaml
# service: webpack_dev_server

tilecloudchain:
# volumes:
# - ../tilecloud-chain/tilecloud_chain:/app/tilecloud_chain
Expand Down
2 changes: 1 addition & 1 deletion geoportal/geomapfish_geoportal/static/story-map.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/>
<script
crossorigin="anonymous"
integrity="sha384-7MU/DmxxmA1H95x2xkNGZs9DMxGwtEQOfjfwtrDvv1NZciDDjSLETCseQqkCa/gY"
integrity="sha384-a6n81Timk8V6DwQpEN/z1f/LwDsq7B8RkZmZmKeN9fNjLxiytyrNB0zopWBF3N7h"
referrerpolicy="no-referrer"
src="https://geomapfish-demo-2-9.camptocamp.com/api.js?version=2"
></script>
Expand Down
25 changes: 23 additions & 2 deletions scripts/db-backup
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ import sys
def main() -> None:
"""Backup the database."""
parser = argparse.ArgumentParser(description="Backup the database.")
parser.add_argument("--verbose", action="store_true", help="Print the command that is executed.")
parser.add_argument(
"--dry-run", action="store_true", help="Only print the command that would be executed."
)
parser.add_argument(
"--env",
default=".env",
Expand Down Expand Up @@ -83,7 +87,20 @@ def main() -> None:
"--dbname={}".format(env["PGDATABASE"]),
*args.arg,
]
print(shlex.join([*command1, *command2_annon, *command3]))
if args.dry_run or args.verbose:
subprocess.run(
[
"docker",
"run",
"--rm",
"camptocamp/postgres:{}".format(env["POSTGRES_TAG"]),
"pg_dump",
"--version",
]
)
print(shlex.join([*command1, *command2_annon, *command3]))
if args.dry_run:
sys.exit(0)
sys.exit(subprocess.run([*command1, *command2, *command3], stdout=file_out).returncode)
else:
command = [
Expand All @@ -97,7 +114,11 @@ def main() -> None:
'pg_dump --format=c --dbname="$PGDATABASE"',
*args.arg,
]
print(shlex.join(command))
if args.dry_run or args.verbose:
subprocess.run(["docker", "compose", "exec", "tools", "pg_dump", "--version"])
print(shlex.join(command))
if args.dry_run:
sys.exit(0)
sys.exit(subprocess.run(command, stdout=file_out).returncode)


Expand Down
25 changes: 23 additions & 2 deletions scripts/db-restore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ import sys
def main() -> None:
"""Restore the database backup."""
parser = argparse.ArgumentParser(description="Restore the database backup.")
parser.add_argument("--verbose", action="store_true", help="Print the command that is executed.")
parser.add_argument(
"--dry-run", action="store_true", help="Only print the command that would be executed."
)
parser.add_argument(
"--env",
help="The env file to use to get the connection settings, by default we log in the composition to "
Expand Down Expand Up @@ -89,7 +93,20 @@ def main() -> None:
"--dbname={}".format(env["PGDATABASE"]),
*args.arg,
]
print(shlex.join([*command1, *command2_annon, *command3]))
if args.verbose or args.dry_run:
subprocess.run(
[
"docker",
"run",
"--rm",
"camptocamp/postgres:{}".format(env["POSTGRES_TAG"]),
"pg_restore",
"--version",
]
)
print(shlex.join([*command1, *command2_annon, *command3]))
if args.dry_run:
sys.exit(0)
sys.exit(subprocess.run([*command1, *command2, *command3], stdin=file_in).returncode)
else:
command = [
Expand All @@ -103,7 +120,11 @@ def main() -> None:
"-c",
'pg_restore --dbname="$PGDATABASE" ' + " ".join(args.arg),
]
print(shlex.join(command))
if args.verbose or args.dry_run:
subprocess.run(["docker", "compose", "exec", "tools", "pg_restore", "--version"])
print(shlex.join(command))
if args.dry_run:
sys.exit(0)
sys.exit(subprocess.run(command, stdin=file_in).returncode)


Expand Down
Loading