Setting-up-from-scratch

From VPOIDS Documentation

Creating a new AFIDS instance

The following instructions can be used for setting up the VPOIDS software on any host, not the VPOIDS shared host. For example, you can use this process to create a local version of the application for development purposes.

SVN Checkout

Check out the files from the SVN repository to a directory on your server.

Set up a virtual host

The checkout process creates a directory /browse/trunk/web. This will be the root of the application, so set this directory as the root of your web server.

Create database

Use the database dump to create the MySql database. Either create the schema name separately and make sure that the restore command references that schema, or include the schema create command in the dump file.

mysql database_name < /var/www/import_data/afids_schema_ordered.sql -uroot -p

Create database user and add permissions:

Select | Insert | Update | Delete | Show View | Execute

GRANT SELECT, INSERT, UPDATE, DELETE, SHOW VIEW, EXECUTE ON  schemaname.* TO 'username'@'localhost';

Import the data from common reference tables

At this point, the database has no data. For the most part, you will create all the data for your organization. However, there are some database tables all organizations use in common:

  • Aircraft

If the organization is US based:

  • Airports
  • Zipcodes
  • Counties

You can download these table dumps from the repository and load them into your database.

Modify permissions

Set the permissions for the directory. This allows the group to read, but no one else.

sudo chmod -R 0771 / (your root directory)

Set permissions for subdirectories that require write access

  • sudo chmod -R 0777 /log
  • sudo chmod -R 0777 /cache
  • sudo chmod -R 0777 /web/uploads
  • sudo chmod -R 0755 /web/images

Update the configuration files

/config/databases.yml. Update this file with the connection information for the database you created, including the database user you created for the app.

/apps/frontend/config/app.yml. Update this file with information about the organization. There are also a number of configuration settings which are described further here.

Database updates

Run these statements against the database.

First, create a user so you can log in:

/* add the first person */
/* the password is test1234 */
insert into person (first_name, last_name, username, password)
VALUES ('Test', 'User', 'admin','16d7a4fca7442dda3ad93c9a726597e4');

Add the new roles to the system:

/* add the new roles */
INSERT INTO role (id, title, description) VALUES (26, '@Admin', 'Afids Administrator');
INSERT INTO role (id, title, description) VALUES (27, '@Pilot', 'Member');
INSERT INTO role (id, title, description) VALUES (28, '@Staff', 'Normal staff');
INSERT INTO role (id, title, description) VALUES (29, '@Coordinator', 'Coordinator');
INSERT INTO role (id, title, description) VALUES (30, '@Volunteer', 'Volunteer');
INSERT INTO role (id, title, description) VALUES (31, '@Member', 'Member');

/* alternative */
INSERT INTO role (id, title, description) VALUES (26, '@Admin', 'Afids Administrator'),(27, '@Pilot', 'Member'),(28, '@Staff', 'Normal staff'),(29, '@Coordinator', 'Coordinator'),(30, '@Volunteer', 'Volunteer'),(31, '@Member', 'Member');

Add the admin for the new user:

/* add roles for the new people */
insert into person_role (person_id, role_id) VALUES (1, 26);

Add a first mission to prevent errors when the application creates its first mission.

/* There needs to be a first mission to increment the external ID) */
insert into mission (mission_type_id, external_id) VALUES (1, 1000);

Add a member record with an external id, again so problems are not created when the application tries to create its first member

/* There needs to be a first member to increment the external ID) */
insert into member (person_id, member_class_id, external_id) VALUES (1,1,1000);