diff --git a/unipept-database/Dockerfile b/unipept-database/Dockerfile index 564bda6..97abe35 100755 --- a/unipept-database/Dockerfile +++ b/unipept-database/Dockerfile @@ -1,4 +1,4 @@ -FROM mariadb:jammy +FROM postgres:16.2-bullseye ### # Name: unipept-database @@ -49,20 +49,14 @@ RUN apt update && \ sudo \ lz4 - -# Configure curl to use the newly builded libcurl -#RUN ldconfig - -RUN git clone --depth 1 https://github.com/unipept/unipept-database +# TODO change to unipept repo once changes are merged to master! +RUN git clone --depth 1 -b feature/postgres https://github.com/stijndcl/unipept-database COPY "db_entrypoint.sh" "/docker-entrypoint-initdb.d/db_entrypoint.sh" # Sometimes, these files are copied over from Windows systems and need to be converted into Unix line endings to make # sure that these can be properly executed by the container. RUN dos2unix /unipept-database/scripts/**/*.sh && chmod u+x /unipept-database/scripts/*.sh -COPY "config/custom_mysql_config.cnf" "/etc/mysql/conf.d/custom_mysql_config.cnf" -RUN chmod a-w "/etc/mysql/conf.d/custom_mysql_config.cnf" - RUN echo 'root:unipept' | chpasswd # Install Rust toolchain (https://rustup.rs/) @@ -92,4 +86,4 @@ ENV VERBOSE false ENV SORT_MEMORY 2G -EXPOSE 3306 +EXPOSE 5432 diff --git a/unipept-database/config/custom_mysql_config.cnf b/unipept-database/config/custom_mysql_config.cnf deleted file mode 100755 index 0c4ddbc..0000000 --- a/unipept-database/config/custom_mysql_config.cnf +++ /dev/null @@ -1,7 +0,0 @@ -[mysqld] -secure-file-priv = "" -local-infile=1 -default-authentication-plugin=mysql_native_password -innodb_buffer_pool_size=2048M -innodb_flush_log_at_trx_commit = 0 -innodb_file_per_table diff --git a/unipept-database/db_entrypoint.sh b/unipept-database/db_entrypoint.sh index dd6e48b..b467e68 100755 --- a/unipept-database/db_entrypoint.sh +++ b/unipept-database/db_entrypoint.sh @@ -21,11 +21,14 @@ echo "unipept" | su -c "./scripts/build_database.sh $VERBOSE-f $FILTER_TAXA -i ' echo "***** START LOADING TABLES *****" -# Data has been generated by this point. Now, we can load it into the MySQL-database for use later on. -mariadb -uunipept -punipept < schemas/structure_no_index.sql -echo "unipept" | su -c "./scripts/load.sh '/tmp/tables'" root +# Data has been generated by this point. Now, we can load it into the PSQL-database for use later on. +PGPASSWORD=unipept psql -U unipept < schemas/structure_no_index_no_constraints.sql +echo "unipept" | su -c "./scripts/parallel_load.sh '/tmp/tables'" root rm -f '/tables/**/*.tsv.lz4' +echo "***** START APPLYING CONSTRAINTS *****" +PGPASSWORD=unipept psql -U unipept < schemas/structure_constraints_only.sql + echo "***** START INDEXING TABLES *****" -echo "unipept" | su -c "./scripts/index.sh" root +echo "unipept" | su -c "./scripts/parallel_index.sh" root diff --git a/unipept-web/Dockerfile b/unipept-web/Dockerfile index 79e2200..a16f043 100755 --- a/unipept-web/Dockerfile +++ b/unipept-web/Dockerfile @@ -33,10 +33,10 @@ RUN apt-get autoremove -y \ RUN git clone https://github.com/unipept/unipept-api.git RUN cd unipept-api && git checkout main && gem install bundler -RUN cd unipept-api/config && printf " host: host.docker.internal\n port: 3306\n" >> database.yml +RUN cd unipept-api/config && printf " host: host.docker.internal\n port: 5432\n" >> database.yml RUN cd unipept-api && bundle install ENV RAILS_ENV=production ENV DB_PORT=3300 -CMD cd unipept-api && sed -i "s/port: 3306/port: $DB_PORT/g" config/database.yml && bundle exec rails server -b 0.0.0.0 -e production +CMD cd unipept-api && sed -i "s/port: 5432/port: $DB_PORT/g" config/database.yml && bundle exec rails server -b 0.0.0.0 -e production