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