Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 13c7fe5

Browse files
SergKSergiy Kulanov
authored andcommitted
Rename ckan.ini to production.ini
Fixes: ckan#3776
1 parent a23bfae commit 13c7fe5

6 files changed

Lines changed: 32 additions & 34 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ ENTRYPOINT ["/ckan-entrypoint.sh"]
5555
USER ckan
5656
EXPOSE 5000
5757

58-
CMD ["ckan-paster","serve","/etc/ckan/ckan.ini"]
58+
CMD ["ckan-paster","serve","/etc/ckan/production.ini"]

contrib/docker/apache.wsgi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ activate_this = os.path.join(ckan_home, 'bin/activate_this.py')
44
execfile(activate_this, dict(__file__=activate_this))
55

66
from paste.deploy import loadapp
7-
config_filepath = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'ckan.ini')
7+
config_filepath = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'production.ini')
88
from paste.script.util.logging_config import fileConfig
99
fileConfig(config_filepath)
1010
application = loadapp('config:%s' % config_filepath)

contrib/docker/ckan-entrypoint.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set -e
1111
# URL for datapusher (required unless linked to a container called 'datapusher')
1212
: ${CKAN_DATAPUSHER_URL:=}
1313

14-
CONFIG="${CKAN_CONFIG}/ckan.ini"
14+
CONFIG="${CKAN_CONFIG}/production.ini"
1515

