nickjj / orats

Opinionated rails application templates.
MIT License
664 stars 56 forks source link

No .env file after Rails new #12

Closed ghost closed 8 years ago

ghost commented 8 years ago
❯ orats version
orats version 5.0.0
❯ orats new myapp

        task  Check if path exists

        task  Check if template exists

        task  Create 'base' project
        path  myapp

        task  Prepare and run everything
        open  carefully read and edit the `.env` file
        move  cd myapp
         run  docker-compose up --build

        task  Initialize the database in a 2nd Docker-enabled terminal
        note  OSX / Windows users can skip the --user flag
         run  docker-compose exec --user "$(id -u):$(id -g)" website rails db:reset
         run  docker-compose exec --user "$(id -u):$(id -g)" website rails db:migrate

        task  Visit the page in your browser
       visit  Running Docker natively? http://localhost:3000
       visit  Running Docker with the Toolbox? http://192.168.99.100:3000
❯ tree -a
.
├── app
│   ├── assets
│   │   ├── config
│   │   │   └── manifest.js
│   │   ├── images
│   │   │   └── .keep
│   │   ├── javascripts
│   │   │   ├── application.js
│   │   │   ├── cable.js
│   │   │   └── channels
│   │   │       └── .keep
│   │   └── stylesheets
│   │       └── application.scss
│   ├── channels
│   │   └── application_cable
│   │       ├── channel.rb
│   │       └── connection.rb
│   ├── controllers
│   │   ├── application_controller.rb
│   │   ├── concerns
│   │   │   └── .keep
│   │   └── pages_controller.rb
│   ├── helpers
│   │   ├── application_helper.rb
│   │   └── pages_helper.rb
│   ├── jobs
│   │   └── application_job.rb
│   ├── mailers
│   │   └── application_mailer.rb
│   ├── models
│   │   ├── application_record.rb
│   │   └── concerns
│   │       └── .keep
│   └── views
│       ├── layouts
│       │   ├── application.html.erb
│       │   ├── _flash.html.erb
│       │   ├── _footer.html.erb
│       │   ├── _google_analytics.html.erb
│       │   ├── mailer.html.erb
│       │   ├── mailer.text.erb
│       │   └── _navigation.html.erb
│       └── pages
│           └── home.html.erb
├── bin
│   ├── bundle
│   ├── rails
│   ├── rake
│   ├── setup
│   └── update
├── cable
│   └── config.ru
├── config
│   ├── application.rb
│   ├── boot.rb
│   ├── cable.yml
│   ├── database.yml
│   ├── environment.rb
│   ├── environments
│   │   ├── development.rb
│   │   ├── production.rb
│   │   ├── staging.rb
│   │   └── test.rb
│   ├── initializers
│   │   ├── application_controller_renderer.rb
│   │   ├── assets.rb
│   │   ├── backtrace_silencers.rb
│   │   ├── cookies_serializer.rb
│   │   ├── filter_parameter_logging.rb
│   │   ├── inflections.rb
│   │   ├── mime_types.rb
│   │   ├── new_framework_defaults.rb
│   │   ├── session_store.rb
│   │   ├── sidekiq.rb
│   │   ├── timeout.rb
│   │   └── wrap_parameters.rb
│   ├── locales
│   │   └── en.yml
│   ├── puma.rb
│   ├── routes.rb
│   ├── secrets.yml
│   ├── sidekiq.yml.erb
│   └── spring.rb
├── config.ru
├── db
│   └── seeds.rb
├── docker-compose.yml
├── Dockerfile
├── .dockerignore
├── Gemfile
├── Gemfile.lock
├── .gitignore
├── lib
│   ├── assets
│   │   └── .keep
│   └── tasks
│       └── .keep
├── log
│   └── .keep
├── public
│   ├── 404.html
│   ├── 422.html
│   ├── 500.html
│   ├── apple-touch-icon.png
│   ├── apple-touch-icon-precomposed.png
│   ├── favicon.ico
│   └── robots.txt
├── Rakefile
├── README.md
├── .rubocop.yml
├── test
│   ├── controllers
│   │   ├── .keep
│   │   └── pages_controller_test.rb
│   ├── fixtures
│   │   ├── files
│   │   │   └── .keep
│   │   └── .keep
│   ├── helpers
│   │   └── .keep
│   ├── integration
│   │   └── .keep
│   ├── mailers
│   │   └── .keep
│   ├── models
│   │   └── .keep
│   └── test_helper.rb
├── tmp
│   └── .keep
└── vendor
    └── assets
        ├── javascripts
        │   └── .keep
        └── stylesheets
            └── .keep

