Merge lp:~jose/charms/precise/tracks/use-lower-ports into lp:charms/tracks

Proposed by José Antonio Rey
Status: Merged
Merged at revision: 6
Proposed branch: lp:~jose/charms/precise/tracks/use-lower-ports
Merge into: lp:charms/tracks
Diff against target: 87 lines (+6/-29)
4 files modified
README.md (+1/-9)
config.yaml (+1/-1)
hooks/config-changed (+0/-11)
hooks/install (+4/-8)
To merge this branch: bzr merge lp:~jose/charms/precise/tracks/use-lower-ports
Reviewer Review Type Date Requested Status
Charles Butler (community) Approve
Tim Van Steenburgh (community) Approve
Review via email: mp+226764@code.launchpad.net

Description of the change

This merge will allow users to set ports lower than 1025 (80 as an example) for Tracks without the need of a proxy or anything.

To post a comment you must log in.
Revision history for this message
Tim Van Steenburgh (tvansteenburgh) wrote :

+1 LGTM. Tested deploying with default port (80) on lxc and also tested changing the port via `juju set`.

Thanks José!

review: Approve
Revision history for this message
Charles Butler (lazypower) wrote :

+1 LGTM

Thanks for the continued effort on the Tracks charm, making it a great addition to our charm library José!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README.md'
2--- README.md 2014-05-08 00:34:17 +0000
3+++ README.md 2014-07-15 01:06:48 +0000
4@@ -24,15 +24,7 @@
5 ## Configuration
6
7 This charm offers one configuration option, the port on which to run the web
8-server, default is 3000. At this point, it can not be ran in a port minor to
9-1025. If you set a port lower or equal to 1024, it will refuse to install
10-until you change it. If you want to use port 80, for example, you can add a
11-reverse proxy server, such as haproxy (also available in Juju).
12-
13-# Known Limitations
14-
15-As mentioned in the configuration part, the charm does not currently allow a
16-port number lower than 1025.
17+server, default is 80.
18
19 # Links
20
21
22=== modified file 'config.yaml'
23--- config.yaml 2014-05-08 00:34:17 +0000
24+++ config.yaml 2014-07-15 01:06:48 +0000
25@@ -1,5 +1,5 @@
26 options:
27 port:
28 type: int
29- default: 3000
30+ default: 80
31 description: The port number for the tracks webserver
32
33=== modified file 'hooks/config-changed'
34--- hooks/config-changed 2014-05-12 19:05:38 +0000
35+++ hooks/config-changed 2014-07-15 01:06:48 +0000
36@@ -4,17 +4,6 @@
37
38 PORT=`config-get port`
39
40-if [[ "$PORT" -lt 1025 ]]; then
41- juju-log "At this time, ports minor than 1024 are not supported. Please, change your port number."
42- exit 0
43-fi
44-
45-if [[ -f .portnotsupported ]] && [[ "$PORT" -lt 1024 ]]; then
46- juju-log "Yay, you've set a valid port now. Installing!"
47- hooks/install
48- rm .portnotsupported
49-fi
50-
51 if [ -f .port ] && [ `cat .port` != "${PORT}" ]; then
52 currentport=`cat .port`
53 juju-log "Switching port to ${PORT}"
54
55=== modified file 'hooks/install'
56--- hooks/install 2014-05-12 19:05:38 +0000
57+++ hooks/install 2014-07-15 01:06:48 +0000
58@@ -7,13 +7,6 @@
59
60 PORT=`config-get port`
61
62-juju-log "Checking if port is >1024"
63-if [[ "$PORT" -lt 1025 ]]; then
64- juju-log "At this point, the use of ports minor than 1025 are not supported. Please, change your port number."
65- touch .portnotsupported
66- exit 0
67-fi
68-
69 juju-log "creating user tracks"
70 useradd -rm tracks
71
72@@ -23,7 +16,8 @@
73 apt-get install -qqy unzip ruby2.1 build-essential libmysqlclient-dev \
74 libruby sqlite3 libmysql-ruby libmysql-ruby libsqlite3-ruby libsqlite3-dev \
75 imagemagick graphicsmagick libgraphicsmagick1-dev librmagick-ruby \
76-libxslt-dev libxml2-dev pwgen rubygems mysql-client wget ruby2.1-dev
77+libxslt-dev libxml2-dev pwgen rubygems mysql-client wget ruby2.1-dev \
78+libcap2-bin
79
80 juju-log "installing tracks"
81 cd /home/tracks/
82@@ -67,3 +61,5 @@
83 bundle exec rails server -e production -p \$PORT
84 end script
85 EOF
86+
87+setcap cap_net_bind_service=+ep /usr/bin/ruby2.1

Subscribers

People subscribed via source and target branches

to all changes: