Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

ISAICP-5825: Introduce Toolkit #2113

Merged
merged 38 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
fd24265
ISAICP-5825: Remove stale 'setup-acceptance' Phing target.
claudiu-cristea Apr 25, 2020
fb96297
ISAICP-5825: Remove stale deploy scripts.
claudiu-cristea Apr 25, 2020
f6248ec
ISAICP-5825: Fix the project's namespace.
claudiu-cristea Apr 25, 2020
51869b8
ISAICP-5825: Bring Toolkit and Task Runner patches.
claudiu-cristea Apr 25, 2020
634293b
ISAICP-5825: Ignore local files.
claudiu-cristea Apr 25, 2020
4bfff11
ISAICP-5825: Provide Joinup specific configuration.
claudiu-cristea Apr 25, 2020
9a57f24
ISAICP-5825: Convert all Solr commands (except configure-apache-solr-…
claudiu-cristea Apr 25, 2020
4ad71ae
ISAICP-5825: Covert MySQL manipulation commands.
claudiu-cristea Apr 25, 2020
e74098e
ISAICP-5825: Convert Virtuoso commands.
claudiu-cristea Apr 25, 2020
9c03348
ISAICP-5825: Remove unused 'rebuild-dev' Phing target.
claudiu-cristea Apr 25, 2020
793a0fb
ISAICP-5825: Convert environment rebuild commands.
claudiu-cristea Apr 25, 2020
f88f0ad
ISAICP-5825: Adapt and/or remove stale Phing properties.
claudiu-cristea Apr 25, 2020
9781671
ISAICP-5825: Make developer aware about command replacements.
claudiu-cristea Apr 25, 2020
d4ccb10
ISAICP-5825: Document which & how environment variables should be set.
claudiu-cristea Apr 25, 2020
c67fe63
ISAICP-5825: Adapt documentation.
claudiu-cristea Apr 25, 2020
1d092a6
ISAICP-5825: Cleanup build.continuousphp.xml.
claudiu-cristea Apr 25, 2020
864efca
ISAICP-5825: Merge build.dist.xml, build.properties.dist into build.p…
claudiu-cristea Apr 25, 2020
9f281aa
ISAICP-5825: EchoTask already overrides an existing file.
claudiu-cristea Apr 26, 2020
7a506b5
ISAICP-5825: file_put_contents() already overrides an existing file.
claudiu-cristea Apr 26, 2020
f49de7e
ISAICP-5825: Drop 'truncate-cache-tables' Phing target. They are not …
claudiu-cristea Apr 28, 2020
f6e91c3
ISAICP-5825: Drop the 'setmysqlautoincrement' task. It's a migration …
claudiu-cristea May 4, 2020
9ef95c2
ISAICP-5825: Drop 'install-composer-dependencies-dist' Phint target a…
claudiu-cristea May 4, 2020
d33143a
ISAICP-5825: Composer install shouldn't be part of 'build-dev'.
claudiu-cristea May 4, 2020
d25e1c0
ISAICP-5825: Remove duplicated Phing targets.
claudiu-cristea May 4, 2020
8b94165
ISAICP-5825: Remove the unused 'enable-uat-modules' Phing target.
claudiu-cristea May 5, 2020
4f51e8c
ISAICP-5825: Typo.
claudiu-cristea May 5, 2020
f72b5e0
ISAICP-5825: Remove the heavyweight proprietary ECAS mock server Phin…
claudiu-cristea May 5, 2020
7a14afa
ISAICP-5825: Remove unused Stage File Proxy targets.
claudiu-cristea May 5, 2020
988b17a
ISAICP-5825: Remove the 'clear-cache' Phing target. Use directly the …
claudiu-cristea May 5, 2020
e8e3829
Merge remote-tracking branch 'origin/develop' into ISAICP-5825
claudiu-cristea May 7, 2020
3e67302
ISAICP-5825: Maintain alphabetical ordering.
pfrenssen May 12, 2020
81335cd
ISAICP-5825: Target has not technically been removed.
pfrenssen May 12, 2020
61455b0
ISAICP-5825: Remove obsolete file documentation.
pfrenssen May 13, 2020
db19975
ISAICP-5825: Update documentation.
pfrenssen May 13, 2020
c5332c1
ISAICP-5825: Update documentation.
pfrenssen May 13, 2020
7c6be27
ISAICP-5825: Fix QA remarks.
claudiu-cristea May 13, 2020
acd86cd
Merge remote-tracking branch 'origin/develop' into ISAICP-5825
claudiu-cristea May 13, 2020
0d3cb40
Merge remote-tracking branch 'origin/develop' into ISAICP-5825
pfrenssen May 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
/tests/behat.yml
/phpunit.xml
/web/sites/default/services.yml
/grumphp.yml
/runner.yml
/local.env

# Ignore compiled CSS.
/web/themes/joinup/css
Expand Down
10 changes: 10 additions & 0 deletions .opts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
upgrade_commands:
default:
- ${drush.bin} state:set system.maintenance_mode 1 --input-format=integer --yes
- ${phing.bin} disable-config-read-only
- ${phing.bin} redis-flush
- ${drush.bin} updatedb --no-post-updates --yes
- ${drush.bin} config:import --yes
- ${drush.bin} updatedb --yes
- ${phing.bin} enable-config-read-only
- ${drush.bin} state:set system.maintenance_mode 0 --input-format=integer --yes
37 changes: 19 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ run the Behat test, please refer directly to the documention of
folder `./vendor/apache/solr`.

```
$ ./vendor/bin/phing setup-apache-solr
$ ./vendor/bin/run solr:setup
```

* Install Virtuoso. For basic instructions, see [setting up
Expand Down Expand Up @@ -106,41 +106,29 @@ using your favourite text editor:
$ vim build.properties.local
```

This file will contain configuration which is unique to your development
This file will contain the configuration which is unique to your development
machine. This is mainly useful for specifying your database credentials and the
username and password of the Drupal admin user so they can be used during the
username and password of the Drupal admin user, so they can be used during the
installation.

Because these settings are personal they should not be shared with the rest of
the team. Make sure you never commit this file!

All options you can use can be found in the `build.properties.dist` file. Just
copy the lines you want to override and change their values. Do not copy the
entire `build.properties.dist` file, since this would override all options.
All options you can use can be found in the `build.properties` file. Just copy
the lines you want to override and change their values. Do not copy the entire
`build.properties` file, since this would override all options.

Example `build.properties.local`:

```
# The location of the Composer binary.
composer.bin = /usr/bin/composer

# The location of the Virtuoso console (Debian / Ubuntu).
isql.bin = /usr/bin/virtuoso-isql
# The location of the Virtuoso console (Arch Linux).
isql.bin = /usr/bin/virtuoso-isql
# The location of the Virtuoso console (Redhat / Fedora / OSX with Homebrew).
isql.bin = /usr/local/bin/isql

# SQL database settings.
drupal.db.name = my_database
drupal.db.user = root
drupal.db.password = hunter2

# SPARQL database settings.
sparql.dsn = localhost
sparql.user = my_username
sparql.password = qwerty123

# Admin user.
drupal.admin.username = admin
drupal.admin.password = admin
Expand All @@ -152,6 +140,19 @@ drupal.base_url = http://joinup.local
drush.verbose = yes
```

#### Create a local task runner configuration file

In order to override any configuration of the task runner (`./vendor/bin/run`),
create a `runner.yml` file in the project's top directory. You can override
there any default runner configuration, or any other declared in `./runner`
files or in `runner.yml.dist`. Note that the `runner.yml` file is not under VCS
control.

#### Setup environment variables

Sensitive data will be stored in [environment variables](
https://en.wikipedia.org/wiki/Environment_variable). See `local.env.dist` for
details.

#### Build the project

Expand Down
69 changes: 8 additions & 61 deletions build.continuousphp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,20 @@

<project name="ContinuousPHP" default="help">

<echo msg="Loading AWS additional tasks." />
<import file="./vendor/continuousphp/aws-sdk-phing/tasks.xml" />
<property name="aws.profile" value="" />

<echo msg="Turn environment variable into a phing property" />
<taskdef name="env2property" classname="\DrupalProject\Phing\EnvironmentVarAsProperty" />

<echo msg="Loading infra additional tasks." />
<import file="./vendor/ec-europa/infra/infra.xml" />

<!-- Run Behat tests. -->
<!-- Use this target to run tests with increased verbosity on ContinuousPHP to help debugging. -->
<target name="run-behat-tests" description="Run Behat tests.">
<behat
executable="${behat.bin}"
config="${behat.yml.path}"
strict="${behat.options.strict}"
verbose="${behat.options.verbosity}"
/>
</target>

<target name="setup-continuousphp"
depends="check-continuousphp">
<target name="setup-continuousphp" depends="check-continuousphp">
<echo msg="Set the virtuoso checkpoint to -1. Do not use a checkpoint for CPHP testing."/>
<phingcall target="set-virtuoso-checkpoint">
<property name="interval" value="-1"/>
</phingcall>
<echo message="Put the odbc configuration file in the home folder where CPHP can find it" />
<copy
file="./vendor/ec-europa/infra/continuousphp/odbc.ini"
tofile="${user.home}/.odbc.ini"
overwrite="true" />

<echo message="Create Solr index" />
<exec dir="${project.basedir}"
command="sudo curl -o /opt/solr/search_api_solr.tar.gz https://ftp.drupal.org/files/projects/search_api_solr-8.x-1.0-alpha4.tar.gz;
sudo tar xvzf /opt/solr/search_api_solr.tar.gz -C /opt/solr;
sudo /opt/solr/bin/solr create_core -c drupal_published;
sudo mkdir /opt/solr/server/solr/drupal_published;
sudo rsync -avz /opt/solr/search_api_solr/solr-conf/6.x/ /opt/solr/server/solr/drupal_published/conf/;
sudo /opt/solr/bin/solr create_core -c drupal_unpublished;
sudo mkdir /opt/solr/server/solr/drupal_unpublished;
sudo rsync -avz /opt/solr/search_api_solr/solr-conf/6.x/ /opt/solr/server/solr/drupal_unpublished/conf/"
checkreturn="true"
passthru="true" />
<echo message="Report Solr status" />
<exec dir="${project.basedir}"
command="sudo /opt/solr/bin/solr status"
command="sudo chmod -R 777 /opt/solr > /dev/null;
/opt/solr/bin/solr create_core -c drupal_published -d ${project.basedir}/web/modules/contrib/search_api_solr/solr-conf/6.x/;
/opt/solr/bin/solr create_core -c drupal_unpublished -d ${project.basedir}/web/modules/contrib/search_api_solr/solr-conf/6.x/"
checkreturn="true"
passthru="true" />
<echo message="Restart Solr" />
<exec dir="${project.basedir}"
command="sudo /opt/solr/bin/solr restart"
checkreturn="true"
passthru="true"
spawn="true" />
<symlink link="${project.basedir}/vendor/bin/solr" target="/opt/solr/bin/solr"/>
</target>

<target name="check-continuousphp">
Expand All @@ -71,15 +30,7 @@ sudo rsync -avz /opt/solr/search_api_solr/solr-conf/6.x/ /opt/solr/server/solr/d
</if>
</target>

<target name="build-continuousphp" >
<!-- Set environment variables as extra properties through cloudformation -->
<env2property prefix="cphp" phingproperty="cloudformation.properties" />
<echo message="Copy CPHP pipeline variables to local properties file" />
<echoproperties prefix="cphp." destfile="build.properties.local" />
<exec dir="${project.basedir}"
command="sed -i 's/^cphp\.//' build.properties.local"
checkreturn="true"
passthru="true" />
<target name="build-continuousphp" depends="check-continuousphp">
<echo message="Create the Behat configuration files to run in parallel." />
<phingcall target="setup-behat">
<property name="behat.yml.path" value="${behat.dir}/behat-only-selenium-cphp.yml" />
Expand All @@ -97,12 +48,8 @@ sudo rsync -avz /opt/solr/search_api_solr/solr-conf/6.x/ /opt/solr/server/solr/d
<property name="behat.yml.path" value="${behat.dir}/behat-remainder-cphp.yml" />
<property name="behat.yml.template" value="${behat.dir}/behat-remainder-cphp.yml.dist" />
</phingcall>
</target>

<!-- provision new demo/test stack on AWS -->
<target name="provision-stack"
description="Provision a stack on AWS"
depends="setup-aws, run-stack, setup-deployment-group" />
</target>

<!-- Sleeps to allow services to get up and be ready -->
<target name="sleep">
Expand Down
149 changes: 149 additions & 0 deletions build.converted.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8" ?>

<project name="Joinup deprecated" default="help">

<target name="runner-converted" hidden="true">
<fail message="Removed target. Run './vendor/bin/run ${runner.replacement}'"/>
</target>

<!-- Download & restore -->

<target name="download-databases">
<phingcall target="runner-converted">
<property name="runner.replacement" value="dev:download-databases"/>
</phingcall>
</target>

<target name="restore-databases">
<phingcall target="runner-converted">
<property name="runner.replacement" value="dev:restore-databases"/>
</phingcall>
</target>

<target name="execute-updates">
<phingcall target="runner-converted">
<property name="runner.replacement" value="toolkit:run-deploy"/>
</phingcall>
</target>

<target name="rebuild-environment">
<phingcall target="runner-converted">
<property name="runner.replacement" value="dev:rebuild-environment"/>
</phingcall>
</target>

<!-- MySQL -->

<target name="download-sql-database">
<phingcall target="runner-converted">
<property name="runner.replacement" value="mysql:download-dump"/>
</phingcall>
</target>

<target name="restore-mysql-dump">
<phingcall target="runner-converted">
<property name="runner.replacement" value="mysql:restore"/>
</phingcall>
</target>

<!-- Virtuoso -->

<target name="download-virtuoso-database">
<phingcall target="runner-converted">
<property name="runner.replacement" value="virtuoso:download-snapshot"/>
</phingcall>
</target>

<target name="virtuoso-restore-backup">
<phingcall target="runner-converted">
<property name="runner.replacement" value="virtuoso:restore"/>
</phingcall>
</target>

<target name="virtuoso-start">
<phingcall target="runner-converted">
<property name="runner.replacement" value="virtuoso:start"/>
</phingcall>
</target>

<target name="virtuoso-stop">
<phingcall target="runner-converted">
<property name="runner.replacement" value="virtuoso:stop"/>
</phingcall>
</target>

<target name="virtuoso-setup">
<phingcall target="runner-converted">
<property name="runner.replacement" value="virtuoso:setup"/>
</phingcall>
</target>

<!-- Solr -->

<target name="start-apache-solr">
<phingcall target="runner-converted">
<property name="runner.replacement" value="solr:start"/>
</phingcall>
</target>

<target name="stop-apache-solr">
<phingcall target="runner-converted">
<property name="runner.replacement" value="solr:stop"/>
</phingcall>
</target>

<target name="restart-apache-solr">
<phingcall target="runner-converted">
<property name="runner.replacement" value="solr:restart"/>
</phingcall>
</target>

<target name="download-apache-solr-snapshot">
<phingcall target="runner-converted">
<property name="runner.replacement" value="solr:download-snapshot"/>
</phingcall>
</target>

<target name="backup-apache-solr">
<phingcall target="runner-converted">
<property name="runner.replacement" value="solr:backup"/>
</phingcall>
</target>

<target name="restore-apache-solr">
<phingcall target="runner-converted">
<property name="runner.replacement" value="solr:restore"/>
</phingcall>
</target>

<target name="purge-solr-backend">
<phingcall target="runner-converted">
<property name="runner.replacement" value="solr:empty"/>
</phingcall>
</target>

<target name="download-apache-solr">
<phingcall target="runner-converted">
<property name="runner.replacement" value="solr:download-bin"/>
</phingcall>
</target>

<target name="configure-apache-solr">
<phingcall target="runner-converted">
<property name="runner.replacement" value="solr:config"/>
</phingcall>
</target>

<target name="setup-apache-solr">
<phingcall target="runner-converted">
<property name="runner.replacement" value="solr:setup"/>
</phingcall>
</target>

<target name="reindex-apache-solr">
<phingcall target="runner-converted">
<property name="runner.replacement" value="solr:reindex"/>
</phingcall>
</target>

</project>
Loading