You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-93Lines changed: 17 additions & 93 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -139,107 +139,31 @@ Note that term redirect rules are case sensitive.
139
139
Since these are `regex` entries, and could affect multiple projects, we prefer that OBO admins are the only ones to edit `obo.yml`. If you need a change to the term redirect entry for your project, please [create a new issue](https://github.com/OBOFoundry/purl.obolibrary.org/issues/new).
140
140
141
141
142
-
## Development and Testing
142
+
## Testing and Deployment
143
143
144
-
The PURL system runs on Ubuntu Linux, but you can test your changes using a virtual machine (VM) that runs on Windows, Mac, or Linux. Your local development machine (Windows, Mac, or Linux) will be the "host" machine. The VM will be a copy of Ubuntu Linux that runs on your host, and can be thrown away when you're done testing.
144
+
We use Docker to test the PURL system locally and deploy it. See the [docker/](https://github.com/OBOFoundry/purl.obolibrary.org/tree/master/docker) directory for code and documentation. Test the system locally like so:
145
145
146
-
You'll have to install these three tools on your host machine:
147
-
148
-
1.[VirtualBox](https://www.virtualbox.org) to run the VM
149
-
2.[Vagrant](https://www.vagrantup.com) to setting up the VM
150
-
3.[Ansible](https://) to provisioning the VM with the right software
151
-
152
-
All of these tools are free for you to use. If you're using macOS with [Homebrew](http://brew.sh), then you can install the three tools like this:
153
-
154
-
brew install --cask Caskroom/cask/vagrant
155
-
brew install --cask Caskroom/cask/virtualbox
156
-
brew install ansible
157
-
158
-
Once the three tools are installed, check out a copy of this repository and start the VM:
1. download an Ubuntu Linux virtual machine (using Vagrant and the `tools/Vagrantfile`)
167
-
2. run it (using VirtualBox)
168
-
3. configure it as a web server (using Ansible and the `tools/site.yml` file)
169
-
170
-
If something goes wrong with step 3, the `vagrant provision` command will run Ansible again. Please [report any issues](https://github.com/OBOFoundry/purl.obolibrary.org/issues) that you run into.
171
-
172
-
Use your favourite text editor on your host machine to make your changes to the files in the `purl.obolibrary.org` directory. That directory will be synchronized with the `/var/www/purl.obolibrary.org` directory inside the VM. When you're ready to test your changes, log in to the VM and rebuild the `.htaccess` files:
173
-
174
-
vagrant ssh
175
-
cd /var/www/purl.obolibrary.org
176
-
make clean all
177
-
178
-
You can use the web browser on the host machine to see the results, using URLs starting with `http://172.16.100.10/obo/`, such as [`http://172.16.100.10/obo/OBI_0000070`](http://172.16.100.10/obo/OBI_0000070). You can also run an automated tests. To check a single `config/foo.yml` configuration file, run one of these commands
$ docker run --rm -it -v "$(pwd)/config":/var/www/purl.obolibrary.org/config purl bash
150
+
# sudo su
151
+
# cd /var/www/purl.obolibrary.org
152
+
# make clean all test
153
+
```
182
154
183
-
To update and test the whole system, run
155
+
To check a single `config/foo.yml` configuration file, run one of these commands
184
156
185
-
make clean all test
157
+
```console
158
+
# make clean validate-foo
159
+
# make clean build-foo
160
+
```
186
161
187
162
Detailed test results will be listed in `tests/development/*.tsv` files, with their expected and actual values. If you're making changes to the project tools, you can test them against the `tools/examples/` files with:
188
163
189
-
make clean test-examples
190
-
191
-
Expert users who have to run more extensive tests can consider (temporarily) modifying their `hosts` file to redirect `purl.obolibrary.org` to the test server.
192
-
193
-
When you're done with the VM, log out with `exit`. Then you can choose to suspend the VM with
194
-
195
-
vagrant suspend
196
-
197
-
or delete the VM with
198
-
199
-
vagrant destroy
200
-
201
-
You can test against the production PURL server using `make test-production`. We only make one request per second, to avoid abusing the server, so this can take along time.
202
-
203
-
### Optional: Sync VirtualBox Guest Additions
204
-
205
-
If you keep your development VM for any length of time you may be presented with this message upon starting your VM:
206
-
```
207
-
==> default: A newer version of the box 'ubuntu/trusty64' is available! You currently
208
-
==> default: have version '20190122.1.1'. The latest is version '20190206.0.0'. Run
209
-
==> default: `vagrant box update` to update.
210
-
```
211
-
If you upgrade, then the next time you resume your box you may receive the warning:
164
+
```console
165
+
# make clean test-examples
212
166
```
213
-
[default] The guest additions on this VM do not match the install version of
214
-
VirtualBox! This may cause things such as forwarded ports, shared
215
-
folders, and more to not work properly. If any of those things fail on
216
-
this machine, please update the guest additions and repackage the
217
-
box.
218
-
```
219
-
220
-
To automatically sync with VirtualBox's Guest Additions at startup (and thus avoid this warning) you can install `vagrant-vbguest` like so:
221
-
222
-
-`vagrant plugin install vagrant-vbguest` (in the tools directory on the host machine)
223
-
224
-
Now, whenever you bring up your VM, it will check the version of the VM's guest additions and automatically bring them up to date whenever this is needed.
225
-
226
-
227
-
## Deployment
228
-
229
-
Deployment is automated using [Ansible](http://ansible.com), and targets a stock Ubuntu Linux server with Python installed. You should install on a **fresh** server, not one that's running other applications, unless you **really** know what you're doing.
230
-
231
-
Install Ansible on your **local** machine, add the IP address or hostname of your **target** server to `tools/hosts`, then run:
232
-
233
-
cd tools
234
-
ansible-playbook -i hosts site.yml
235
-
236
-
Ansible uses SSH to connect to the target server an execute the tasks defined in [`tools/site.yml`](tools/site.yml). If you have trouble connecting, you may have to adjust your SSH configuration to be more automatic, say by editing your `.ssh/config`.
237
-
238
-
You can re-run Ansible as you make changes. Once the system is running, it will fetch changes from the master Git repository every 10 minutes. From your local machine, you can test all URLs against any target server, e.g.:
239
-
240
-
export PRODUCTION=url.ontodev.org; make clean test-production
241
-
242
-
The `make safe-update` task will check [Travis-CI](https://travis-ci.org/OBOFoundry/purl.obolibrary.org) to ensure that the latest build on the master branch passed all automated tests, and that it is newer than the last time `safe-update` completed. Then it will pull from the Git repository and rebuild the site. This *should* be safe for a `cron` task to synchronize PURLs with the repository.
0 commit comments