Skip to content

Commit 2f2016c

Browse files
committed
Merge pull request coderwall#3 from whatupdave/vagrant-fixes
Vagrant fixes
2 parents e023df9 + f2e210a commit 2f2016c

File tree

9 files changed

+32
-15
lines changed

9 files changed

+32
-15
lines changed

.env.example

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ MAILGUN_TOKEN=mailgun_token
2020
MIXPANEL_API_SECRET=mixpanel_api_secret
2121
MIXPANEL_TOKEN=mixpanel_token
2222

23-
MONGODB_DATABASE_NAME=coderwall
24-
2523
NOTIFIER_ADMIN_EMAILS="['notifier_admin@example.com']"
2624

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

3432
STRIPE_PUBLISHABLE_KEY=pk_test_stripe_publishable_key
35-
STRIPE_SECRET_KEY=sk_test_stripe_secret_key
33+
STRIPE_SECRET_KEY=sk_test_BQokikJOvBiI2HlWgH4olfQ2
3634

3735
SUPPORT_EMAIL=support@example.com
3836

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
.DS_Store
88
.bundle
99
.config
10-
.env
10+
*.env
1111
.idea
1212
.sass-cache
1313
.vagrant

Vagrantfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,21 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
3636
config.vm.network :forwarded_port, guest: 9292, host: 9293, auto_correct: true
3737

3838
config.vm.synced_folder '.', '/home/vagrant/web', nfs: true
39-
config.vm.synced_folder './vagrant', '/home/vagrant/provision', nfs: true
40-
config.vm.synced_folder './vagrant/dotfiles', '/home/vagrant/dotfiles', nfs: true
39+
# config.vm.synced_folder './vagrant', '/home/vagrant/provision', nfs: true
40+
# config.vm.synced_folder './vagrant/dotfiles', '/home/vagrant/dotfiles', nfs: true
4141

4242
config.vm.provider :virtualbox do |vb|
4343
vb.customize ['modifyvm', :id, '--cpus', '4']
4444
vb.customize ['modifyvm', :id, '--ioapic', 'on']
4545
vb.customize ['modifyvm', :id, '--memory', '4096']
46+
47+
# https://github.com/mitchellh/vagrant/issues/1807
48+
# whatupdave: my VM was super slow until I added these:
49+
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
50+
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
51+
# seems to be safe to run: https://github.com/griff/docker/commit/e5239b98598ece4287c1088e95a2eaed585d2da4
4652
end
53+
4754
config.vbguest.auto_update = true
4855
config.vbguest.no_remote = false
4956
end

app/controllers/accounts_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ def create
1717

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

2223
if @account.save_with_payment(@plan)
2324
unless @team.is_member?(current_user)

app/models/protip.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,13 @@ def already_created_a_protip_for(url)
401401
end
402402

403403
def valid_reviewers
404-
Rails.cache.fetch('valid_protip_reviewers', expires_in: 1.month) { User.where(username: YAML.load(ENV['REVIEWERS'])).all }
404+
Rails.cache.fetch('valid_protip_reviewers', expires_in: 1.month) do
405+
if ENV['REVIEWERS']
406+
User.where(username: YAML.load(ENV['REVIEWERS'])).all
407+
else
408+
[]
409+
end
410+
end
405411
end
406412

407413
end

config/application.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ class Application < Rails::Application
3333
config.ember.variant = Rails.env.downcase.to_sym
3434
config.assets.js_compressor = :uglifier
3535

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

3739
config.after_initialize do
3840
if %w{development test}.include?(Rails.env)

config/environments/development.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
config.active_support.deprecation = :log
77
config.assets.compile = true
88
config.assets.compress = false
9-
config.assets.debug = true
9+
config.assets.debug = false
1010
config.cache_classes = false
1111
config.consider_all_requests_local = true
1212
config.host = 'localhost:3000'

config/mongoid.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
development:
22
host: localhost
3-
database: <%= ENV['MONGODB_DATABASE_NAME'] %>
4-
# database: badgify_development
3+
database: badgify_development
54

65
test:
76
host: localhost
8-
database: badgiy_test
7+
database: badgify_test
98

109
staging:
1110
uri: <%= ENV['MONGOLAB_URI'] %>

vagrant/user-config.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ cd $HOME/web
2323
gem update --system && gem update bundler
2424
bundle config --global jobs 3
2525
bundle install
26-
bundle exec rake db:create:all
27-
bundle exec rake db:setup
28-
bundle exec rake db:test:prepare
26+
27+
# Setup .env
28+
cp .env.example .env -n
29+
30+
foreman run rake db:create:all
31+
foreman run rake db:setup
32+
foreman run rake db:test:prepare

0 commit comments

Comments
 (0)