Merge Request #37

Merged
softwarepublico/colab!37
Created by Lucas Kanashiro

Fix spec

Fixe spec to remote database installation

Assignee: Alexandre Barbosa
Milestone: None

Merged by Sergio Oliveira

Source branch has been removed
Commits (2)
2 participants
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: &#39;$SECRET_KEY&#39;
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  
... ...
setup.py
... ... @@ -69,7 +69,7 @@ EXCLUDE_FROM_PACKAGES = []
69 69  
70 70 setup(
71 71 name='colab',
72   - version='2.0a2',
  72 + version='2.0a3',
73 73 url='https://github.com/colab-community/colab',
74 74 author='Sergio Oliveira',
75 75 author_email='sergio@tracy.com.br',
... ...