This is an example of a RubyOnRails application which you can deploy on SUSE Cloudfoundry using the following steps.
-
Create a database service. It can be PostgreSQL or MySQL but has to be named
scf-rails-example-dbto match the value in the manifest.yml file.It will be a command like this:
cf create-service service_name the_desired_package scf-rails-example-dbFind out what you services you have available by running
cf marketplace. -
Make sure you have the appropriate gem in your
GemfileandGemfile.lockin order to connect to the database.Usually
mysql2andpgare the 2 options. Try using an IP address as the hostmysql2gem in case it tries to connect using a socket. -
Run
cf pushfrom withing the root for this repository.
If you want to see some seed data in the front page, run the following:
cf push -c 'rake db:seed' -i 1
and then again:
cf push
to do a normal deploy.
Alternatively, you may do a normal cf push, and then run the following (admittedly unwieldy) command:
cf ssh scf-rails-example -c "export PATH=/home/vcap/deps/0/bin:/usr/local/bin:/usr/bin:/bin && export BUNDLE_PATH=/home/vcap/deps/0/vendor_bundle/ruby/2.5.0 && export BUNDLE_GEMFILE=/home/vcap/app/Gemfile && cd app && bundle exec rake db:seed"
This triggers the seed task while the app is already running, without needing to restage/restart.