Installing Dependencies
See Dependencies
To date, Wagn has been developed and maintained primarily on Unix-based systems, especially Mac OS X. We will soon be improving this and adding strong Windows support. In the meantime, our generous users have contributed these helpful instructions for installation on systems where they've encountered issues with our default installation process:
Installing RubyVersionManager (RVM for short) and RUBY
Make sure you are logged in as your new 'your_user' (not root):
You'll need curl for this one, install it:
$ sudo apt-get install curl
Then type in:
$ \curl -sSL https://get.rvm.io | bash -s stable --ruby
* if you get a signature error type in the command below and try again:
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
** if you get a signature error again type this in and try again:
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
* more info at http://rvm.io/rvm/install
$ sudo apt-get install nodejs (needed when wagn update, complains about execjs)
Make sure bundler is the latest version
$ sudo gem install bundler
Installing ImageMagick
$ sudo apt-get install imagemagick
$ sudo apt-get install libmagickwand-dev
Installing an RDBMS
* parts taken form http://ryanbigg.com/2014/10/ubuntu-ruby-ruby-install-chruby-and-you//
install posgresql 9.4
mkdir install_pg
cd install_pg
wget https://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-3.noarch.rpm
sudo yum -y install http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-3.noarch.rpm
sudo yum -y groupinstall "PostgreSQL Database Server 9.4 PGDG"
check if everything was correctly installed
sudo rpm -qa | grep postgre
postgresql94-server-9.4.16-1PGDG.rhel7.x86_64
postgresql94-libs-9.4.16-1PGDG.rhel7.x86_64
postgresql94-9.4.16-1PGDG.rhel7.x86_64
postgresql94-contrib-9.4.16-1PGDG.rhel7.x86_64
enable & start service
sudo systemctl enable postgresql-9.4
sudo systemctl start postgresql-9.4.service
initialize database
sudo /usr/pgsql-9.4/bin/postgresql94-setup initdb
firewall adjustment (open ports)
firewall-cmd --permanent --add-port=5432/tcp
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --reload
enable SELinux
setsebool -P httpd_can_network_connect_db 1
change password for the
sudo passwd postgres
(user prompted twice for a password)
edit the posgresql configuration file
vim /var/lib/pgsql/9.4/data/pg_hba.conf
Change from:
host all all 127.0.0.1/32 ident
# IPv6 local connections:
host all all ::1/128 ident
To:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
posgresql 9.4 binaries (should set postgresql ENV!)
all postgresql 9.4 binaries are installed at /usr/pgsql-9.4/bin
Change password for the 'postgres' user
sudo passwd postgres
If root/sudo rights are unavailable use sudo:sudo -i -u postgres
at the prompt then enter:passwd
to change the user password
Decko installation
create a db user (asks for the password twice) will have to be written at the config/database.yml
# -d (--createdb) (role can create new databases)
# -P (--pwprompt) (assign a password to new role)
createuser -d <db_user> -P (CREATE ROLE alias)
create database which will have to be written at the config/database.yml
# probably not needed decko seed will create the database
# create database via user
# -O (--owner=OWner) (database user to own the new database)
# createdb -O <db_user> <database>
Edit Gemfile and add the pg
gem
gem 'pg', '~> 0.18'
edit config/database.yml
# Add this after the cucumber: *test line
production: &production
adapter: postgresql
encoding: utf8
reconnect: false
database: <database_name>
pool: 5
username: <db_user>
password: <db_user_password>
host: localhost
I'm fuzzy here on the profile (probably if you want to change to production then change it?)
@ethn could you please fill it here?profile: *production
What is the correct format for production deployment?
Now to install all gems and seed the application
install decko gem
gem install decko
install new application
decko new _app_name_
change directory
cd _app_name_
install all needed gems (this is probably optional but I'm used to doing it manually)
bundle install
prefill the DB and have the original configuration
decko seed
If everything went fine you should see:
bundle exec rake decko:seed
--> Database '<db_name>' already exists (This is extra as I had the database already)
not dropped
creating
loading schema
-- create_table("card_actions", {:id=>:integer, :force=>:cascade})
-> 0.0542s
-- create_table("card_acts", {:id=>:integer, :force=>:cascade})
-> 0.0250s
-- create_table("card_changes", {:id=>:integer, :force=>:cascade})
-> 0.0121s
-- create_table("card_references", {:id=>:integer, :force=>:cascade})
-> 0.0290s
-- create_table("card_revisions", {:id=>:integer, :force=>:cascade})
-> 0.0157s
-- create_table("cards", {:id=>:integer, :force=>:cascade})
-> 0.0571s
-- create_table("delayed_jobs", {:force=>:cascade})
-> 0.0146s
-- create_table("schema_migrations_core_cards", {:id=>false, :force=>:cascade})
-> 0.0095s
-- create_table("schema_migrations_deck_cards", {:id=>false, :force=>:cascade})
-> 0.0084s
-- create_table("sessions", {:id=>:integer, :force=>:cascade})
-> 0.0107s
-- create_table("users", {:id=>:integer, :force=>:cascade})
-> 0.0073s
update card_migrations
-- assume_migrated_upto_version("20170830210517", ["/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.8/db/migrate_core_cards"])
-> 0.0321s
loading bootstrap
set symlink for assets
reset cache
Then you can start the built-in WEBrick server as mentioned at the https://github.com/decko-commons/decko/blob/master/decko/README.rdoc
You should see (when started correctly):
decko server
=> Booting Thin
=> Rails 5.1.4 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
Thin web server (v1.7.2 codename Bachmanity)
Maximum connections set to 1024
Listening on 0.0.0.0:3000, CTRL+C to stop
Install the package:
# apt-get install mysql2
Try to install the gem
$ gem install mysql2
If you're planning on using the mysql2 gem for your application then you'll want to install the libmysqlclient-dev package before you do that. Without it, you'll get an error when the gem tries to compile its native extensions:
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/home/ryan/.rubies/ruby-2.2.0/bin/ruby extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Install this package using:
$ sudo apt-get install libmysqlclient-dev
If you are running mysql and rake complains about not being able to find your mysql.sock file, you will need to add "socket: " to each of the database definitions
Example database.yml for Development
development:
adapter: mysql
socket: /var/mysql/mysql.sock
database: wagn_development
username: wagn
password: hi_im_a_password_right_up_in_here
host: localhost
test:
adapter: mysql
socket: /var/mysql/mysql.sock
database: wagn_test
username: wagn
password: woo_hoo_password
host: localhost
production:
adapter: mysql
socket: /var/mysql/mysql.sock
database: wagn_production
username: wagn
password: password_ahoy
host: localhost
To be added.
To be added.