Skip to content

Commit

Permalink
Merge pull request #506 from GOCDB/release-5.11.0
Browse files Browse the repository at this point in the history
Release 5.11.0 to master
  • Loading branch information
gregcorbett authored Feb 26, 2024
2 parents 0a1d9eb + 33cb59f commit 37c788d
Show file tree
Hide file tree
Showing 330 changed files with 15,438 additions and 7,805 deletions.
3 changes: 3 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ version: "2"
plugins:
phpcodesniffer:
enabled: true
# Need the beta channel to enforce PSR12,
# see https://docs.codeclimate.com/docs/phpcodesniffer#standard.
channel: "beta"
config:
standard: "phpcs.xml"
phpmd:
Expand Down
91 changes: 16 additions & 75 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,92 +4,31 @@ on: [push, pull_request]

jobs:

phpunit-sqlite:
# The SQLite version depends on the current environment. See documentation:
# https://github.com/actions/virtual-environments/tree/main/images/linux
name: "PHPUnit with SQLite, PHP: ${{ matrix.php-version }}"
runs-on: ubuntu-latest
# If true, allow this job to fail:
continue-on-error: true
strategy:
matrix:
# Define jobs for all combinations of values given to be tested:
php-version: ["5.6"]

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
with:
fetch-depth: 2

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "xdebug"

- name: Validate composer.json and composer.lock
run: composer validate

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --no-progress

- name: Set up unit testing
run: .github/actions/setup.sh
env:
DB: sqlite

- name: Run unit tests
run: .github/actions/run_tests.sh

- name: "Upload to Codecov"
uses: "codecov/codecov-action@v3"


phpunit-mariadb:
name: "PHPUnit with MariaDB: ${{ matrix.mariadb-version }}, PHP: ${{ matrix.php-version }}, extension: ${{ matrix.extension }}"
runs-on: ubuntu-latest
# If true, allow the job to fail:
continue-on-error: ${{ matrix.experimental }}
strategy:
# If true, stop jobs if a required job fails:
fail-fast: false
matrix:
# Define jobs for all combinations of php, mariadb and extension, up to "include"
# Tests will be performed for each combination
# These can fail if "experimental" is true. Currently all must pass
php-version: ["5.4", "5.5", "5.6", "7.0", "7.1"]
php-version: ["5.4", "5.5", "5.6", "7.0", "7.1", "7.4"]
mariadb-version: ["10.3"]
extension: ["pdo_mysql"]
experimental: [false]
include:
# Define jobs for individual combinations to be tested
# These can fail if "experimental" is true. Currently all can fail
- php-version: "7.2"
mariadb-version: "10.3"
extension: "pdo_mysql"
experimental: true
- php-version: "7.3"
mariadb-version: "10.3"
extension: "pdo_mysql"
experimental: true
- php-version: "5.4"
composer-json: "composer.json"
- php-version: "5.5"
composer-json: "composer.json"
- php-version: "5.6"
composer-json: "composer.json"
- php-version: "7.0"
composer-json: "composer.json"
- php-version: "7.1"
composer-json: "composer.json"
- php-version: "7.4"
mariadb-version: "10.3"
extension: "pdo_mysql"
experimental: true
- php-version: "8.0"
mariadb-version: "10.3"
extension: "pdo_mysql"
experimental: true
composer-json: "composer-7.4.json"

services:
mariadb:
Expand All @@ -106,7 +45,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"
with:
fetch-depth: 2

Expand All @@ -122,14 +61,16 @@ jobs:

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
env:
COMPOSER: ${{ matrix.composer-json }}
run: composer install --no-progress

- name: Set up unit testing
Expand Down
89 changes: 48 additions & 41 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This file is best viewed using a browser-plugin for markdown `.md` files.

