Skip to content

Commit

Permalink
db: remove deprecated mysql option
Browse files Browse the repository at this point in the history
* Remove deprcated MySql support
  • Loading branch information
Samk13 committed Aug 26, 2024
1 parent bccdad1 commit 5b40a9a
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 53 deletions.
11 changes: 3 additions & 8 deletions scripts/wait-for-services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#
# Copyright (C) 2019-2020 CERN.
# Copyright (C) 2019-2020 Northwestern University.
# Copyright (C) 2024 KTH Royal Institute of Technology.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand All @@ -31,14 +32,8 @@ then
check_ready "S3" _s3_check
fi

if [[ ${COOKIECUTTER_DATABASE} == "mysql" ]]
then
_db_check(){ docker-compose exec db bash -c "mysql -p${PROJECT_NAME} -e \"select Version();\"" &>/dev/null; }
check_ready "MySQL" _db_check
else
_db_check(){ docker-compose exec --user postgres db bash -c "pg_isready" &>/dev/null; }
check_ready "Postgres" _db_check
fi
_db_check(){ docker-compose exec --user postgres db bash -c "pg_isready" &>/dev/null; }
check_ready "Postgres" _db_check

_search_check(){ curl --output /dev/null --silent --head --fail http://localhost:9200 &>/dev/null; }
if [[ ${COOKIECUTTER_SEARCH} == "elasticsearch7" ]]
Expand Down
9 changes: 1 addition & 8 deletions {{cookiecutter.project_shortname}}/docker-compose.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# - UI application: UWSGI (not exposed)
# - API application: UWSGI (not exposed)
# - Cache: Redis (exposed port: 6379)
# - DB: (PostgresSQL/MySQL) (exposed port: 5432 or 3306)
# - DB: (PostgresSQL) (exposed port: 5432)
# - Message queue: RabbitMQ (exposed ports: 5672, 15672)
# - Search platform: (OpenSearch/Elasticsearch) (exposed ports: 9200, 9300)
# - OpenSearch Dashboard/Kibana (view OS/ES indexes) (exposed ports: 5601)
Expand Down Expand Up @@ -48,17 +48,10 @@ services:
file: docker-services.yml
service: opensearch-dashboards
{%- endif %}
{%- if cookiecutter.database == 'postgresql'%}
pgadmin:
extends:
file: docker-services.yml
service: pgadmin
{%- elif cookiecutter.database == 'mysql'%}
phpmyadmin:
extends:
file: docker-services.yml
service: phpmyadmin
{%- endif %}
{%- endif %}
{%- if cookiecutter.file_storage == 'S3'%}
s3:
Expand Down
9 changes: 1 addition & 8 deletions {{cookiecutter.project_shortname}}/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#
# Following services are included:
# - Cache: Redis (exposed port: 6379)
# - DB: (PostgresSQL/MySQL) (exposed port: 5432 or 3306)
# - DB: (PostgresSQL) (exposed port: 5432)
# - Message queue: RabbitMQ (exposed ports: 5672, 15672)
# - Elasticsearch (exposed ports: 9200, 9300)
# - Kibana (view ES indexes) (exposed ports: 5601)
Expand Down Expand Up @@ -44,17 +44,10 @@ services:
file: docker-services.yml
service: opensearch-dashboards
{%- endif %}
{%- if cookiecutter.database == 'postgresql'%}
pgadmin:
extends:
file: docker-services.yml
service: pgadmin
{%- elif cookiecutter.database == 'mysql'%}
phpmyadmin:
extends:
file: docker-services.yml
service: phpmyadmin
{%- endif %}
{%- endif %}
{%- if cookiecutter.file_storage == 'S3'%}
s3:
Expand Down
25 changes: 0 additions & 25 deletions {{cookiecutter.project_shortname}}/docker-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ services:
- "INVENIO_COMMUNITIES_IDENTITIES_CACHE_REDIS_URL=redis://cache:6379/4"
- "INVENIO_SEARCH_HOSTS=['search:9200']"
- "INVENIO_SECRET_KEY=CHANGE_ME"
{%- if cookiecutter.database == 'postgresql'%}
- "INVENIO_SQLALCHEMY_DATABASE_URI=postgresql+psycopg2://{{cookiecutter.project_shortname}}:{{cookiecutter.project_shortname}}@db/{{cookiecutter.project_shortname}}"
{%- elif cookiecutter.database == 'mysql'%}
- "INVENIO_SQLALCHEMY_DATABASE_URI=mysql+pymysql://{{cookiecutter.project_shortname}}:{{cookiecutter.project_shortname}}@db/{{cookiecutter.project_shortname}}"
{%- endif %}
- "INVENIO_WSGI_PROXIES=2"
- "INVENIO_RATELIMIT_STORAGE_URL=redis://cache:6379/3"
frontend:
Expand All @@ -37,7 +33,6 @@ services:
read_only: true
ports:
- "6379:6379"
{%- if cookiecutter.database == 'postgresql'%}
db:
image: postgres:12.4
restart: "unless-stopped"
Expand All @@ -57,26 +52,6 @@ services:
PGADMIN_DEFAULT_PASSWORD: "{{cookiecutter.project_shortname}}"
volumes:
- ./docker/pgadmin/servers.json:/pgadmin4/servers.json
{%- elif cookiecutter.database == 'mysql'%}
db:
image: mysql
restart: "unless-stopped"
environment:
- "MYSQL_ROOT_PASSWORD={{cookiecutter.project_shortname}}"
- "MYSQL_DATABAE={{cookiecutter.project_shortname}}"
- "MYSQL_USER={{cookiecutter.project_shortname}}"
- "MYSQL_PASSWORD={{cookiecutter.project_shortname}}"
ports:
- "3306:3306"
phpmyadmin:
image: phpmyadmin/phpmyadmin
restart: "unless-stopped"
ports:
- '8080:80'
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: {{cookiecutter.project_shortname}}
{%- endif %}
mq:
image: rabbitmq:3-management
restart: "unless-stopped"
Expand Down
4 changes: 0 additions & 4 deletions {{cookiecutter.project_shortname}}/invenio.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ APP_ALLOWED_HOSTS = ['0.0.0.0', 'localhost', '127.0.0.1']
# See https://flask-sqlalchemy.palletsprojects.com/en/2.x/config/

# TODO: Set
{%- if cookiecutter.database == 'postgresql'%}
SQLALCHEMY_DATABASE_URI="postgresql+psycopg2://{{cookiecutter.project_shortname}}:{{cookiecutter.project_shortname}}@localhost/{{cookiecutter.project_shortname}}"
{%- elif cookiecutter.database == 'mysql'%}
SQLALCHEMY_DATABASE_URI="mysql+pymysql://{{cookiecutter.project_shortname}}:{{cookiecutter.project_shortname}}@localhost/{{cookiecutter.project_shortname}}"
{%- endif %}


# Invenio-App
Expand Down

0 comments on commit 5b40a9a

Please sign in to comment.