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 You can use apachectl to start/stop/restart apache server from the command line:
44 - Starting httpd: `sudo apachectl start`
45 - Stopping httpd: `sudo apachectl stop`
46 - Restarting httpd: `sudo apachectl restart`
48 The apache logs are located at `/private/var/log/apache2`.
50 ## Instructions if you're using Server.app
52 - Enable PHP web applications
53 - Go to Server Website / Store Site Files In, change it to `/Volumes/Data/perf.webkit.org/public/`
54 - Go to Server Website / Edit advanced settings, enable Allow overrides using .htaccess files
55 - httpd config file is located at `/Library/Server/Web/Config/apache2/sites/0000_any_80.conf` (and/or 0000_any_`PORT#`.conf)
57 ## Instructions if you're not using Server.app
59 - Edit /private/etc/apache2/httpd.conf
61 1. Change DocumentRoot to `/Volumes/Data/perf.webkit.org/public/`
62 2. Uncomment `LoadModule php5_module libexec/apache2/libphp5.so`
63 3. Uncomment `LoadModule rewrite_module libexec/apache2/mod_rewrite.so`
64 4. Uncomment `LoadModule deflate_module libexec/apache2/mod_deflate.so`
66 - In Mavericks and later, copy php.ini to load pdo_pgsql.so pgsql.so.
67 `sudo cp /Applications/Server.app/Contents/ServerRoot/etc/php.ini /etc/`
68 - In El Capitan and later, comment out the `LockFile` directive in `/private/etc/apache2/extra/httpd-mpm.conf`
69 since the directive has been superseded by `Mutex` directive.
71 ## Production Configurations
73 1. Update ServerAdmin to your email address
74 2. Add the following directives to enable gzip:
76 <IfModule mod_deflate.c>
77 AddOutputFilterByType DEFLATE text/html text/xml text/plain application/json application/xml application/xhtml+xml
80 3. Add the following directives to enable zlib compression and MultiViews on DocumentRoot (perf.webkit.org/public):
82 Options Indexes MultiViews
83 php_flag zlib.output_compression on
85 ### Protecting the Administrative Pages to Prevent Execution of Arbitrary Code
87 By default, the application gives the administrative privilege to everyone. Anyone can add, remove, or edit tests,
88 builders, and other entities in the database.
90 We recommend protection via Digest Auth on https connection.
92 Generate a password file via `htdigest -c <path> <realm> <username>`, and then create admin/.htaccess with the following directives
93 where `<Realm>` is replaced with the realm of your choice, which will be displayed on the username/password input box:
98 AuthDigestProvider file
99 AuthUserFile "<Realm>"
103 # Configuring PostgreSQL
105 1. Create database: `/Applications/Server.app/Contents/ServerRoot/usr/bin/initdb /Volumes/Data/perf.webkit.org/PostgresSQL`
106 2. Start database: `/Applications/Server.app/Contents/ServerRoot/usr/bin/pg_ctl -D /Volumes/Data/perf.webkit.org/PostgresSQL -l logfile -o "-k /Volumes/Data/perf.webkit.org/PostgresSQL" start`
108 ## Creating a Database and a User
110 The binaries located in PostgreSQL's directory, or if you're using Server.app in /Applications/Server.app/Contents/ServerRoot/usr/bin/
112 1. Create a database: `/Applications/Server.app/Contents/ServerRoot/usr/bin/createdb webkit-perf-db -h localhost`
113 2. Create a user: `/Applications/Server.app/Contents/ServerRoot/usr/bin/createuser -P -S -e webkit-perf-db-user -h localhost`
114 3. Connect to database: `/Applications/Server.app/Contents/ServerRoot/usr/bin/psql webkit-perf-db -h localhost`
115 4. Grant all permissions to the new user: `grant all privileges on database "webkit-perf-db" to "webkit-perf-db-user";`
116 5. Update database/config.json.
118 ## Initializing the Database
120 Run `database/init-database.sql` in psql as `webkit-perf-db-user`:
121 `/Applications/Server.app/Contents/ServerRoot/usr/bin/psql webkit-perf-db -h localhost --username webkit-perf-db-user -f init-database.sql`
123 ## Making a Backup and Restoring
125 Run `/Applications/Server.app/Contents/ServerRoot/usr/bin/pg_dump -h localhost --no-owner -f <filepath> webkit-perf-db | gzip > backup.gz`
127 To restore, setup a new database and run
128 `gunzip backup.gz | /Applications/Server.app/Contents/ServerRoot/usr/bin/psql webkit-perf-db -h localhost --username webkit-perf-db-user`