-
Notifications
You must be signed in to change notification settings - Fork 36
Deploy TrustyCMS 3.5.0 to Digital Ocean droplet
Create a Digital Ocean Droplet from your username page.
Choose an image, click on One-click apps, select Ruby-onRails on Ubuntu 18.04, choose a size (1GB is fine), choose a datacenter region and click "Create".
You will recieve an email with the IP and other instructions.
Use the IP to login from Terminal using SSH:
Follow the instructions to set up your new root password.
apt-get update
apt-get install mysql-server
mysql_secure_installation
# asks you to enter mysql root password
apt-get install libmysqlclient-dev
sudo -i -u rails
# get to rails user
cd example
#"Example" is the rails directory created by Digital Ocean. You can change the name.
vi Gemfile
#check that gem 'rails' is '5.2.1'. Use "i" key to edit, Press to exit editing mode, then type ':wq' to write the file and exit vim.
gem install bundler
bundle update
bundle install
rails app:update
# enter "Y" to everything
echo "gem 'trusty-cms', '3.5.0'" >> Gemfile
echo "gem 'rails-observers'" >> Gemfile
bundle update
bundle install
rails g trusty_cms rails_project
# Y to everything
su - root
#back to root user
mysql -u root -p
#set root password for mysql, exit with \q [enter]
sudo mysql -u root -p
# try again...enter password
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new-password';
#replace 'new-password' with your password that goes in database.yml
mysql> exit
#enter to exit mysql.
sudo service mysql stop
#Stop and start the mysql server.
sudo service mysql start
mysqladmin variables | grep socket
#This displays location of socket, which should be /var/run/mysqld/mysql.sock
sudo -i -u rails
cd example
vi config/database.yml
#Add your mysql username ("root") and password to production, change socket to /var/run/mysqld/mysqld.sock
sudo -i -u rails
cd rails_project
vi config/database.yml
#make sure the correct location of socket is entered under "production" and enter username "root" and mysql password in development, test and production.
su - root
#back to root user
sudo reboot
#reboot server
ssh [email protected]
#use your IP address
sudo service mysql restart
#not necessary if you rebooted server.
sudo -i -u rails
cd example
add new lines to three files:
vi config/environments/development.rb # config.eager_load = false
vi config/environments/test.rb # config.eager_load = false
vi config/environments/production.rb # config.eager_load = true
While in config/environments/production.rb comment out:
config.action_controller.consider_all_requests_local = false
and check that this is commented out:
config.logger= SyslogLogger.new
vi config/application.rb
press 'i' to edit,
Go to line 57,
config.extensions = [ ]
add the extensions so it looks like
config.extensions = [ :snippets, :clipped, :layouts, :reorder, :multi_site, :rad_social]
Press [esc] to exit editing mode, then type ':wq' to write the file and exit vim.
Next I tried to set up the database. This didn't work... Please help!
bundle exec rake db:create RAILS_ENV=production SECRET_KEY_BASE='loremipsumdolorsitametconsecteturadipiscingelit'
#rake aborted! Mysql2::Error::ConnectionError: Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock' (2)
bundle exec rake db:setup RAILS_ENV=production SECRET_KEY_BASE='loremipsumdolorsitametconsecteturadipiscingelit'
bundle exec rails db:migrate RAILS_ENV=production SECRET_KEY_BASE='loremipsumdolorsitametconsecteturadipiscingelit'
bundle exec rake trusty_cms_engine:install:migrations
bundle exec rake db:bootstrap
rails s -e production
Your site will then be running at http://localhost:3000
You can access the administrative interface at http://localhost:3000/admin
But currently it is not working. I haven't got past the rake tasks.