44 directories, 91 files
nickjj commented 8 years ago

Thanks. I see what happened here.

The .env file is in my local gem, but when I pushed it to GitHub the .gitignore file in the base template prevented it from being included.

I will fix this and push 5.0.1 today.

For now, here's what the .env file should look like. It should be in the root of the project:

_Make sure to replace orats_base with your project name in a few spots._

# This is used by Docker Compose to set up prefix names for Docker images,
# containers, volumes and networks. This ensures that everything is named
# consistently regardless of your folder structure.
COMPOSE_PROJECT_NAME=orats_base

# What Rails environment are we in?
RAILS_ENV=development

# Rails log level.
#   Accepted values: debug, info, warn, error, fatal, or unknown
LOG_LEVEL=debug

# You would typically use `rails secret` to generate a secure token. It is
# critical that you keep this value private in production.
SECRET_TOKEN=asecuretokenwouldnormallygohere

# More details about these Puma variables can be found in config/puma.rb.
# Which address should the Puma app server bind to?
BIND_ON=0.0.0.0:3000

# Puma supports multiple threads but in development mode you'll want to use 1
# thread to ensure that you can properly debug your application.
RAILS_MAX_THREADS=1

# Puma supports multiple workers but you should stick to 1 worker in dev mode.
WEB_CONCURRENCY=1

# Requests that exceed 5 seconds will be terminated and dumped to a stacktrace.
# Feel free to modify this value to fit the needs of your project, but if you
# have any request that takes more than 5 seconds you probably need to re-think
# what you are doing 99.99% of the time.
REQUEST_TIMEOUT=5

# The database name will automatically get the Rails environment appended to it
# such as: orats_base_development or orats_base_production.
DATABASE_URL=postgresql://orats_base:yourpassword@postgres:5432/orats_base?encoding=utf8&pool=5&timeout=5000

# The full Redis URL for the Redis cache. The last segment is the namespace.
REDIS_CACHE_URL=redis://:yourpassword@redis:6379/0/cache

# Action mailer (e-mail) settings.
# You will need to enable less secure apps in your Google account if you plan
# to use GMail as your e-mail SMTP server.
# You can do that here: https://www.google.com/settings/security/lesssecureapps
SMTP_ADDRESS=smtp.gmail.com
SMTP_PORT=587
SMTP_DOMAIN=gmail.com
SMTP_USERNAME=you@gmail.com
SMTP_PASSWORD=yourpassword
SMTP_AUTH=plain
SMTP_ENABLE_STARTTLS_AUTO=true

# Not running Docker natively? Replace 'localhost' with your Docker Machine IP
# address, such as: 192.168.99.100:3000
ACTION_MAILER_HOST=localhost:3000
ACTION_MAILER_DEFAULT_FROM=you@gmail.com
ACTION_MAILER_DEFAULT_TO=you@gmail.com

# Google Analytics universal ID. You should only set this in non-development
# environments. You wouldn't want to track development mode requests in GA.
# GOOGLE_ANALYTICS_UA='xxx'

# The full Redis URL for Active Job.
ACTIVE_JOB_URL=redis://:yourpassword@redis:6379/0

# The queue prefix for all Active Jobs. The Rails environment will
# automatically be added to this value.
ACTIVE_JOB_QUEUE_PREFIX=orats_base:jobs

# The full Redis URL for Action Cable's back-end.
ACTION_CABLE_BACKEND_URL=redis://:yourpassword@redis:6379/0

# The full WebSocket URL for Action Cable's front-end.
# Not running Docker natively? Replace 'localhost' with your Docker Machine IP
# address, such as: ws://192.168.99.100:28080
ACTION_CABLE_FRONTEND_URL=ws://localhost:28080

# Comma separated list of RegExp origins to allow connections from.
# These values will be converted into a proper RegExp, so omit the / /.
#
# Examples:
#   http:\/\/localhost*
#   http:\/\/example.*,https:\/\/example.*
#
# Not running Docker natively? Replace 'localhost' with your Docker Machine IP
# address, such as: http:\/\/192.168.99.100*
ACTION_CABLE_ALLOWED_REQUEST_ORIGINS=http:\/\/localhost*
nickjj commented 8 years ago

Fixed in v5.0.1 which is now available.

ghost commented 8 years ago

Awesome! Thank you for your quick response, @nickjj