@@ -244,6 +244,7 @@ Edit the `Procfile` and choose one of the suggested versions for production |
||
244 | 244 |
|
245 | 245 |
Export the init scripts using foreman: |
246 | 246 |
|
247 |
+ sudo rm /etc/init/huginn* |
|
247 | 248 |
sudo foreman export upstart -a huginn /etc/init |
248 | 249 |
|
249 | 250 |
**Note:** You have to re-export the init script every time you change the configuration in `.env`! |
@@ -332,6 +333,7 @@ Restart Nginx, export the init script and restart Huginn: |
||
332 | 333 |
``` |
333 | 334 |
cd /home/huginn/huginn |
334 | 335 |
sudo service nginx restart |
336 |
+sudo rm /etc/init/huginn* |
|
335 | 337 |
sudo foreman export upstart -a huginn /etc/init |
336 | 338 |
sudo restart huginn |
337 | 339 |
``` |
@@ -0,0 +1,87 @@ |
||
1 |
+# Update |
|
2 |
+ |
|
3 |
+### 0. Stop server |
|
4 |
+ |
|
5 |
+``` |
|
6 |
+sudo stop huginn |
|
7 |
+``` |
|
8 |
+ |
|
9 |
+### 1. Store the current version |
|
10 |
+ |
|
11 |
+``` |
|
12 |
+cd /home/huginn/huginn |
|
13 |
+export OLD_VERSION=`git rev-parse HEAD` |
|
14 |
+``` |
|
15 |
+ |
|
16 |
+### 2. Update the code |
|
17 |
+ |
|
18 |
+Back up changed files |
|
19 |
+ |
|
20 |
+``` |
|
21 |
+sudo -u huginn -H cp Procfile Procfile.bak |
|
22 |
+``` |
|
23 |
+ |
|
24 |
+Get the new code |
|
25 |
+``` |
|
26 |
+sudo -u huginn -H git fetch --all |
|
27 |
+sudo -u huginn -H git checkout -- db/schema.rb Procfile |
|
28 |
+sudo -u huginn -H git checkout master |
|
29 |
+sudo -u huginn -H git pull |
|
30 |
+``` |
|
31 |
+ |
|
32 |
+Restore backed up files |
|
33 |
+ |
|
34 |
+``` |
|
35 |
+sudo -u huginn -H cp Procfile.bak Procfile |
|
36 |
+``` |
|
37 |
+ |
|
38 |
+### 3. Install gems, migrate and precompile assets |
|
39 |
+ |
|
40 |
+``` |
|
41 |
+cd /home/huginn/huginn |
|
42 |
+ |
|
43 |
+sudo -u huginn -H bundle install --deployment --without development test |
|
44 |
+ |
|
45 |
+# Run database migrations |
|
46 |
+sudo -u huginn -H bundle exec rake db:migrate RAILS_ENV=production |
|
47 |
+ |
|
48 |
+# Clean up assets and cache |
|
49 |
+sudo -u huginn -H bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production |
|
50 |
+ |
|
51 |
+``` |
|
52 |
+ |
|
53 |
+### 4. Update the Procfile |
|
54 |
+ |
|
55 |
+Check for changes made to the default `Procfile` |
|
56 |
+``` |
|
57 |
+sudo -u huginn -H git diff $OLD_VERSION..master Procfile |
|
58 |
+``` |
|
59 |
+ |
|
60 |
+Update your `Procfile` if the default options of the version you are using changed |
|
61 |
+``` |
|
62 |
+sudo -u huginn -H editor Procfile |
|
63 |
+``` |
|
64 |
+ |
|
65 |
+### 5. Update the .env file |
|
66 |
+ |
|
67 |
+Check for changes made to the example `.env` |
|
68 |
+``` |
|
69 |
+sudo -u huginn -H git diff $OLD_VERSION..master .env.example |
|
70 |
+``` |
|
71 |
+ |
|
72 |
+Update your `.env` with new options or changed defaults |
|
73 |
+``` |
|
74 |
+sudo -u huginn -H editor .env |
|
75 |
+``` |
|
76 |
+ |
|
77 |
+ |
|
78 |
+### 6. Export init script and start huginn |
|
79 |
+ |
|
80 |
+``` |
|
81 |
+# Export the init script |
|
82 |
+sudo rm /etc/init/huginn* |
|
83 |
+sudo foreman export upstart -a huginn /etc/init |
|
84 |
+# Start huginn |
|
85 |
+sudo start huginn |
|
86 |
+``` |
|
87 |
+ |