1616
abort () {
1717
echo "$@" >&2
@@ -62,6 +62,5 @@ if [ -z "$CKAN_DATAPUSHER_URL" ]; then
6262
fi
6363

6464
set_environment
65-
ckan-paster --plugin=ckan db init -c "${CKAN_CONFIG}/ckan.ini"
65+
ckan-paster --plugin=ckan db init -c "${CKAN_CONFIG}/production.ini"
6666
exec "$@"
67-

contrib/docker/my_init.d/50_configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
set -eu
1212

13-
CONFIG="${CKAN_CONFIG}/ckan.ini"
13+
CONFIG="${CKAN_CONFIG}/production.ini"
1414

1515
abort () {
1616
echo "$@" >&2

contrib/docker/my_init.d/70_initdb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
set -eu
33

4-
"$CKAN_HOME"/bin/paster --plugin=ckan db init -c "${CKAN_CONFIG}/ckan.ini"
4+
"$CKAN_HOME"/bin/paster --plugin=ckan db init -c "${CKAN_CONFIG}/production.ini"

doc/maintaining/installing/install-from-docker-compose.rst

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ There should be four named Docker volumes (``docker volume ls | grep docker``).
131131
prefixed with the Docker Compose project name (default: ``docker`` or value of host environment
132132
variable ``COMPOSE_PROJECT_NAME``.)
133133

134-
* ``docker_ckan_config``: home of ckan.ini
134+
* ``docker_ckan_config``: home of production.ini
135135
* ``docker_ckan_home``: home of ckan venv and source, later also additional CKAN extensions
136136
* ``docker_ckan_storage``: home of CKAN's filestore (resource files)
137137
* ``docker_pg_data``: home of the database files for CKAN's default and datastore databases
@@ -167,14 +167,14 @@ against the database and import / export files from ``$VOL_CKAN_HOME``.
167167
3. Datastore and datapusher
168168
---------------------------
169169
To enable the datastore, the datastore database and database users have to be created before
170-
enabling the datastore and datapusher settings in the ``ckan.ini``.
170+
enabling the datastore and datapusher settings in the ``production.ini``.
171171

172172
a. Create and configure datastore database
173173

174174
With running CKAN containers, execute the built-in setup scripts against the ``db`` container::
175175

176176
docker exec -it db psql -U ckan -f 00_create_datastore.sql
177-
docker exec ckan /usr/local/bin/ckan-paster --plugin=ckan datastore set-permissions -c /etc/ckan/ckan.ini | docker exec -i db psql -U ckan
177+
docker exec ckan /usr/local/bin/ckan-paster --plugin=ckan datastore set-permissions -c /etc/ckan/production.ini | docker exec -i db psql -U ckan
178178

179179
The first script will create the datastore database and the datastore readonly user in the ``db``
180180
container. The second script is the output of ``paster ckan set-permissions`` - however,
@@ -189,13 +189,13 @@ The effect of these scripts is persisted in the named volume ``docker_pg_data``.
189189
Hard-coding the database table and usernames allows to prepare the set-permissions SQL script,
190190
while not exposing sensitive information to the world outside the Docker host environment.
191191

192-
After this step, the datastore database is ready to be enabled in the ``ckan.ini``.
192+
After this step, the datastore database is ready to be enabled in the ``production.ini``.
193193

194-
b. Enable datastore and datapusher in ``ckan.ini``
194+
b. Enable datastore and datapusher in ``production.ini``
195195

196-
Edit the ``ckan.ini`` (note: requires sudo)::
196+
Edit the ``production.ini`` (note: requires sudo)::
197197

198-
sudo vim $VOL_CKAN_CONFIG/ckan.ini
198+
sudo vim $VOL_CKAN_CONFIG/production.ini
199199

200200
Add ``datastore datapusher`` to ``ckan.plugins`` and enable the datapusher option
201201
``ckan.datapusher.formats``.
@@ -209,7 +209,7 @@ The remaining settings required for datastore and datapusher are already taken c
209209
``ckan.datastore.read_url = postgresql://datastore:DATASTORE_READONLY_PASSWORD@db/datastore``
210210
are provided by ``docker-compose.yml``.
211211

212-
Restart the ``ckan`` container to apply changes to the ``ckan.ini``::
212+
Restart the ``ckan`` container to apply changes to the ``production.ini``::
213213

214214
docker-compose restart ckan
215215

@@ -222,15 +222,15 @@ Now the datastore API should return content when visiting::
222222
-------------------------
223223
With all images up and running, create the CKAN admin user (johndoe in this example)::
224224

225-
docker exec -it ckan /usr/local/bin/ckan-paster --plugin=ckan sysadmin -c /etc/ckan/ckan.ini add johndoe
225+
docker exec -it ckan /usr/local/bin/ckan-paster --plugin=ckan sysadmin -c /etc/ckan/production.ini add johndoe
226226

227227
Now you should be able to login to the new, empty CKAN.
228228
The admin user's API key will be instrumental in tranferring data from other instances.
229229

230230
---------------
231231
5. Migrate data
232232
---------------
233-
This section illustrates the data migration from an existing CKAN instance ``SOURCE_CKAN``
233+
This section illustrates the data migration from an existing CKAN instance ``SOURCE_CKAN``
234234
into our new Docker Compose CKAN instance assuming direct (ssh) access to ``SOURCE_CKAN``.
235235

236236
a. Transfer resource files
@@ -279,17 +279,17 @@ d. Rebuild search index
279279

280280
Trigger a Solr index rebuild::
281281

282-
docker exec -it ckan /usr/local/bin/ckan-paster --plugin=ckan search-index rebuild -c /etc/ckan/ckan.ini
282+
docker exec -it ckan /usr/local/bin/ckan-paster --plugin=ckan search-index rebuild -c /etc/ckan/production.ini
283283

284284
-----------------
285285
6. Add extensions
286286
-----------------
287287
There are two scenarios to add extensions:
288288

289289
* Maintainers of production instances need extensions to be part of the ``ckan`` image and an
290-
easy way to enable them in the ``ckan.ini``.
290+
easy way to enable them in the ``production.ini``.
291291
Automating the installation of existing extensions (without needing to change their source)
292-
requires customizing CKAN's ``Dockerfile`` and scripted post-processing of the ``ckan.ini``.
292+
requires customizing CKAN's ``Dockerfile`` and scripted post-processing of the ``production.ini``.
293293
* Developers need to read, modify and use version control on the extensions' source. This adds
294294
additional steps to the maintainers' workflow.
295295

@@ -302,7 +302,7 @@ For maintainers, the process is in summary:
302302
a. Download and install extension from inside ``ckan`` container into ``docker_ckan_home`` volume
303303

304304
The process is very similar to installing extensions in a source install. The only difference is
305-
that the installation steps will happen inside the running container, and they will use the
305+
that the installation steps will happen inside the running container, and they will use the
306306
virtualenv created inside the ckan image by CKAN's Dockerfile.
307307

308308
The downloaded and installed files will be persisted in the named volume ``docker_ckan_home``.
@@ -352,11 +352,11 @@ E.g., `ckanext-spatial <https://github.com/ckan/ckanext-spatial.git>`_::
352352

353353
# On the host
354354
docker exec -it db psql -U ckan -f 20_postgis_permissions.sql
355-
docker exec -it ckan /usr/local/bin/ckan-paster --plugin=ckanext-spatial spatial initdb -c /etc/ckan/ckan.ini
355+
docker exec -it ckan /usr/local/bin/ckan-paster --plugin=ckanext-spatial spatial initdb -c /etc/ckan/production.ini
356356

357-
sudo vim $VOL_CKAN_CONFIG/ckan.ini
357+
sudo vim $VOL_CKAN_CONFIG/production.ini
358358

359-
# Inside ckan.ini, add to [plugins]:
359+
# Inside production.ini, add to [plugins]:
360360
spatial_metadata spatial_query
361361

362362
ckanext.spatial.search_backend = solr
@@ -365,9 +365,9 @@ b. Modify CKAN config
365365

366366
Follow the respective extension's instructions to set CKAN config variables::
367367

368-
sudo vim $VOL_CKAN_CONFIG/ckan.ini
368+
sudo vim $VOL_CKAN_CONFIG/production.ini
369369

370-
.. todo:: Demonstrate how to set ``ckan.ini`` settings from environment variables using
370+
.. todo:: Demonstrate how to set ``production.ini`` settings from environment variables using
371371
``ckanext-envvars``.
372372

373373
c. Reload and debug
@@ -408,16 +408,16 @@ Option 1: Accessing the source from inside the container::
408408
# in extension folder:
409409
python setup.py install
410410
exit
411-
# ... edit extension settings in ckan.ini and restart ckan container
412-
sudo vim $VOL_CKAN_CONFIG/ckan.ini
411+
# ... edit extension settings in production.ini and restart ckan container
412+
sudo vim $VOL_CKAN_CONFIG/production.ini
413413
docker-compose restart ckan
414414

415415
Option 2: Accessing the source from outside the container using ``sudo``::
416416

417-
sudo vim $VOL_CKAN_CONFIG/ckan.ini
417+
sudo vim $VOL_CKAN_CONFIG/production.ini
418418
sudo vim $VOL_CKAN_HOME/venv/src/ckanext-datawagovautheme/ckanext/datawagovautheme/templates/package/search.html
419419

420-
Option 3:: The Ubuntu package ``bindfs`` makes the write-protected volumes accessible to a system
420+
Option 3: The Ubuntu package ``bindfs`` makes the write-protected volumes accessible to a system
421421
user::
422422

423423
sudo apt-get install bindfs
@@ -436,7 +436,7 @@ user::
436436
Changes in HTML templates and CSS will be visible right away.
437437
For changes in code, we'll need to unmount the directory, change ownership back to the ``ckan``
438438
user, and follow the previous steps to ``python setup.py install`` and
439-
``pip install -r requirements.txt`` from within the running container, modify the ``ckan.ini``
439+
``pip install -r requirements.txt`` from within the running container, modify the ``production.ini``
440440
and restart the container::
441441

442442
sudo umount ~/VOL_CKAN_HOME
@@ -467,10 +467,10 @@ Variable substitution propagates as follows:
467467
(when building the images) and / or as run time variables (when running the containers).
468468
* ``ckan-entrypoint.sh`` has access to all run time variables of the ``ckan`` service.
469469
* ``ckan-entrypoint.sh`` injects environment variables (e.g. ``CKAN_SQLALCHEMY_URL``) into the
470-
running ``ckan`` container, overriding the CKAN config variables from ``ckan.ini``.
470+
running ``ckan`` container, overriding the CKAN config variables from ``production.ini``.
471471

472472
See :doc:`/maintaining/configuration` for a list of environment variables
473-
(e.g. ``CKAN_SQLALCHEMY_URL``) which CKAN will accept to override ``ckan.ini``.
473+
(e.g. ``CKAN_SQLALCHEMY_URL``) which CKAN will accept to override ``production.ini``.
474474

475475
After adding new or changing existing ``.env`` variables, locally built images and volumes may
476476
need to be dropped and rebuilt. Otherwise, docker will re-use cached images with old or missing
@@ -508,4 +508,3 @@ A possible path towards a production-ready environment is:
508508
* Transfer production data into the new server as described above using volume orchestration
509509
tools or transferring files directly.
510510
* Bonus: contribute a write-up of working production setups to the CKAN documentation.
511-

0 commit comments

Comments
 (0)