* [Database server](#database-server)
* Oracle 11g+ or MariaDB/MySQL
* (note: the free Oracle 11g XE Express Editions which comes with a free license is perfectly suitable)
* Oracle 18c XE Express Edition available under the Oracle Free Use Terms and Conditions is suitable for development and testing (https://www.oracle.com/downloads/licenses/oracle-free-license.html).
* MariaDB/MySQL
* package `mariadb-server`

Expand Down Expand Up @@ -117,13 +117,23 @@ For GocDB, three URL alias/directory-mappings are needed, one for the portal GUI
Note that, depending on Apache/httpd version, the "Require all granted" statements in gocdbssl.conf may cause an HTTP Error "500 - Invalid configuration..." and can be commented out.

### Database Server
GOCDB uses a DB abstraction layer (Doctrine) and with some configuration should be deployable on different RDBMS platforms that are supported for Doctrine. Instructions are provided here for Oracle (the free Oracle 11g is perfectly suitable) and MySQL/MariaDB.
GOCDB uses a DB abstraction layer (Doctrine) and with some configuration should be deployable on different RDBMS platforms that are supported for Doctrine. Instructions are provided here for Oracle and MySQL/MariaDB.

#### Oracle 11g
The free to use XE/11g Oracle DB can be used to host run GOCDB on Win/nix. To use Oracle on nix systems, the OCI8 extension/driver needs to be compiled and installed.
#### Oracle XE (18c)
The free to use XE/18c Oracle DB can be used to host the GOCDB database for development and testing. This document adapts the instructions used for the unsupported Oracle 11g database. However, using a single, 'common user' at the root of a multitenant container database is not necessarily the best, or most secure, configuration.

To download and install the database server, follow the instructions linked from here - https://www.oracle.com/database/technologies/appdev/xe.html.

Notes on Oracle 18c XE installation:
- "SEVERE: [FATAL] [DBT-06103] The port (5,500) is already in use." is caused by the short host name (alias) not being configured in /etc/hosts. (https://dba.stackexchange.com/questions/268437/fatal-dbt-06103-the-port-5-500-is-already-in-use)
- PATH Bash environment variable should be updated to include the Oracle executables BEFORE the oraenv script is run -
```
export PATH=/opt/oracle/product/18c/dbhomeXE/bin:$PATH
```

#### Compiling/Installing OCI8
Using Oracle on Linux requires the OCI8 extension/driver for php: http://php.net/oci8.

##### Compiling/Installing OCI8
The OCI8 extension/driver for php needs to be installed, see: http://php.net/oci8
This can be most easily installed with the free Oracle Instant Client libs which can be installed in a number of ways (http://php.net/manual/en/oci8.installation.php), but the most easy is via PECL as descibed below:

Install the basic, devel and sqlplus instantclient rpms from Oracle (http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html) and install GCC, PHP dev and pear packages:
Expand Down Expand Up @@ -277,36 +287,33 @@ deployment of your GOCDB instance:
* [Deploy Sample Data](#deploy-sample-data) (optional)

### Create DB User/Account <a id="create-db"></a>
#### Oracle
#### Oracle <a id="oracle-user"></a>

If you intend to populate the database from a dump of an existing GOCDB5 instance you do NOT need to create the GOCDB5 user. Simply deploy the data as described at ["Deploy and existing DB"](#deploy-existing-dump) below remembering that you might want to ALTER the password for the GOCDB5 user after the import.
If you intend to populate the database from a dump of an existing GOCDB5 instance you do NOT need to create the GOCDB5 user. Simply deploy the data as described at ["Deploy and existing DB"](#deploy-existing-dump).

Create a dedicated GOCDB5 user using the following script (substitute GOCDB5 for your username and a secure password). Run this script as the Oracle admin/system user:
Create a dedicated GOCDB5 user using the following script (substitute C##GOCDB5 for your username and a secure password). The C## (or c##) prefix is required to indicate an Oracle 'common user'. Run this script as the Oracle admin/system user:

```
-- Manage GOCDB5 user if already exists (optional) --
drop user gocdb5 cascade;
-- CREATE USER SQL
CREATE USER GOCDB5 IDENTIFIED BY <PASSWORD>
DROP USER C##GOCDB5 CASCADE;
CREATE USER C##GOCDB5 IDENTIFIED BY <PASSWORD>
DEFAULT TABLESPACE "USERS"
QUOTA UNLIMITED ON "USERS"
TEMPORARY TABLESPACE "TEMP";
-- ROLES - GRANT "RESOURCE" TO GOCDB5
-- SYSTEM PRIVILEGES
GRANT CREATE TRIGGER TO GOCDB5 ;
GRANT CREATE SEQUENCE TO GOCDB5 ;
GRANT CREATE TABLE TO GOCDB5 ;
GRANT CREATE JOB TO GOCDB5 ;
GRANT CREATE PROCEDURE TO GOCDB5 ;
GRANT CREATE TYPE TO GOCDB5 ;
GRANT CREATE SESSION TO GOCDB5 ;
--
GRANT CREATE TRIGGER TO C##GOCDB5;
GRANT CREATE SEQUENCE TO C##GOCDB5;
GRANT CREATE TABLE TO C##GOCDB5;
GRANT CREATE JOB TO C##GOCDB5;
GRANT CREATE PROCEDURE TO C##GOCDB5;
GRANT CREATE TYPE TO C##GOCDB5;
GRANT CREATE SESSION TO C##GOCDB5;
```

If you are using sqlplus to connect to the database remotely you will need also -

```
GRANT CONNECT TO GOCDB5;
GRANT CONNECT TO C##GOCDB5;
```

By default, Oracle 11g will expire a password in 180 days. In previous versions
Expand Down Expand Up @@ -424,21 +431,18 @@ $ php deploy/DeployRequiredDataRunner.php requiredData

### OPTIONAL: Deploy Sample Data<a id="deploy-sample-data"></a>

You can choose to deploy some sample data to seed your DB with sample users,
sites and services. Two sample data sets are available. Choose one of -

1. Minimal - just enough to get going with no real-world associations.

```bash
$ cd lib/Doctrine
$ php deploy/DeploySampleDataRunner.php simpleSampleData
```
1. "Real World" - a small subset derived from real data.
You can choose to deploy some sample data to seed your database. It consists of
a project which contains 2 NGIs, and another NGI not in a project. Each NGI contains
multiple sites, and each site has 1-5 services. Each service belongs to at least one
service group, of which there are 7. Each service group has 5-8 services. The
database is populated with unique sample users, which have roles over relevant site,
NGI, project and service group entities. The sample data has no real-world
associations.

```bash
$ cd lib/Doctrine
$ php deploy/DeploySampleDataRunner.php sampleData
```
```bash
$ cd lib/Doctrine
$ php deploy/DeploySampleDataRunner.php sampleData
```

### ORACLE ONLY: Deploy an existing DB .dmp file to populate your DB<a id="deploy-existing-dump"></a>

Expand All @@ -457,13 +461,11 @@ This directory object defines the directory where the .dmp file is loaded from.
```

* Import your dmp file. Note, the example below assumes the 'gocdb5' user/schema does not exist in the db - the import actually creates this user with all its permissions/roles.
If you want to use a different schema/username, then specify this in the value of the remap_schema argument on the right of the colon.
You may need to change different arguments for your install such as modifying the remap_tablespace:
If you want to use a different schema/username, then specify this in the value of the remap_schema argument on the right of the colon. (The following example remaps to an Oracle 'common user' as described in [creating the Oracle user/account](#oracle-user) above, after importing an Oracle 11 dump to an Oracle 18 service). You may need to change different arguments for your install such as modifying the remap_tablespace:

```
$impdp system/******** schemas=gocdb5 directory=dmpdir dumpfile=goc5dump.dmp REMAP_SCHEMA=gocdb5:gocdb5 remap_tablespace=GOCDB5:users table_exists_action=replace logfile=gocdbv5deploy.log
$impdp system/******** schemas=gocdb5 directory=dmpdir dumpfile=goc5dump.dmp REMAP_SCHEMA=gocdb5:c##gocdb5 remap_tablespace=GOCDB5:users table_exists_action=replace logfile=gocdbv5deploy.log
```
Note: If you get the following error, there is a file permissionsissue of some kind.
Try creating a new directory for the dump-file, possibly within your Oracle directory.

Expand All @@ -474,6 +476,11 @@ You may need to change different arguments for your install such as modifying th
ORA-06512: at "SYS.UTL_FILE", line 536
ORA-29283: invalid file operation
```
* Change the database password if necessary -

```
SQL> alter user c##gocdb5 identified by <password>;
```

* To generate statistics after importing the dmp file (this improves performance):

Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
Grid Operations Configuration Management Database. A Repository, Portal and REST style API for managing Grid and Cloud topology objects including; projects, administrative domains, sites, services, service-endpoints, service-groups, downtimes, users, roles and business rules.

<span>
<img alt="STFC logo" src="htdocs/images/UKRI_STF_Council-Logo_Horiz-RGB_crop.png" height=57/>
<img alt="EU flag" src="htdocs/images/eu_flag_yellow_low_150.png" height=57 />
<img alt="EGI logo" src="htdocs/images/egi_logo.jpg" height=57 />
<img alt="EOSC-hub logo" src="htdocs/images/eosc-hub-v-web_150.png" height=57 />
<img alt="STFC logo" src="htdocs/images/logos/ukri_stfc.png" height=64/>
<img alt="EU flag" src="htdocs/images/flags/eu.png" height=57 />
<img alt="EGI logo" src="htdocs/images/logos/egi.png" height=57 />
<img alt="EOSC Future logo" src="htdocs/images/logos/eosc_future.png" height=57 />
<img alt="IRIS logo" src="htdocs/images/logos/iris_ac_uk.png" height=57 />
</span>

GOCDB is provided by [STFC](https://stfc.ukri.org/) for [EGI](https://www.egi.eu/federation/), co-funded by [EGI.eu](https://www.egi.eu/) and [EOSC-hub](https://www.eosc-hub.eu/). Licensed under the [Apache 2 License](http://www.apache.org/licenses/LICENSE-2.0).
GOCDB is provided by [STFC](https://stfc.ukri.org/), part of [UK Research and Innovation](https://www.ukri.org/), and is co-funded by [EGI](https://egi.eu) via [EGI-ACE](https://www.egi.eu/project/egi-ace/), [EOSC-Future](https://eoscfuture.eu/) and the [IRIS](https://www.iris.ac.uk/) community.

Licensed under the [Apache 2 License](https://www.apache.org/licenses/LICENSE-2.0).

## Documentation

Expand Down
15 changes: 15 additions & 0 deletions composer-7.4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "stfc-egi/gocdb",
"description": "A web portal and REST style API for e-Infrastructure topology managment",
"require": {
"doctrine/orm": "2.6.*"
},
"require-dev": {
"phpunit/phpunit": "4.8.*",
"phpunit/dbunit": ">=1.2",
"phpmd/phpmd": "^2.13",
"squizlabs/php_codesniffer": "^3.7",
"taq/pdooci": "^1.0"

}
}
Loading

0 comments on commit 37c788d

Please sign in to comment.