Retrospring/README.md

108 lines
2.7 KiB
Markdown
Raw Normal View History

2014-10-27 22:36:38 -07:00
# justask [![build status](https://ci.rrerr.net/projects/9/status.png?ref=master)](https://ci.rrerr.net/projects/9?ref=master)
2014-08-01 02:23:47 -07:00
2014-10-27 22:36:38 -07:00
## Requirements
2014-08-01 02:23:47 -07:00
2014-10-27 22:36:38 -07:00
- UNIX-like system (Linux, *BSD, ...)
- ruby 1.9.3+
- Bundler
- PostgreSQL or MySQL
2014-08-01 02:23:47 -07:00
2014-12-07 03:55:04 -08:00
## Installation (production)
2014-08-01 02:23:47 -07:00
2014-10-27 22:36:38 -07:00
### Database
2014-08-01 02:23:47 -07:00
2014-10-27 22:36:38 -07:00
#### PostgreSQL
2014-11-28 13:31:29 -08:00
$ sudo -u postgres psql -d template1
template1=# CREATE USER justask CREATEDB;
template1=# CREATE DATABASE justask_production OWNER justask;
template1=# \q
2014-10-27 22:36:38 -07:00
Try connecting to the database:
2014-11-28 13:31:29 -08:00
$ psql -U justask -d justask_production
2014-10-27 22:36:38 -07:00
#### MySQL
2014-12-07 03:55:04 -08:00
**Note:** We do not test for MySQL. Caveat emptor.
2014-11-28 13:31:29 -08:00
$ mysql -u root -p
# change 'hack me' in the command below to a real password
mysql> CREATE USER 'justask'@'localhost' IDENTIFIED BY 'hack me';
mysql> SET storage_engine=INNODB;
mysql> CREATE DATABASE IF NOT EXISTS `justask_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES ON `justask_production`.* TO 'justask'@'localhost';
mysql> \q
2014-10-27 22:36:38 -07:00
Try connecting to the database:
2014-11-28 13:31:29 -08:00
$ mysql -u justask -p -D justask_production
2014-10-27 22:36:38 -07:00
### justask
#### Clone the Source
2014-11-28 13:31:29 -08:00
$ git clone https://git.rrerr.net/nilsding/justask.git justask
2014-10-27 22:36:38 -07:00
#### Configure It
2014-11-28 13:31:29 -08:00
# Change into the justask directory
$ cd justask
2014-10-27 22:36:38 -07:00
2014-11-28 13:31:29 -08:00
# Copy the example config
$ cp config/justask.yml.example config/justask.yml
2014-10-27 22:36:38 -07:00
2014-11-28 13:31:29 -08:00
# Edit the configuration file
$ vi config/justask.yml
2014-10-27 22:36:38 -07:00
#### Database Configuration
2014-11-28 13:31:29 -08:00
# PostgreSQL only:
$ cp config/database.yml.postgres config/database.yml
2014-10-27 22:36:38 -07:00
2014-11-28 13:31:29 -08:00
# MySQL only:
$ cp config/database.yml.mysql config/database.yml
2014-10-27 22:36:38 -07:00
2014-11-28 13:31:29 -08:00
# MySQL and remote PostgreSQL only:
$ vi config/database.yml
2014-10-27 22:36:38 -07:00
2014-11-28 13:31:29 -08:00
# Both:
# Make database.yml readable only for you
chmod o-rwx config/database.yml
2014-10-27 22:36:38 -07:00
#### Install Gems
2014-11-28 13:31:29 -08:00
# For PostgreSQL (note: the option says "without ... mysql")
$ bundle install --deployment --without development test mysql
2014-10-27 22:36:38 -07:00
2014-11-28 13:31:29 -08:00
# Or, if you use MySQL
$ bundle install --deployment --without development test postgres
2014-10-27 22:36:38 -07:00
#### Initialize Database
2014-11-28 13:31:29 -08:00
$ bundle exec rake db:migrate RAILS_ENV=production
2014-10-27 22:36:38 -07:00
#### Compile Assets
2014-11-28 13:31:29 -08:00
$ bundle exec rake assets:precompile RAILS_ENV=production
#### Run the server
# Production mode:
$ mkdir -p ./tmp/sockets/
$ bundle exec unicorn -E production -l unix:./tmp/sockets/justask.sock
# Development mode:
$ bundle exec rails server
Create an account on your justask installation.
To make yourself an admin, just execute:
$ bundle exec rake 'justask:admin[your_username]' RAILS_ENV=production
If you want to remove admin status from a certain user, you can do this:
$ bundle exec rake 'justask:deadmin[get_rekt]' RAILS_ENV=production