Skip to content

Commit

Permalink
UPD: mysql upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
Itskiprotich committed Aug 20, 2024
1 parent 97ff72b commit 05fc7ee
Show file tree
Hide file tree
Showing 17 changed files with 125,850 additions and 18 deletions.
22 changes: 13 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ LABEL imeja.image.authors="[email protected]" \
RUN a2enmod rewrite; \
a2enmod headers; \
a2enmod ssl

# Install some extra stuff

RUN set -ex; \
apt-get update; \
apt-get install -y \
Expand All @@ -24,12 +23,15 @@ RUN set -ex; \
git \
nodejs \
default-mysql-client \
vim; \
vim \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev; \
apt-get clean


# Install some php extensions from the docker built source.
RUN docker-php-ext-install gettext mysqli pdo_mysql zip
RUN docker-php-ext-configure gd --with-freetype --with-jpeg; \
docker-php-ext-install gettext mysqli pdo_mysql zip gd


# Install the intl extension
Expand Down Expand Up @@ -61,16 +63,18 @@ RUN mkdir -p /var/log/supervisor
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf

# Install wkhtmltopdf
RUN apt-get install -y \
wkhtmltopdf
# Copy the migration script
# RUN apt-get install -y \
# wkhtmltopdf
# # Copy the migration script
COPY run_migrations.sh /usr/local/bin/run_migrations.sh

# Ensure the script is executable
RUN chmod +x /usr/local/bin/run_migrations.sh
RUN chmod +x .
# Start Supervisor and Apache
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]


# Run the script after the container starts
# CMD ["/bin/bash", "/usr/local/bin/init_db.sh"]
# Run the migration script as the container's entrypoint
# ENTRYPOINT ["/usr/local/bin/run_migrations.sh"]
11 changes: 9 additions & 2 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
* Development Mode:
* true: Errors and warnings shown.
*/
'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN),
'debug' => true,
'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN),

/*
* Configure basic information about the application.
Expand Down Expand Up @@ -132,6 +131,14 @@
'duration' => '+1 years',
'url' => env('CACHE_CAKEMODEL_URL', null),
],
'_cake_routes_' => [
'className' => 'File',
'prefix' => 'myapp_cake_routes_',
'path' => CACHE . 'persistent/',
'serialize' => true,
'duration' => '+1 years',
'url' => env('CACHE_CAKE_ROUTES_URL', null),
],
],

/*
Expand Down
125,800 changes: 125,800 additions & 0 deletions db.sql

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

services:
db:
image: mysql:5.7
container_name: db
image: mysql:latest
container_name: pvers_db
environment:
MYSQL_ROOT_PASSWORD: changeme.
MYSQL_DATABASE: pvers
Expand All @@ -15,7 +15,7 @@ services:
- mydb
volumes:
- ./db.sql:/docker-entrypoint-initdb.d/db.sql
# - ~/pvers-4x-mysql-data:/var/lib/mysql
- ~/pvers-4x-latest-mysql-data:/var/lib/mysql
web:
build: .
restart: always
Expand Down
2 changes: 1 addition & 1 deletion doses.sql
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ INSERT INTO `countries` (`id`, `code`, `name`, `name_fr`, `created`, `modified`)

UPDATE countries SET created = CURRENT_TIMESTAMP,modified=CURRENT_TIMESTAMP;


-- Dose Information Here

TRUNCATE TABLE authorities;
INSERT INTO `authorities` (`id`, `mah_name`, `mah_company_name`, `mah_company_address`, `mah_company_telephone`, `mah_company_email`, `product`, `master_mah`) VALUES
Expand Down
2 changes: 2 additions & 0 deletions facility.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

-- Storing Facility Information

TRUNCATE TABLE facility_codes;
INSERT INTO `facility_codes` (`id`, `facility_code`, `facility_name`, `province`, `county`, `sub_county`, `district`, `division`, `ward`, `type`, `owner`, `location`, `sub_location`, `description_of_location`, `constituency`, `nearest_town`, `beds`, `cots`, `keph_level`, `official_landline`, `official_fax`, `official_mobile`, `official_email`, `official_address`, `official_alternate_number`, `town`, `post_code`, `in_charge`, `job_title_of_in_charge`, `open_24hrs`, `open_weekends`, `operational_status`, `anc`, `art`, `beoc`, `blood`, `caes_sec`, `ceoc`, `c_imci`, `epi`, `fp`, `growm`, `hbc`, `hct`, `ipd`, `opd`, `outreach`, `pmtct`, `rad_xray`, `rhtc_rhdc`, `tb_diag`, `tb_labs`, `tb_treat`, `Youth`, `created`, `modified`) VALUES
(1, '17582', 'AIC Ebenezer', 'Rift Valley', 'Baringo', 'Baringo Central', 'Baringo Central', 'Kabarnet', 'Kabarnet', 'Dispensary', 'Christian Health Association of Kenya', 'Ngolong', 'Ngolong', '', 'Baringo Central', 'Kabarnet', '0', '0', 'Level 2', '0', '', '722233450', '', '', '', '', '', '', '', 'No', 'No', 'Closed', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', NULL, '2023-08-25 10:46:14'),
Expand Down
2 changes: 2 additions & 0 deletions insert_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
-- Truncate the table to reset the auto-increment counter
TRUNCATE TABLE designations;

-- Designations here:

-- Insert the values with IDs starting from 1
INSERT INTO `designations` (`id`, `name`, `category`, `created`, `modified`) VALUES
(1, 'Physician', 1, NULL, '2021-02-27 17:50:26'),
Expand Down
22 changes: 19 additions & 3 deletions run_migrations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ done

>&2 echo "MySQL is up - executing command"

# Run CakePHP migrations
cd /var/www/html
bin/cake migrations migrate
# # Run CakePHP migrations
# cd /var/www/html
# mysql -u "$DB_USER" -p"$DB_PASSWORD" "$DB_NAME" < "$SQL_FACILITY_CODES"
# echo "Performing action 2 with SQL file $SQL_FACILITY_CODES."
# mysql -u "$DB_USER" -p"$DB_PASSWORD" "$DB_NAME" < "$SQL_FILE_ACTION_1"
# echo "SQL script executed successfully for action 1."
# mysql -u "$DB_USER" -p"$DB_PASSWORD" "$DB_NAME" < "$SQL_DOSES"
# echo "Successfully inserted doses"
# bin/cake migrations migrate

# Wait for the database to be ready
# echo "Waiting for the database to be ready..."

# until docker exec -i pvers_web_app mysql -h db -u changeme -pchangeme. -e 'SELECT 1' > /dev/null 2>&1; do
# >&2 echo "MySQL is unavailable - sleeping"
# sleep 1
# done

# >&2 echo "MySQL is up - executing command"
1 change: 1 addition & 0 deletions templates/Users/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
]
]);
echo $this->Form->control('county_id', ['empty' => true]);
// debug($this->Captcha->render());
echo $this->Captcha->render([
'placeholder' => __('Please solve the riddle'),
]);
Expand Down
Empty file modified templates/element/comments/add.php
100644 → 100755
Empty file.
Empty file modified templates/element/comments/index.php
100644 → 100755
Empty file.
Empty file modified templates/element/comments/list.php
100644 → 100755
Empty file.
Empty file modified templates/element/help/assessment.php
100644 → 100755
Empty file.
Empty file modified templates/element/multi/sadr_reactions.php
100644 → 100755
Empty file.
Empty file modified templates/element/sadr/sadr_view.php
100644 → 100755
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 05fc7ee

Please sign in to comment.