andreychernih/railsbox

View on GitHub
app/views/boxes/show.html.slim

Summary

Maintainability
Test Coverage
.container-fluid
  .row
    .col-lg-5
      h1
        = t('.title')
        ' 
        <kbd>#{@box.vm_name}</kbd>
      p Make sure you bookmark this page (or save URL somewhere), it's the only way to access your configuration later.
      p
        input.form-control data-copies-itself='yes' id='url' type='text' value=box_url(@box)
      br
      p 
        a.btn.btn-primary.btn-lg role='button' href=download_box_url(@box) = t('.download')
        ' 
        a.btn.btn-default.btn-lg role='button' href=edit_box_url(@box) = t('.edit')
        '
        a.btn.btn-danger.btn-lg role='button' href=box_url(@box) data-confirm='Are you sure?' data-method='delete' = t('.delete')

      dl.dl-horizontal
        - if @box.http_url
          dt HTTP URL
          dd <a href="#{@box.http_url}">#{@box.http_url}</a>
        - if @box.https_url
          dt HTTPS URL
          dd <a href="#{@box.https_url}">#{@box.https_url}</a> (https)

      h2 Control
      h3 VM
      p Virtual machine can be controlled by running the following commands:
      p
        pre
          | vagrant up                      # To start VM
            vagrant provision               # To re-run ansible playbook
            vagrant halt                    # To stop VM
            vagrant destroy                 # To destroy VM completely
      - if @box.server_type == 'nginx_unicorn'
        h3 unicorn
        p You can start and stop unicorn by running standard upstart commands:
        p
          pre
            | sudo start #{@box.vm_name}
              sudo stop #{@box.vm_name}
              sudo restart #{@box.vm_name}
      - elsif @box.server_type == 'nginx_puma'
        h3 puma
        p You can start and stop puma by running standard upstart commands:
        p
          pre
            | sudo start #{@box.vm_name}
              sudo stop #{@box.vm_name}
              sudo restart #{@box.vm_name}
      - elsif @box.server_type == 'nginx_passenger'
        h3 Passenger
        p You can restart your Rails application by running <kbd>touch tmp/restart.txt</kbd> in <kbd>#{@box.path}</kbd> dir.

      h2 Customization
      p Feel free to customize ansible playbooks as you need. But keep in mind that your changes may be lost if you decide to re-generate configuration using Edit button. Probably it will be best if you keep your customizations in a separate roles which names do not overlap with the playbooks provided by railsbox.

    .col-lg-6.how-to-install.col-lg-offset-1
      h1 How to install

      h2 Requirements
      = render "boxes/#{browser.platform}/requirements"
      
      h2 Unzip
      p Go ahead and copy your downloaded box to your Ruby on Rails project directory.
      p
        pre
          | cp ~/Downloads/#{@box.vm_name}-railsbox.zip /path/to/rails/project/
      p Then unarchive it. 
      p
        pre
          | cd /path/to/rails/project
            unzip #{@box.vm_name}-railsbox.zip
      p <kbd>railsbox</kbd> directory will be created. Your project structure will be like:
      p
        pre
          | project/
              app
              bin
              ...
              railsbox/
                ansible/
                development/
                  Vagrantfile
              Gemfile
              ...


      h2 Start VM
      p Go to the <kbd>railsbox</kbd> directory and type <kbd>vagrant up</kbd>. vagrant will download the base box and provision it with ansible using your configuration.
      p
        pre
          | cd /path/to/rails/project/railsbox/development
            vagrant up
      p Note that vagrant may ask for a sudo password. That's required when you're using NFS for folder synchronization.
      p Once it's done, you'll be able to login into it using <kbd>vagrant ssh</kbd> command. Your application is stored in <kbd>#{@box.path}</kbd> directory.