| 1 | = Installing red = |
| 2 | |
| 3 | Reading overview.txt is a very good idea before trying to install. |
| 4 | |
| 5 | Note: This is not a turn key solution. It will require programming, etc to work properly. |
| 6 | |
| 7 | Red is designed to write to your computer's system files. Probably a good idea to get it up and running in a test environment with a test destination server that can be borked. Don't test on a live production server! |
| 8 | |
| 9 | == Requirements == |
| 10 | |
| 11 | * MySQL |
| 12 | * PHP |
| 13 | * Apache |
| 14 | |
| 15 | == Installation == |
| 16 | |
| 17 | === Database === |
| 18 | |
| 19 | * Database. Red only supports MySQL. To begin, create database (e.g. red) and import the tables.sql and data.sql files from the sql directory. You can safely ignore the remaining dated sql files - you will need to import them if you are upgrading, but not if you are installing from scratch. |
| 20 | |
| 21 | * Create a mysql user for the client program that has select, update, delete, and insert privileges (such as red-ui). |
| 22 | |
| 23 | {{{ |
| 24 | GRANT ALL ON red.* to 'red-ui'@'localhost' identified by 'secret'; |
| 25 | }}} |
| 26 | |
| 27 | * Create a mysql user (e.g. red-node) for the server program using the following grant statements (to limit access to the bare minimum). |
| 28 | |
| 29 | {{{ |
| 30 | GRANT SELECT ON red.* to 'red-node'@'server_domain' identified by 'secret'; |
| 31 | GRANT UPDATE ON red.red_item to 'red-node'@'server_domain'; |
| 32 | GRANT INSERT ON red.red_error_log to 'red-node'@'server_domain'; |
| 33 | }}} |
| 34 | |
| 35 | === UI === |
| 36 | |
| 37 | The ui directory contains all the files necessary for the web gui to work. |
| 38 | |
| 39 | * Copy the etc/config.inc.php.sample file to etc/config.inc.php and edit it. To begin with, set "notify" to false (because we haven't setup the server yet). Update with the details of the red-ui user account you created above. |
| 40 | |
| 41 | * In share/ihtml copy the .sample files to files without the .sample suffix. Edit if you want. |
| 42 | |
| 43 | * In ui/www copy the extra.css.sample to extra.css. Edit if you want. |
| 44 | |
| 45 | * Configure your web server so it can use the www directory in the ui folder as the DocumentRoot |
| 46 | |
| 47 | * Test the UI. Login with user admin and password admin23. You should be able to add new items, which will be in the status "pending-insert." |
| 48 | |
| 49 | === node === |
| 50 | |
| 51 | * Your node computer must be able to access the database on your UI. You may need to configure your MySQL server on the UI to listen on a network IP address. |
| 52 | |
| 53 | * You can checkout the red code anywhere you want, however, /usr/local/share/red is the canonical location. |
| 54 | |
| 55 | * You should create a /usr/local/etc/red directory as well and copy the contents of node/etc/red/ to this directory. |
| 56 | |
| 57 | * Configure. Enter the etc/red directory. Copy all *.sample files to the name without ".sample" |
| 58 | |
| 59 | Most files are configured to be used on a default debian configured system, so don't require additional editing. The red_node.conf is the only file that requires editing, and should be configured with the MySQL login details for the red-node user you created above. |
| 60 | |
| 61 | * Test the node update command. Execute red-node-update passing the path to the red_node.conf file (the default location is /usr/local/etc/red/red_node.conf, you don't need to pass the path as the second argument if your conf file is already located there). For example: |
| 62 | {{{ |
| 63 | node/sbin/red-node-update /path/to/etc/red/red-node.conf |
| 64 | }}} |
| 65 | |
| 66 | * It should run silently, creating all the items that were in a pending state, changing the status to "active." |
| 67 | |
| 68 | === Setup ssh triggering === |
| 69 | |
| 70 | * As the user who your web server runs as, create an ssh private/public key pair, leaving the passphrase empty: |
| 71 | {{{ |
| 72 | ssh-keygen -t rsa |
| 73 | }}} |
| 74 | |
| 75 | * On each destination node, create a /root/.ssh/authorized_keys file for the user that you want red to be logging in as. In a real world environment, you will want this to be the root user (or a user with password-less sudo privs). You should add a line that includes the command option to limit access to executing the red-node-update command, for example: |
| 76 | {{{ |
| 77 | command="/usr/local/share/red/server/sbin/red-node-update" ssh-rsa AAAAB3NzaC1yc etc... |
| 78 | }}} |
| 79 | |
| 80 | * As the user who your web server runs as, test the connection and accept the key fingerprint (if it is correct). |
| 81 | |
| 82 | * Now - you can change your ui configuration setting to enable the notify variable to be true. |