diff --git a/.lando.yml b/.lando.yml new file mode 100644 index 00000000..24aa9b52 --- /dev/null +++ b/.lando.yml @@ -0,0 +1,39 @@ +name: coursecatalog +recipe: symfony +config: + webroot: public + php: 8.1 +services: + appserver: + build_as_root: + - apt update + - mkdir /opt/oracle + # Fetch binaries directly from Oracle: + # https://www.oracle.com/database/technologies/instant-client/downloads.html + - curl https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-basic-linux.arm64-19.10.0.0.0dbru-2.zip > /opt/oracle/instantclient-basic.zip + - curl https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-sdk-linux.arm64-19.10.0.0.0dbru.zip > /opt/oracle/instantclient-sdk.zip + # Unzip + - unzip /opt/oracle/instantclient-basic.zip -d /opt/oracle + - unzip /opt/oracle/instantclient-sdk.zip -d /opt/oracle + # Add sqlplus command line Oracle client for debugging. + - curl https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-sqlplus-linux.arm64-19.10.0.0.0dbru.zip > /opt/oracle/instantclient-sqlplus.zip + - unzip /opt/oracle/instantclient-sqlplus.zip -d /opt/oracle + # Delete all of our downloads. + - rm /opt/oracle/*.zip + # Make OS aware of newly installed libraries + - echo /opt/oracle/instantclient_19_10 > /etc/ld.so.conf.d/oracle-instantclient.conf + - ldconfig -v + # Set the interpreter for the Oracle command-line tools. + # See: https://askubuntu.com/questions/1397724/no-such-file-or-directory-when-running-sqlplus-command + # This is not needed for the Oci8 PHP extension itself, but is needed to + # get sqlplus command-line Oracle client working for debugging. + - apt -y install patchelf + - patchelf --set-interpreter /lib/ld-linux-aarch64.so.1 /opt/oracle/instantclient_19_10/adrci + - patchelf --set-interpreter /lib/ld-linux-aarch64.so.1 /opt/oracle/instantclient_19_10/genezi + - patchelf --set-interpreter /lib/ld-linux-aarch64.so.1 /opt/oracle/instantclient_19_10/sqlplus + - patchelf --set-interpreter /lib/ld-linux-aarch64.so.1 /opt/oracle/instantclient_19_10/uidrvci + # Install libaio1 -- when missing was preventing the extension from loading. + - apt install libaio1 + # Install and enable OCI8 + - echo "instantclient,/opt/oracle/instantclient_19_10" | pecl install oci8-3.2.1 + - docker-php-ext-enable oci8 diff --git a/README.md b/README.md index 92005a27..1235ac72 100644 --- a/README.md +++ b/README.md @@ -39,16 +39,40 @@ These instructions assume that you have a POSIX machine running Apache with PHP cd coursecatalog git-submodule update --init --recursive ``` -3. Make a symbolic link to the `coursecatalog/docroot/` directory in a web-accessible directory or add a virtualhost rooted in the `coursecatalog/docroot/` directory. -4. Create a MySQL database for the catalogs data and a cache of Banner data. -5. Make copies of the example config files at `configuration.plist`, `frontend_config.ini`, and `update_config.ini` and edit values to match your environment. -6. Create the database tables defined in `application/library/banner/course/sql/table_creation.sql` -7. Run the script at `bin/update-from-banner.php` to dump Banner data into the the MySQL database: +3. Install additional dependencies with Composer: + ``` + composer install + ``` +4. Make a symbolic link to the `coursecatalog/docroot/` directory in a web-accessible directory or add a virtualhost rooted in the `coursecatalog/docroot/` directory. +5. Create a MySQL database for the catalogs data and a cache of Banner data. +6. Make copies of the example config files at `configuration.plist`, `frontend_config.ini`, and `update_config.ini` and edit values to match your environment. +7. Create the database tables defined in `application/library/banner/course/sql/table_creation.sql` +8. Run the script at `bin/update-from-banner.php` to dump Banner data into the the MySQL database: ``` php bin/update-from-banner.php php bin/build_indices.php ``` +## Development environment setup + +### Lando +Install Docker and Lando to provide a local containerized environment + +In the code directory, start the local containers with `lando start` + +### Copying the production database +Dump the production database to a non version-controlled file path like `var/catalog_prod.sql`. + +Strip out any `DEFINER` statements that will break the import: +``` +sed -i '' 's/DEFINER=[^*]*\*/\*/g' var/catalog_prod.sql +``` + +Import the database into the local container: +``` +lando db-import var/catalog_prod.sql +``` + Unit Tests ----------