1 # Checking Out the Code and Installing Required Applications
3 The instructions assume you're using Mac OS X as the host server and installing this application at `/Volumes/Data/perf.webkit.org`.
5 You can choose between using Server.app or install the required tools separately
7 1. Install Server.app (if you don't want to use Server.app, install PostgreSQL: http://www.postgresql.org/download/macosx/)
9 3. Install Xcode with command line tools (only needed for svn)
10 4. `svn co https://svn.webkit.org/repository/webkit/trunk/Websites/perf.webkit.org /Volumes/Data/perf.webkit.org`
11 5. Inside `/Volumes/Data/perf.webkit.org`, run `npm install pg` and `mkdir -m 755 public/data/`
13 # Testing Local UI Changes with Production Data
15 The front end has the capability to pull data from a production server without replicating the database locally on OS X (Yosemite and later).
16 To use this feature, modify `config.json`'s `remoteServer` entry so that "remoteServer.url" points to your production server,
17 and "remoteServer.basicAuth" specifies the username and the password that is used by the production sever.
19 Remove "basicAuth" entry for production servers that doesn't require a basic authentication (e.g. perf.webkit.org).
23 "url": "http://perf.webkit.org",
25 "username": "webkitten",
26 "password": "webkitten's secret password"
31 Then run `tools/run-with-remote-server.py`. This launches a httpd server on port 8080.
33 The initial few page loads after starting the script could take as much as a few minutes depending on your production sever's configurations
34 since Apache needs to start a pool of processes. Reloading the dashboards few times should bring the load time under control.
36 The script caches remote server's responses under `public/data/remote-cache` and never revalidates them (to allow offline work).
37 If you needed the latest content, delete caches stored in this directory by running `rm -rf public/data/remote-cache`.
42 ## Instructions if you're using Server.app
44 - Enable PHP web applications
45 - Go to Server Website / Store Site Files In, change it to `/Volumes/Data/perf.webkit.org/public/`
46 - Go to Server Website / Edit advanced settings, enable Allow overrides using .htaccess files
47 - httpd config file is located at `/Library/Server/Web/Config/apache2/sites/0000_any_80.conf` (and/or 0000_any_`PORT#`.conf)
49 ## Instructions if you're not using Server.app
51 - Edit /private/etc/apache2/httpd.conf
53 1. Change DocumentRoot to `/Volumes/Data/perf.webkit.org/public/`
54 2. Uncomment `LoadModule php5_module libexec/apache2/libphp5.so`
55 3. Uncomment `LoadModule rewrite_module libexec/apache2/mod_rewrite.so`
56 4. Uncomment `LoadModule deflate_module libexec/apache2/mod_deflate.so`
58 - In Mavericks and later, copy php.ini to load pdo_pgsql.so pgsql.so.
59 `sudo cp /Applications/Server.app/Contents/ServerRoot/etc/php.ini /etc/`
60 - In El Capitan and later, comment out the `LockFile` directive in `/private/etc/apache2/extra/httpd-mpm.conf`
61 since the directive has been superseded by `Mutex` directive.
65 You can use apachectl to start/stop/restart apache server from the command line:
67 - Starting httpd: `sudo apachectl start`
68 - Stopping httpd: `sudo apachectl stop`
69 - Restarting httpd: `sudo apachectl restart`
71 The apache logs are located at `/private/var/log/apache2`.
73 ## Production Configurations
75 1. Update ServerAdmin to your email address
76 2. Add the following directives to enable gzip:
78 <IfModule mod_deflate.c>
79 AddOutputFilterByType DEFLATE text/html text/xml text/plain application/json application/xml application/xhtml+xml
82 3. Add the following directives to enable zlib compression and MultiViews on DocumentRoot (perf.webkit.org/public):
84 Options Indexes MultiViews
85 php_flag zlib.output_compression on
87 ### Protecting the Administrative Pages to Prevent Execution of Arbitrary Code
89 By default, the application gives the administrative privilege to everyone. Anyone can add, remove, or edit tests,
90 builders, and other entities in the database.
92 We recommend protection via Digest Auth on https connection.
94 Generate a password file via `htdigest -c <path> <realm> <username>`, and then create admin/.htaccess with the following directives
95 where `<Realm>` is replaced with the realm of your choice, which will be displayed on the username/password input box:
100 AuthDigestProvider file
101 AuthUserFile "<Realm>"
105 # Configuring PostgreSQL
107 Run the following command to setup a Postgres server at `/Volumes/Data/perf.webkit.org/PostgresSQL` (or wherever you'd prefer):
108 `python ./setup-database.py /Volumes/Data/perf.webkit.org/PostgresSQL`
110 It automatically retrieves the database name, the username, and the password from `config.json`.
112 ## Starting PostgreSQL
114 The setup script automatically starts the database but you may need to run the following command to manually start the database after reboot.
116 - Starting the database: `/Applications/Server.app/Contents/ServerRoot/usr/bin/pg_ctl -D /Volumes/Data/perf.webkit.org/PostgresSQL -l /Volumes/Data/perf.webkit.org/PostgresSQL/logfile -o "-k /Volumes/Data/perf.webkit.org/PostgresSQL" start`
117 - Stopping the database: `/Applications/Server.app/Contents/ServerRoot/usr/bin/pg_ctl -D /Volumes/Data/perf.webkit.org/PostgresSQL -l /Volumes/Data/perf.webkit.org/PostgresSQL/logfile -o "-k /Volumes/Data/perf.webkit.org/PostgresSQL" start`
119 ## Initializing the Database
121 Run `database/init-database.sql` in psql as `webkit-perf-db-user`:
122 `/Applications/Server.app/Contents/ServerRoot/usr/bin/psql webkit-perf-db -h localhost --username webkit-perf-db-user -f init-database.sql`
124 ## Making a Backup and Restoring
126 - Backing up the database: `/Applications/Server.app/Contents/ServerRoot/usr/bin/pg_dump -h localhost --no-owner -f <filepath> webkit-perf-db | gzip > backup.gz`
127 - Restoring the database: `gunzip -c backup.gz | /Applications/Server.app/Contents/ServerRoot/usr/bin/psql webkit-perf-db -h localhost --username webkit-perf-db-user`