-
Notifications
You must be signed in to change notification settings - Fork 27
Installation Instructions (Ubuntu)
Install the following:
-
apt-get install mysql-server libmysqlclient-dev python-dev libyaml-dev lighttpd git-core python-virtualenv memcached libjpeg-dev
- Choose MySQL root password and remember it for later.
- If you want to use the default sendmail, then install it:
apt-get install sendmail
- Note that you should comment out SES and SMTP settings in
config.yaml
- Note that you should comment out SES and SMTP settings in
- Configure memcached. Memcached usually is configured with 64M, edit the following if you want to change this.
sudo nano /etc/memcached.conf
sudo /etc/init.d/memcached restart
git clone https://localprojects@github.com/localprojects/Change-By-Us.git
All further commands are assuming you are in the directory created from this action (default is lp-changebyus
).
The application needs the following directories:
mkdir {run,logs,data,data-files}
Create a new database for CBU to use.
mysql -u root -p
> create database <DATABASE_NAME>; grant all on <DATABASE_NAME>.* to <DATABASE_USER>@localhost identified by '<DATABASE_USER>';
> set password for <DATABASE_USER>@localhost = PASSWORD('<DATABASE_PASS>');
> exit
After that, import data structure and data.
NOTE: If you already have a database structure in place, follow the instructions in Data and Schema Migrations to get your database up to date.
mysql -u <DATABASE_USER> -p <DATABASE_NAME> < sql/models.sql
mysql -u <DATABASE_USER> -p <DATABASE_NAME> < sql/data_badwords.sql
mysql -u <DATABASE_USER> -p <DATABASE_NAME> < sql/data_tasks.sql
mysql -u <DATABASE_USER> -p <DATABASE_NAME> < sql/data_user_groups.sql
The following are application specific and do not necessarily need to be imported.
mysql -u <DATABASE_USER> -p <DATABASE_NAME> < sql/test_data/data_keywords.sql
mysql -u <DATABASE_USER> -p <DATABASE_NAME> < sql/test_data/data_location.sql
mysql -u <DATABASE_USER> -p <DATABASE_NAME> < sql/test_data/data_community_leaders.sql
Note: Location data is needed, specifically the city-wide designation.
virtualenv .env --no-site-packages
source .env/bin/activate
pip install -r requirements.txt
- Copy the sample
lighttpd.conf.sample
file tolighttpd.conf
cp lighttpd.conf.sample lighttpd.conf
- Edit
lighttpd.conf
with appropriate values. - If you need authentication, you will have to install mini-httpd and create a password file.
sudo apt-get install mini-httpd
htpasswd <FILENAME> <USERNAME>
- Set values in
lighttpd.conf
appropriately.
- To run on port 80, the user will have to have root privileges.
- Copy the sample
config.yaml.tmpl
file toconfig.yaml
cp ./etc/config.yaml.tmpl config.yaml
- Edit
config.yaml
with appropriate values. - Make sure you NEVER commit the config.yaml file to the repo
To run the application, run the following command: /usr/sbin/lighttpd -D -f lighttpd.conf
The application should be available at: http://localhost:8080/
To ensure that the application remains up even if the system restarts, there is an Upstart script to help with this. This does not currently work with virtualenv.
sudo cp ./scripts/upstart/cbu.conf /etc/init/cbu.conf
-
sudo nano /etc/init/cbu.conf
(Edit variables as needed) sudo chmod +x /etc/init/cbu.conf
- Make your log file executable by relevant user if needed.
- If running on port 80, make sure user has root privileges.
sudo start cbu