Skip to content

Commit

Permalink
Merge branch 'master' into Update-healthcheck-to-Docker-Compose
Browse files Browse the repository at this point in the history
  • Loading branch information
kowh-ai committed Oct 11, 2024
2 parents 26dd5bd + 01a91ea commit fbef360
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 16 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ CKAN_SMTP_STARTTLS=True
CKAN_SMTP_USER=user
CKAN_SMTP_PASSWORD=pass
CKAN_SMTP_MAIL_FROM=ckan@localhost
CKAN_MAX_UPLOAD_SIZE_MB=100
TZ=UTC

# Solr
Expand Down
49 changes: 36 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The CKAN images used are from the official CKAN [ckan-docker](https://github.com

The non-CKAN images are as follows:

* DataPusher: CKAN's [pre-configured DataPusher image](https://github.com/ckan/ckan-base/tree/main/datapusher).
* DataPusher: CKAN's [pre-configured DataPusher image](https://github.com/ckan/ckan-docker-base/tree/main/datapusher).
* PostgreSQL: Official PostgreSQL image. Database files are stored in a named volume.
* Solr: CKAN's [pre-configured Solr image](https://github.com/ckan/ckan-solr). Index data is stored in a named volume.
* Redis: standard Redis image
Expand Down Expand Up @@ -61,10 +61,8 @@ Use this if you are a maintainer and will not be making code changes to CKAN or

Copy the included `.env.example` and rename it to `.env`. Modify it depending on your own needs.

Please note that when accessing CKAN directly (via a browser) ie: not going through 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`

Using the default values on the `.env.example` 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.
> [!WARNING]
> 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). These must be changed before running this setup as a public CKAN instance.
To build the images:

Expand All @@ -78,11 +76,20 @@ This will start up the containers in the current window. By default the containe
using a different colour. You could also use the -d "detach mode" option ie: `docker compose up -d` if you wished to use the current
window for something else.

At the end of the container start sequence there should be 6 containers running
At the end of the container start sequence there should be 6 containers running:

![Screenshot 2022-12-12 at 10 36 21 am](https://user-images.githubusercontent.com/54408245/207012236-f9571baa-4d99-4ffe-bd93-30b11c4829e0.png)
```bash
$ docker compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
ckan-docker-ckan-1 ckan-docker-ckan "/srv/app/start_ckan…" ckan 4 minutes ago Up 3 minutes (healthy) 5000/tcp
ckan-docker-datapusher-1 ckan/ckan-base-datapusher:0.0.20 "sh -c 'uwsgi --plug…" datapusher 4 minutes ago Up 4 minutes (healthy) 8800/tcp
ckan-docker-db-1 ckan-docker-db "docker-entrypoint.s…" db 4 minutes ago Up 4 minutes (healthy)
ckan-docker-nginx-1 ckan-docker-nginx "/bin/sh -c 'openssl…" nginx 4 minutes ago Up 2 minutes 80/tcp, 0.0.0.0:8443->443/tcp
ckan-docker-redis-1 redis:6 "docker-entrypoint.s…" redis 4 minutes ago Up 4 minutes (healthy)
ckan-docker-solr-1 ckan/ckan-solr:2.10-solr9 "docker-entrypoint.s…" solr 4 minutes ago Up 4 minutes (healthy)
```

After this step, CKAN should be running at `CKAN_SITE_URL`.
After this step, CKAN should be running at `CKAN_SITE_URL` (by default https://localhost:8443)


### Development mode
Expand All @@ -106,12 +113,29 @@ See [CKAN images](#5-ckan-images) for more details of what happens when using de

You can use the ckan [extension](https://docs.ckan.org/en/latest/extensions/tutorial.html#creating-a-new-extension) instructions to create a CKAN extension, only executing the command inside the CKAN container and setting the mounted `src/` folder as output:

docker compose -f docker-compose.dev.yml exec ckan-dev /bin/sh -c "ckan -c /srv/app/ckan.ini generate extension --output-dir /srv/app/src_extensions"
```bash
docker compose -f docker-compose.dev.yml exec ckan-dev ckan generate extension --output-dir /srv/app/src_extensions
```

```
Extension's name [must begin 'ckanext-']: ckanext-mytheme
Author's name []: Joe Bloggs
Author's email []: [email protected]
Your Github user or organization name []: example
Brief description of the project []: My CKAN theme
List of keywords (separated by spaces) [CKAN]:
Do you want to include code examples? [y/N]: y
Written: /srv/app/src_extensions/ckanext-mytheme
```

![Screenshot 2023-02-22 at 1 45 55 pm](https://user-images.githubusercontent.com/54408245/220623568-b4e074c7-6d07-4d27-ae29-35ce70961463.png)
The new extension files and directories are created in the `/srv/app/src_extensions/` folder in the running container. They will also exist in the local src/ directory as local `/src` directory is mounted as `/srv/app/src_extensions/` on the ckan container.

The files will be owned by root, to correct the ownership so you can edit the files with your normal account outside the container run:

The new extension files and directories are created in the `/srv/app/src_extensions/` folder in the running container. They will also exist in the local src/ directory as local `/src` directory is mounted as `/srv/app/src_extensions/` on the ckan container. You might need to change the owner of its folder to have the appropiate permissions.
```bash
docker compose -f docker-compose.dev.yml exec ckan-dev chown --reference /srv/app/src_extensions/ -R /srv/app/src_extensions/ckanext-mytheme/
```

#### Running HTTPS on development mode

Expand Down Expand Up @@ -314,8 +338,7 @@ For convenience the CKAN_SITE_URL parameter should be set in the .env file. For

## 12. Changing the base image

The base image used in the CKAN Dockerfile and Dockerfile.dev can be changed so a different DockerHub image is used eg: ckan/ckan-base:2.9.9
could be used instead of ckan/ckan-base:2.10.1
The base image used in the CKAN Dockerfile and Dockerfile.dev can be changed so a different DockerHub image is used eg: ckan/ckan-base:2.10.5 can be used instead of ckan/ckan-base:2.11.0

## 13. Replacing DataPusher with XLoader

Expand Down
2 changes: 1 addition & 1 deletion ckan/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ckan/ckan-base:2.10.4
FROM ckan/ckan-base:2.11.0

# Install any extensions needed by your CKAN instance
# See Dockerfile.dev for more details and examples
Expand Down
2 changes: 1 addition & 1 deletion ckan/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ckan/ckan-dev:2.10.4
FROM ckan/ckan-dev:2.11.0

# Install any extensions needed by your CKAN instance
# - Make sure to add the plugins to CKAN__PLUGINS in the .env file
Expand Down
4 changes: 3 additions & 1 deletion nginx/setup/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ http {

# Enable gzip encryption
gzip on;

proxy_cache_path /tmp/nginx_cache levels=1:2 keys_zone=cache:30m max_size=250m;
proxy_temp_path /tmp/nginx_proxy 1 2;

client_max_body_size 140M;

include /etc/nginx/conf.d/*.conf;

# Error status text
Expand Down
Empty file added src/.placeholder
Empty file.

0 comments on commit fbef360

Please sign in to comment.