---
description: Learn how to host your bot, website, api with Ruby on DisCloud!
---

# Ruby

## :file\_folder: Files

You should not send all your application files to `.zip`, there are some exceptions, they are:

```diff
- File Gemfile.lock (Required for Ruby On Rails)
- Folder .git
```

> * Have trouble finding your main file? [Click here](../../faq/arquivo-principal#general-main-files)
> * Doubts about creating your `Gemfile` file? [Click here](../../faq/arquivo-principal#general-main-files)

{% content-ref url="ruby/create-the-gemfile" %}
[create-the-gemfile](ruby/create-the-gemfile)
{% endcontent-ref %}

### :compression: Compressing the Files

Select only the necessary files as mentioned above and create your `.zip`

![](https://1155855661-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8p3J4WAYBioqdR7bmrbb%2Fuploads%2FiPr2gYOZujqlEMYgcvuu%2Fruby-zip.png?alt=media\&token=db17ce87-ef9d-4f18-b433-6571174258c8)

For more details on how to **Compress your Files** according to your **Operating System**, you can see below:

{% content-ref url="../faq/zip" %}
[zip](../faq/zip)
{% endcontent-ref %}

## ✍ Hosting your bot

{% content-ref url="../host" %}
[host](../host)
{% endcontent-ref %}

## :earth\_americas: Hosting Your Site

{% hint style="info" %}
This feature needs some basic requirements to be able to be used, please check the requirements [here](broken-reference) before continuing
{% endhint %}

### Using `Ruby On Rails`

`Rails` is a development tool that gives web developers a framework that can be used in building **websites** or **APIs**.

### Installing `Rails`

See the official documentation below.

{% embed url="https://guides.rubyonrails.org/getting_started.html#creating-a-new-rails-project-installing-rails" %}

### Configuring `Rails`

You need to add your **subdomain** (or **domain**) in `Rails` allowed hosts.

> * Edit the `config/application.rb` file
> * Modify **line 19**, with your subdomain or domain

{% code title="config/application.rb" lineNumbers="true" %}
```ruby
require_relative "boot"

require "rails/all"

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module RailsOnDiscloud
  class Application < Rails::Application
    # Initialize configuration defaults for originally generated Rails version.
    config.load_defaults 7.0
    # config.time_zone = "Central Time (US & Canada)"
    # config.eager_load_paths << Rails.root.join("extras")
    Rails.application.config.hosts = [
    IPAddr.new("0.0.0.0/0"),        # All IPv4 addresses.
    IPAddr.new("::/0"),             # All IPv6 addresses.
    "localhost",                    # The localhost reserved domain.
    "yoursubdomain.discloud.app"    # !!!! Discloud Domain !!!!!
]
  end
end

```
{% endcode %}

### discloud.config example for `Rails`

{% content-ref url="../../configuration/configuration" %}
[configuration](../../configuration/configuration)
{% endcontent-ref %}

{% code title="discloud.config" %}
```typescript
ID=subdomain
TYPE=site
MAIN=config/application.rb
RAM=512
AUTORESTART=false
VERSION=latest
APT=tools
```
{% endcode %}
