Installation Instructions

DarkstarDev edited this page Apr 6, 2012 · 2 revisions

This page will walk you through how to get your woot-off checker up and running. Compiling and configuring dependencies is outside the scope of this document, though it may be glossed over.

Installation

  1. Create a database.

    • This application was created using MySQL 5.1. If you choose to use any other type of database you will need to make changes to application/configs/application.ini and may need to modify the queries in library/Ds/Service/WootFeed/DbDao.php.
  2. Modify application/configs/application.ini.

    • You will need to configure the application with your database server, database name, username and password in order for the application to save and retrieve data. Additionally, you must configure the socketServer.url. This is the URL you will access node.js from. Unless you set up your web server to act as a proxy for node, you cannot use port 80. You also may not use localhost here as this parameter is used by the browser to know what remote server to connect to. We will configure Node.js later. NOTE: mod_proxy doesn't play nice with websockets
  3. Import the database schema.

    • A database schema has been provided in sql/RUNONCE.sql. Using your favorite MySQL client connect to the database and run the SQL script. This will create four tables (history, item, product, and status). The status table will be the only table with data. It contains the application lock status on a per-woot-site basis.
  4. Set up your web server.

    • Your web server will need to point to public/ as the document root. DO NOT use other directory as the document root. If you're using Apache, a .htaccess file has been placed in public/ for your convenience, however it is set up in development mode. To disable display of application errors that may contain potentially sensitive data you will need to change SetEnv APPLICATION_ENV development to SetEnv APPLICATION_ENV production
  5. Set document root permissions

    • Changing the group ownership of the document root will ensure the web server is able to read and serve the files. Additionally, the public/images/products/ directory must be writeable by the web server in order to store product images. In short, chown -R :web-user-here public/ and chmod 0775 public/images/products/. The former may require privilege elevation. DO NOT just set 777 on public/ or public/images/products/ as a shortcut. It's unsafe.
  6. Configure and compile Node.js

    • You may need to install some dependencies like the openssl development library. Installing dependencies is outside the scope of this document, however. Basically, just cd externals/node/, ./configure, make and make install. The last command may require privilege elevation, with the default configuration. Use ./configure --help if you need assistance configuring your Node.js installation.
  7. Install Socket.io

    • You will need to install socket.io for the site to work. This step is rather easy, just npm install socket.io.
  8. Configure socketserver.js

    • This file contains four variables at the top that are used to configure the call the daemon makes to the site as well as what port to listen on. This should be sufficient for most cases. Modify anything else in the daemon at your own risk.
      • siteHost is the IP or fully qualified domain name the website listens on. Although an FQDN is preferred (this will limit potential problems) this variable can be set to localhost if your web server is set up to route localhost requests to the dswoot application.
      • sitePort should be set to whatever port the website listens on (probably 80).
      • sitePath should be set to the subdirectory the site resides at (e.g. /subdirectory, note no trailing slash).
      • socketIOPort is the port the daemon will listen on (note: changing this will require changing application/configs/application.ini.
  9. Run socketserver.js as a background process

    • The node script needs to run in the background in order to listen for websocket requests from the browser. You can do this however you wish. One simple way is node socketserver.js > /dev/null &. You may also want to consider using Forever, which I understand will restart the process should it exit.
Clone this wiki locally
You can’t perform that action at this time.
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.
Press h to open a hovercard with more details.