Skip to content

Commit 97baf5a

Browse files
committed
Merge branch 'master' of https://github.com/kandanapp/kandan
2 parents 623ff1b + 8a0c6f6 commit 97baf5a

File tree

5 files changed

+57
-1
lines changed

5 files changed

+57
-1
lines changed

DEPLOY.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,45 @@ Your app should be up and running now. The default admin user is `Admin` with pa
6262
## dotCloud
6363
Looking for community help here.
6464

65+
## AppFog
66+
You'll need an [AppFog account](https://www.appfog.com/) and the [af command line tool](https://docs.appfog.com/getting-started/af-cli) installed. Once that's all set up, login from the command line: `af login`. You'll be prompted for the username/password you set on AppFog. You're returned to your operating system's command prompt. It's not a terminal emulator.
67+
68+
If you want to use PostgreSQL rather than MySQL, provision the service on the Services page of the [console](https://console.appfog.com). Note the name of your database and app name on the console and substitute as appropriate.
69+
70+
git clone https://github.com/kandanapp/kandan.git
71+
cd kandan
72+
bundle install
73+
bundle exec rake assets:precompile
74+
af push your_app_name --path . --instances 1 --mem 256M --runtime ruby19
75+
76+
You'll answer a few questions; you'll probably get an error at the end about an invalid app description. That's okay, we'll fix that next:
77+
78+
Detected a Rails Application, is this correct? [Yn]: y
79+
1: AWS US East - Virginia
80+
2: AWS EU West - Ireland
81+
3: AWS Asia SE - Singapore
82+
4: Rackspace AZ 1 - Dallas
83+
5: HP AZ 2 - Las Vegas
84+
Select Infrastructure: 1
85+
Application Deployed URL [<your_app_name>.aws.af.cm]: <your_app_name>
86+
Memory reservation (128M, 256M, 512M, 1G, 2G) [256M]:
87+
How many instances? [1]:
88+
Bind existing services to '<your_app_name>'? [yN]: y
89+
1: kandan_production
90+
2: <your_app_name>-mysql-12781
91+
Which one?: 1
92+
Bind another? [yN]: n
93+
Create services to bind to '<your_app_name>'? [yN]:
94+
Would you like to save this configuration? [yN]: y
95+
Manifest written to manifest.yml.
96+
Creating Application: Error 300: Invalid application description
97+
98+
If you get the invalid app description, open manifest.yml in a text editor and remove the space from the description. (It defaults to Rails Application, which causes the error.) Then, at the terminal:
99+
100+
af update <your_app_name>
101+
102+
And you should also restart the app on AppFog (in the console). Then, Kandan should be available on your AppFox backend now! With your browser, visit the domain name assigned to you by AppFog (or create a CNAME record at your DNS provider to use an alternate).
103+
65104
## Heroic server install
66105
If you're looking to install Kandan on a private server, or to develop locally for lemonodor fame, then here is the path you must follow, young hero:
67106

app/controllers/channels_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def index
1212
more_activities = (channel.activities.count > Kandan::Config.options[:per_page])
1313
channel.activities.order('id DESC').includes(:user).page.each do |activity|
1414
activities.push activity.attributes.merge({
15-
:user => activity.user.as_json(:only => [:id, :ido_id, :email, :first_name, :last_name, :gravatar_hash, :active, :locale])
15+
:user => activity.user_or_deleted_user.as_json(:only => [:id, :ido_id, :email, :first_name, :last_name, :gravatar_hash, :active, :locale, :username])
1616
})
1717
end
1818

app/models/activity.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ class Activity < ActiveRecord::Base
33
belongs_to :channel
44

55
paginates_per Kandan::Config.options[:per_page]
6+
7+
def user_or_deleted_user
8+
self.user || User.deleted_user
9+
end
610
end

app/models/user.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,11 @@ def active_for_authentication?
2626
super && active?
2727
end
2828

29+
def self.deleted_user
30+
dummy_user = new(:username => "Deleted User", :gravatar_hash => "", :email => "")
31+
dummy_user.active = false
32+
33+
return dummy_user
34+
end
35+
2936
end

config/environments/development.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,10 @@
3434

3535
# Expands the lines which load the assets
3636
config.assets.debug = true
37+
38+
config.logger = Logger.new(STDOUT)
39+
config.logger.level = Logger.const_get(
40+
ENV['LOG_LEVEL'] ? ENV['LOG_LEVEL'].upcase : 'DEBUG'
41+
)
42+
3743
end

0 commit comments

Comments
 (0)