Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud9 initialization -- needs testing #197

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Map Knitter. If not, see <http://www.gnu.org/licenses/>.


====

##Simple installation with Cloud9

1. If you have a GitHub account, visit https://c9.io and log in with the GitHub button.
2. Fork this repository to your own GitHub account, creating a `yourname/mapknitter` project.
3. Name your project, then (order important!) choose the **Ruby** template, THEN enter `yourname/mapknitter` in the "Clone from Git or Mercurial URL" field, and press **Create Workspace**
4. In the command line prompt at the bottom of the page, type `./install_cloud9.sh` and press enter.
5. Enter your username when prompted, and it will launch itself.
6. You're done! Go to the URL under the Preview menu! If you want to stop it, use `cmd-C`, start it, use the command: `sudo bundle exec rails s -p $PORT -b $IP`.

====


##Installation video

For a run-through of the Prerequisites and Installation steps listed below, you can watch the install video at:
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def current_user
end

def check_subdomain
if request.subdomain.present? && Rails.env != 'test'
if request.subdomain.present? && Rails.env == 'production'
redirect_to 'http://' + request.domain + request.port_string + request.fullpath
end
end
Expand Down
27 changes: 27 additions & 0 deletions config/database.yml.cloud9
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Warning: The contents of the database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql2
username: <username>
password:
database: mapknitter_test
encoding: utf8
pool: 5
timeout: 5000

# This database will be used by default when running `passenger start`
development:
adapter: mysql2
username: <username>
password:
encoding: utf8
database: mapknitter

production:
adapter: mysql2
username: <username>
password:
encoding: utf8
database: mapknitter

12 changes: 12 additions & 0 deletions install_cloud9.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
read -p "Enter your cloud9 username: " un
rvm install ruby-2.1.2
rvm 2.1.2
sudo apt-get install imagemagick ruby-rmagick libfreeimage3 libfreeimage-dev ruby-dev libmagickcore-dev libmagickwand-dev
sudo apt-get install gdal-bin python-gdal curl libcurl4-openssl-dev libssl-dev zip
mysql-ctl start
bower install
bundle install
bundle exec rake cloud9 username=$un
bundle exec rake db:setup
bundle exec rake db:migrate
sudo bundle exec rails server -p $PORT -b $IP
17 changes: 17 additions & 0 deletions lib/tasks/cloud9.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# rake cloud9 username=foo
task :cloud9 do
username = ENV['username']
infile = "config/database.yml.cloud9"
outfile = "config/database.yml"

File.open(outfile, 'w') do |out|
out << File.open(infile).read.gsub(/<username>/, username)
end

infile = "config/config.yml.example"
outfile = "config/config.yml"

File.open(outfile, 'w') do |out|
out << File.open(infile).read
end
end