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 authored and Sam Arbid committed Oct 29, 2024
1 parent ace2ed2 commit a70dd4d
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 53 deletions.
10 changes: 2 additions & 8 deletions scripts/wait-for-services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,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; }
check_ready "OpenSearch" _search_check
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) (exposed ports: 9200, 9600)
# - OpenSearch Dashboard/Kibana (view OS/ES indexes) (exposed ports: 5601)
Expand All @@ -40,17 +40,10 @@ services:
extends:
file: docker-services.yml
service: opensearch-dashboards
{%- 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)
# - OpenSearch (exposed ports: 9200, 9600)
# - Kibana (view ES indexes) (exposed ports: 5601)
Expand All @@ -36,17 +36,10 @@ services:
extends:
file: docker-services.yml
service: opensearch-dashboards
{%- 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 @@ -16,11 +16,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 @@ -36,7 +32,6 @@ services:
read_only: true
ports:
- "6379:6379"
{%- if cookiecutter.database == 'postgresql'%}
db:
image: postgres:14.13
restart: "unless-stopped"
Expand All @@ -56,26 +51,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 a70dd4d

Please sign in to comment.