Commit 8a4171df95f8bd3d79c2dbf3b5b60482c639abf7
1 parent
8bbc954e
Exists in
master
and in
39 other branches
Fixed spec for remote database installation
Showing
1 changed file
with
47 additions
and
47 deletions
Show diff stats
colab.spec
1 | 1 | %define name colab |
2 | -%define version 2.0a2 | |
3 | -%define unmangled_version 2.0a2 | |
4 | -%define release 2 | |
2 | +%define version 2.0a3 | |
3 | +%define unmangled_version 2.0a3 | |
4 | +%define release 3 | |
5 | 5 | %define buildvenv /var/tmp/%{name}-%{version} |
6 | 6 | |
7 | 7 | Summary: Collaboration platform for communities |
... | ... | @@ -91,41 +91,23 @@ fi |
91 | 91 | |
92 | 92 | usermod --append --groups mailman colab |
93 | 93 | |
94 | -# only applies if there is a local PostgreSQL server | |
95 | -if [ -x /usr/bin/postgres ]; then | |
96 | - | |
97 | - # start/enable the service | |
98 | - postgresql-setup initdb || true | |
99 | - systemctl start postgresql | |
100 | - systemctl enable postgresql | |
101 | - | |
102 | - if [ "$(sudo -u postgres -i psql --quiet --tuples-only -c "select count(*) from pg_user where usename = 'colab';")" -eq 0 ]; then | |
103 | - # create user | |
104 | - sudo -u postgres -i createuser colab | |
105 | - fi | |
106 | - | |
107 | - if [ "$(sudo -u postgres -i psql --quiet --tuples-only -c "select count(1) from pg_database where datname = 'colab';")" -eq 0 ]; then | |
108 | - # create database | |
109 | - sudo -u postgres -i createdb --owner=colab colab | |
110 | - fi | |
111 | - | |
112 | - mkdir -p /etc/colab | |
94 | +mkdir -p /etc/colab | |
113 | 95 | |
114 | - if [ ! -f /etc/colab/settings.yaml ]; then | |
115 | - SECRET_KEY=$(openssl rand -hex 32) | |
116 | - cat > /etc/colab/settings.yaml <<EOF | |
96 | +if [ ! -f /etc/colab/settings.yaml ]; then | |
97 | + SECRET_KEY=$(openssl rand -hex 32) | |
98 | + cat > /etc/colab/settings.yaml <<EOF | |
117 | 99 | ## Set to false in production |
118 | 100 | DEBUG: true |
119 | 101 | TEMPLATE_DEBUG: true |
120 | 102 | |
121 | 103 | ## System admins |
122 | 104 | ADMINS: &admin |
123 | - - | |
124 | - - John Foo | |
125 | - - john@example.com | |
126 | - - | |
127 | - - Mary Bar | |
128 | - - mary@example.com | |
105 | +- | |
106 | + - John Foo | |
107 | + - john@example.com | |
108 | +- | |
109 | + - Mary Bar | |
110 | + - mary@example.com | |
129 | 111 | |
130 | 112 | MANAGERS: *admin |
131 | 113 | |
... | ... | @@ -140,13 +122,13 @@ SECRET_KEY: '$SECRET_KEY' |
140 | 122 | |
141 | 123 | SITE_URL: 'http://localhost:8000' |
142 | 124 | BROWSERID_AUDIENCES: |
143 | - - http://localhost:8000 | |
125 | +- http://localhost:8000 | |
144 | 126 | # - http://example.com |
145 | 127 | # - https://example.org |
146 | 128 | # - http://example.net |
147 | 129 | |
148 | 130 | ALLOWED_HOSTS: |
149 | - - localhost | |
131 | +- localhost | |
150 | 132 | # - example.com |
151 | 133 | # - example.org |
152 | 134 | # - example.net |
... | ... | @@ -161,27 +143,45 @@ ROBOTS_NOINDEX: false |
161 | 143 | ## Enabled BROWSER_ID protocol |
162 | 144 | # BROWSERID_ENABLED: True |
163 | 145 | EOF |
164 | - chown root:colab /etc/colab/settings.yaml | |
165 | - chmod 0640 /etc/colab/settings.yaml | |
166 | - fi | |
146 | + chown root:colab /etc/colab/settings.yaml | |
147 | + chmod 0640 /etc/colab/settings.yaml | |
148 | +fi | |
167 | 149 | |
168 | - mkdir -p /etc/colab/settings.d | |
150 | +mkdir -p /etc/colab/settings.d | |
169 | 151 | |
170 | - if [ ! -f /etc/colab/settings.d/00-database.yaml ]; then | |
171 | - cat > /etc/colab/settings.d/00-database.yaml <<EOF | |
152 | +if [ ! -f /etc/colab/settings.d/00-database.yaml ]; then | |
153 | + cat > /etc/colab/settings.d/00-database.yaml <<EOF | |
172 | 154 | DATABASES: |
173 | - default: | |
174 | - ENGINE: django.db.backends.postgresql_psycopg2 | |
175 | - NAME: colab | |
176 | - USER: colab | |
155 | +default: | |
156 | + ENGINE: django.db.backends.postgresql_psycopg2 | |
157 | + NAME: colab | |
158 | + USER: colab | |
159 | + HOST: localhost | |
160 | + PORT: 5432 | |
177 | 161 | EOF |
178 | - chown root:colab /etc/colab/settings.d/00-database.yaml | |
179 | - chmod 0640 /etc/colab/settings.d/00-database.yaml | |
162 | + chown root:colab /etc/colab/settings.d/00-database.yaml | |
163 | + chmod 0640 /etc/colab/settings.d/00-database.yaml | |
164 | +fi | |
165 | + | |
166 | + | |
167 | +# only applies if there is a local PostgreSQL server | |
168 | +if [ -x /usr/bin/postgres ]; then | |
169 | + | |
170 | + # start/enable the service | |
171 | + postgresql-setup initdb || true | |
172 | + systemctl start postgresql | |
173 | + systemctl enable postgresql | |
174 | + | |
175 | + if [ "$(sudo -u postgres -i psql --quiet --tuples-only -c "select count(*) from pg_user where usename = 'colab';")" -eq 0 ]; then | |
176 | + # create user | |
177 | + sudo -u postgres -i createuser colab | |
180 | 178 | fi |
181 | 179 | |
182 | -fi | |
180 | + if [ "$(sudo -u postgres -i psql --quiet --tuples-only -c "select count(1) from pg_database where datname = 'colab';")" -eq 0 ]; then | |
181 | + # create database | |
182 | + sudo -u postgres -i createdb --owner=colab colab | |
183 | + fi | |
183 | 184 | |
184 | -if [ -f /etc/colab/settings.yaml ]; then | |
185 | 185 | colab-admin migrate |
186 | 186 | fi |
187 | 187 | ... | ... |