Skip to content

Vagrant fixes #3

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

Merged
merged 2 commits into from
May 13, 2014
Merged
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
4 changes: 1 addition & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ MAILGUN_TOKEN=mailgun_token
MIXPANEL_API_SECRET=mixpanel_api_secret
MIXPANEL_TOKEN=mixpanel_token

MONGODB_DATABASE_NAME=coderwall

NOTIFIER_ADMIN_EMAILS="['notifier_admin@example.com']"

PRIVATE_ADMIN_PATH=private_admin_path
Expand All @@ -32,7 +30,7 @@ REDIS_URL=redis://localhost:6379
REVIEWERS="['Administrator']"

STRIPE_PUBLISHABLE_KEY=pk_test_stripe_publishable_key
STRIPE_SECRET_KEY=sk_test_stripe_secret_key
STRIPE_SECRET_KEY=sk_test_BQokikJOvBiI2HlWgH4olfQ2

SUPPORT_EMAIL=support@example.com

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
.DS_Store
.bundle
.config
.env
*.env
.idea
.sass-cache
.vagrant
Expand Down
11 changes: 9 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,21 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.network :forwarded_port, guest: 9292, host: 9293, auto_correct: true

config.vm.synced_folder '.', '/home/vagrant/web', nfs: true
config.vm.synced_folder './vagrant', '/home/vagrant/provision', nfs: true
config.vm.synced_folder './vagrant/dotfiles', '/home/vagrant/dotfiles', nfs: true
# config.vm.synced_folder './vagrant', '/home/vagrant/provision', nfs: true
# config.vm.synced_folder './vagrant/dotfiles', '/home/vagrant/dotfiles', nfs: true

config.vm.provider :virtualbox do |vb|
vb.customize ['modifyvm', :id, '--cpus', '4']
vb.customize ['modifyvm', :id, '--ioapic', 'on']
vb.customize ['modifyvm', :id, '--memory', '4096']

# https://github.com/mitchellh/vagrant/issues/1807
# whatupdave: my VM was super slow until I added these:
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
# seems to be safe to run: https://github.com/griff/docker/commit/e5239b98598ece4287c1088e95a2eaed585d2da4
end

config.vbguest.auto_update = true
config.vbguest.no_remote = false
end
3 changes: 2 additions & 1 deletion app/controllers/accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def create

@account = @team.build_account(params[:account])
@account.admin_id = current_user.id
@account.trial_end = Date.new(2013, 1, 1).to_time.to_i if session[:discount] == ENV['DISCOUNT_TOKEN']
# TODO: (whatupdave) this doesn't look like it's being used any more. Remove if possible
# @account.trial_end = Date.new(2013, 1, 1).to_time.to_i if session[:discount] == ENV['DISCOUNT_TOKEN']

if @account.save_with_payment(@plan)
unless @team.is_member?(current_user)
Expand Down
8 changes: 7 additions & 1 deletion app/models/protip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,13 @@ def already_created_a_protip_for(url)
end

def valid_reviewers
Rails.cache.fetch('valid_protip_reviewers', expires_in: 1.month) { User.where(username: YAML.load(ENV['REVIEWERS'])).all }
Rails.cache.fetch('valid_protip_reviewers', expires_in: 1.month) do
if ENV['REVIEWERS']
User.where(username: YAML.load(ENV['REVIEWERS'])).all
else
[]
end
end
end

end
Expand Down
2 changes: 2 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class Application < Rails::Application
config.ember.variant = Rails.env.downcase.to_sym
config.assets.js_compressor = :uglifier

config.logger = Logger.new(STDOUT)
config.logger.level = Logger.const_get(ENV['LOG_LEVEL'] ? ENV['LOG_LEVEL'].upcase : 'INFO')

config.after_initialize do
if %w{development test}.include?(Rails.env)
Expand Down
2 changes: 1 addition & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
config.active_support.deprecation = :log
config.assets.compile = true
config.assets.compress = false
config.assets.debug = true
config.assets.debug = false
config.cache_classes = false
config.consider_all_requests_local = true
config.host = 'localhost:3000'
Expand Down
5 changes: 2 additions & 3 deletions config/mongoid.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
development:
host: localhost
database: <%= ENV['MONGODB_DATABASE_NAME'] %>
# database: badgify_development
database: badgify_development

test:
host: localhost
database: badgiy_test
database: badgify_test

staging:
uri: <%= ENV['MONGOLAB_URI'] %>
Expand Down
10 changes: 7 additions & 3 deletions vagrant/user-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ cd $HOME/web
gem update --system && gem update bundler
bundle config --global jobs 3
bundle install
bundle exec rake db:create:all
bundle exec rake db:setup
bundle exec rake db:test:prepare

# Setup .env
cp .env.example .env -n

foreman run rake db:create:all
foreman run rake db:setup
foreman run rake db:test:prepare