@@ -65,8 +65,80 @@ Assets are compiled using Webpack Encore. The compiled assets **must** be commit
6565
6666## Installing using Docker
6767
68- _ A new Docker image needs to be created following the move to Wikimedia VPS._
69- _ You can use the manual installation instructions above in the meantime._
68+ Development through Docker is suggested if you have a different version of PHP locally
69+ installed, or if you wish to keep an isolated installation of PHP 8.2 for CopyPatrol.
70+
71+ 1 . Copy [ .env] ( .env ) to [ .env.local] ( .env.local ) and fill in the appropriate details.
72+ 1 . Set ` REPLICAS_HOST_* ` and ` TROVE_HOST ` to ` 127.0.0.1 `
73+ 2 . Use the credentials in your ` replica.my.cnf ` file in the home directory of your
74+ Toolforge account for ` REPLICAS_USERNAME ` and ` REPLICAS_PASSWORD ` .
75+ 3 . Set the rest of the ` TROVE_* ` variables to that of the installation of the CopyPatrol
76+ database (` COPYPATROL_DB_NAME ` ).
77+ 4 . If you need to test OAuth, obtain tokens by registering a new consumer on Meta at
78+ [ Special: OAuthConsumerRegistration ] ( https://meta.wikimedia.org/wiki/Special:OAuthConsumerRegistration ) .
79+ Alternatively, you can set ` LOGGED_IN_USER ` to any value to simulate being that user
80+ after clicking on 'Login'.
81+ 5 . If you need to test the "iThenticate report" functionality, set ` TCA_DOMAIN ` and ` TCA_KEY ` .
82+ Reports older than ` AppController::ITHENTICATE_V2_TIMESTAMP ` need to connect to the older
83+ iThenticate API, using the credentials set by ` ITHENTICATE_USERNAME ` and ` ITHENTICATE_PASSWORD ` .
84+ 2 . Build the development image once and install Composer dependencies with the following
85+ ``` bash
86+ docker compose build
87+ # On Windows, use `%CD%` instead of `$(pwd)`.
88+ docker run --rm -ti -v $( pwd) :/app wikimedia/copypatrol:development composer install
89+ ```
90+ Run the second command again every time you change ` composer.json ` , or when ` composer.json `
91+ is changed in an upstream commit. This can take a while on Windows.
92+ 3 . (* Windows only* ) Set the ` HOME ` environment variable to your user profile directory.
93+ ``` cmd
94+ setx HOME %UserProfile%
95+ set HOME=%UserProfile%
96+ ```
97+ The first command sets ` HOME ` for future shells. The second command sets ` HOME ` for the current shell.
98+ 4 . Open a new terminal and start the development container with
99+ ``` bash
100+ docker compose up
101+ ```
102+ Starting the local development server will be delayed until the next
103+ step is finished.
104+ 5 . Open up an SSH tunnel to access the databases on Toolforge.
105+ ``` bash
106+ # Your SSH config at $HOME/.ssh will be mounted into the container.
107+ # Your passphrase will be requested if your private key is protected.
108+ # If your Toolforge shell name is different from the default, append
109+ # your shell name after "ssh". (e.g. `... start ssh exampleuser`)
110+ docker compose exec copypatrol start ssh
111+ ```
112+ This terminal will stay open as long as SSH is connected. No successful
113+ connection message is shown, but Symfony will start immediately once the
114+ ports are open. This extra step is required for you to be able to enter
115+ your SSH key password through a TTY.
116+
117+ Changes to this folder will automatically be applied to the running Docker container. This includes
118+ changes to ` src ` files, ` .env.local ` , etc. XDebug is set up to connect to the host machine
119+ (the computer running the Docker container) on port 9003 upon request ([ more info] ( https://xdebug.org/docs/step_debug ) ).
120+
121+ If the Trove host changes, you must set the ` TROVE_HOST ` environment variable to the correct host.
122+ Review [ OpenStack browser] ( https://openstack-browser.toolforge.org/project/copypatrol/database/copypatrol-dev-db-01 ) for
123+ the latest host.
124+
125+ An XDebug configuration is provided by default. To customize this config, mount a
126+ ` xdebug.ini ` file to ` /usr/local/etc/php/conf.d/xdebug.ini ` in the container.
127+
128+ <details >
129+ <summary >Production image</summary >
130+
131+ A production image can be built with the following command:
132+ ``` bash
133+ docker build -t wikimedia/copypatrol:latest -f docker/Dockerfile .
134+ ```
135+ This image does not contain XDebug or OpenSSH, and does not have an SSH tunnel to Toolforge.
136+ You can test it out by running the following command:
137+ ``` bash
138+ # On Windows, use `%CD%` instead of `$(pwd)`.
139+ docker run -ti --rm -p 8000:8000 wikimedia/copypatrol:latest
140+ ```
141+ </details >
70142
71143## Adding new languages
72144
0 commit comments