commit
4b4ce2c816
14
README.md
14
README.md
|
@ -190,7 +190,9 @@ Use this if you are a maintainer and will not be making code changes to CKAN or
|
|||
> Please note that when accessing CKAN directly (via a browser) ie: not going through Apache/NGINX you will need to make sure you have "ckan" set up to be an alias to localhost in the local hosts file. Either that or you will need to change the `.env` entry for `CKAN_SITE_URL`
|
||||
|
||||
>**Warning**:<br>
|
||||
> Using the default values on the `.env` file will get you a working CKAN instance. There is a sysadmin user created by default with the values defined in `CKAN_SYSADMIN_NAME` and `CKAN_SYSADMIN_PASSWORD`(`ckan_admin` and `test1234` by default). **This should be obviously changed before running this setup as a public CKAN instance.**
|
||||
> Using the default values on the `.env` file will get you a working CKAN instance. There is a sysadmin user created by default with the values defined in `CKAN_SYSADMIN_NAME` and `CKAN_SYSADMIN_PASSWORD` (`ckan_admin` and `test1234` by default). All ennvars with `API_TOKEN` are automatically regenerated when CKAN is loaded, no editing is required.
|
||||
>
|
||||
>**This should be obviously changed before running this setup as a public CKAN instance.**
|
||||
|
||||
3. Build the images:
|
||||
```bash
|
||||
|
@ -319,12 +321,12 @@ The new extension files and directories are created in the `/srv/app/src_extensi
|
|||
|
||||
|
||||
## CKAN images
|
||||
![ckan images](https://user-images.githubusercontent.com/54408245/207079416-a01235af-2dea-4425-b6fd-f8c3687dd993.png)
|
||||
![CKAN Docker Platform](/doc/img/ckan-docker-images.png)
|
||||
|
||||
The Docker image config files used to build your CKAN project are located in the `ckan/` folder. There are two Docker files:
|
||||
|
||||
* `Dockerfile`: this is based on `ckan/ckan-base:<version>`, a base image located in the DockerHub repository, that has CKAN installed along with all its dependencies, properly configured and running on [uWSGI](https://uwsgi-docs.readthedocs.io/en/latest/) (production setup)
|
||||
* `Dockerfile.dev`: this is based on `ckan/ckan-base:<version>-dev` also located located in the DockerHub repository, and extends `ckan/ckan-base:<version>` to include:
|
||||
* `Dockerfile`: this is based on `ckan/ckan-base-spatial:<version>`, a base image located in the [Github Package Registry](https://github.com/mjanez/ckan-docker/pkgs/container/ckan-base-spatial), that has CKAN installed along with all its dependencies, properly configured and running on [uWSGI](https://uwsgi-docs.readthedocs.io/en/latest/) (production setup)
|
||||
* `Dockerfile.dev`: this is based on `ckan/ckan-base-spatial:<version>-dev` also located located in the Github Package Registry, and extends `ckan/ckan-base-spatial:<version>` to include:
|
||||
|
||||
* Any extension cloned on the `src` folder will be installed in the CKAN container when booting up Docker Compose (`docker compose up`). This includes installing any requirements listed in a `requirements.txt` (or `pip-requirements.txt`) file and running `python setup.py develop`.
|
||||
* CKAN is started running this: `/usr/bin/ckan -c /srv/app/ckan.ini run -H 0.0.0.0`.
|
||||
|
@ -333,7 +335,7 @@ The Docker image config files used to build your CKAN project are located in the
|
|||
|
||||
## CKAN images enhancement
|
||||
### Extending the base images
|
||||
You can modify the docker files to build your own customized image tailored to your project, installing any extensions and extra requirements needed. For example here is where you would update to use a different CKAN base image ie: `ckan/ckan-base:<new version>`
|
||||
You can modify the docker files to build your own customized image tailored to your project, installing any extensions and extra requirements needed. For example here is where you would update to use a different CKAN base image ie: `ckan/ckan-base-spatial:<new version>`
|
||||
|
||||
To perform extra initialization steps you can add scripts to your custom images and copy them to the `/docker-entrypoint.d` folder (The folder should be created for you when you build the image). Any `*.sh` and `*.py` file in that folder will be executed just after the main initialization script ([`prerun.py`](https://github.com/ckan/ckan-docker-base/blob/main/ckan-2.9/base/setup/prerun.py)) is executed and just before the web server and supervisor processes are started.
|
||||
|
||||
|
@ -359,7 +361,7 @@ ckan -c /srv/app/ckan.ini validation init-db
|
|||
And then in our `Dockerfile.dev` file we install the extension and copy the initialization scripts:
|
||||
|
||||
```Dockerfile
|
||||
FROM ckan/ckan-base:2.9.8-dev
|
||||
FROM ckan/ckan-base-spatial:2.9.8
|
||||
|
||||
RUN pip install -e git+https://github.com/frictionlessdata/ckanext-validation.git#egg=ckanext-validation && \
|
||||
pip install -r https://raw.githubusercontent.com/frictionlessdata/ckanext-validation/master/requirements.txt
|
||||
|
|
|
@ -1,14 +1,29 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Set the name of the token to revoke
|
||||
TOKEN_NAME="xloader"
|
||||
|
||||
# Get the list of tokens and extract the IDs for tokens with the specified name
|
||||
TOKEN_IDS=$(ckan -c $CKAN_INI user token list ckan_admin | grep "$TOKEN_NAME" | awk -F'[][]' '{print $2}' | tr -d '[]')
|
||||
|
||||
# Revoke each previous token of xloader
|
||||
for TOKEN_ID in $TOKEN_IDS
|
||||
do
|
||||
ckan -c $CKAN_INI user token revoke $TOKEN_ID
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "API Token $TOKEN_ID has been revoked"
|
||||
fi
|
||||
done
|
||||
|
||||
# Add ckanext.xloader.api_token to the CKAN config file
|
||||
echo "Loading ckanext-xloader settings in the CKAN config file"
|
||||
ckan config-tool $CKAN_INI \
|
||||
"ckanext.xloader.api_token = xxx" \
|
||||
"ckanext.xloader.jobs_db.uri = $CKANEXT__XLOADER__JOBS__DB_URI"
|
||||
"ckanext.xloader.api_token=xxx" \
|
||||
"ckanext.xloader.jobs_db.uri=$CKANEXT__XLOADER__JOBS__DB_URI"
|
||||
|
||||
# Create ckanext-xloader API_TOKEN
|
||||
echo "Set up ckanext.xloader.api_token in the CKAN config file"
|
||||
ckan config-tool $CKAN_INI "ckanext.xloader.api_token = $(ckan -c $CKAN_INI user token add ckan_admin xloader | tail -n 1 | tr -d '\t')"
|
||||
ckan config-tool $CKAN_INI "ckanext.xloader.api_token=$(ckan -c $CKAN_INI user token add ckan_admin xloader | tail -n 1 | tr -d '\t')"
|
||||
|
||||
#TODO: Setup worker background
|
||||
#echo "Set up CKAN jobs worker"
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 194 KiB |
Loading…
Reference in New Issue