Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions site/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# under the License.
#

.user-settings

content/releases/

# Created/generated when running Hugo on the local host
Expand Down
15 changes: 15 additions & 0 deletions site/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,21 @@ Then point your browser to http://localhost:1313/
Then edit files from your IDE - you will see the changes in your browser. When changing the site structure,
it is often necessary to restart Hugo - just run `site/bin/run-hugo-in-docker.sh` again.

## Dealing with `--userns and --pod cannot be used together` errors

The scripts in the `bin/` directory are built to work with both Docker and podman. There are nuances in how
both behave, especially wrt docker/podman-compose. Some local environment specifics require the use of
`podman-compose`, others the use of `docker-compose`. The default behavior is to prefer the `podman` and
`podman-compose` binaries, if those exist and fall back to `docker` and `docker-compose`. Some setups using
podman however require the use of `docker-compose` even if `podman-compose` is installed. This may manifest
in an error message stating that `--userns` and `--pod` cannot be used together. In that case create a file
`.user-settings` in the `site/` folder and add these two lines:
```bash
DOCKER=docker
COMPOSE=docker-compose
Comment on lines +48 to +49
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I wonder if a var like DOCKER_COMMAND or DOCKER_ALIAS or something might be less likely to collide with another env var.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I've been thinking about environment variables.
But then people have to declare those elsewhere, which is also not great.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OTOH, it's an internal "hack", we can change it anytime.

```


# Building the static site

## Building a static site - served at http://localhost:8080/
Expand Down
6 changes: 4 additions & 2 deletions site/bin/_hugo-docker-include.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
# under the License.
#

DOCKER="$(which podman > /dev/null && echo podman || echo docker)"
COMPOSE="$(which podman-compose > /dev/null && echo podman-compose || echo docker-compose)"
[[ -f site/.user-settings ]] && . site/.user-settings

[[ -z ${DOCKER} ]] && DOCKER="$(which podman > /dev/null && echo podman || echo docker)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe use more compact version such as following:

DOCKER="${DOCKER:-$(which podman >/dev/null && echo podman || echo docker)}"
COMPOSE="${COMPOSE:-$(which podman-compose >/dev/null && echo podman-compose || echo docker-compose)}"

[[ -z ${COMPOSE} ]] && COMPOSE="$(which podman-compose > /dev/null && echo podman-compose || echo docker-compose)"

# absolute path to the Polaris workspace, for the volume mount
WORKSPACE="$(pwd)"
Expand Down
Loading