Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds docker compose examples #1113

Merged
merged 24 commits into from
Aug 12, 2024
Merged

Adds docker compose examples #1113

merged 24 commits into from
Aug 12, 2024

Conversation

Spoffy
Copy link
Contributor

@Spoffy Spoffy commented Jul 18, 2024

This adds two example docker-compose files:

  • A basic Grist instance backed by sqlite, with no additional services.
  • A Grist instance that uses Postgres, Redis and MinIO.

These give a starting point for people to create their own compose files, and to try Grist out of the box.

However, neither is suitable for a production/public environment, and both files are commented with that accordingly.

@jordigh
Copy link
Contributor

jordigh commented Jul 22, 2024

Generally, I like this. Could we parametrise some of the obvious variables like password or persistent storage with interpolation?

image: gristlabs/grist:latest
environment:
# Use Python 3 instead of 2.
PYTHON_VERSION: 3
Copy link
Member

Choose a reason for hiding this comment

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

Oh, it that needed? PYTHON_VERSION_ON_CREATION at least is set to 3 I believe. Is something Python 2 ish happening by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Turns out it isn't, I copied it from an old example. I see we now have this in the docker image by default anyway :)

# Redis setup
REDIS_URL: redis://grist-redis

# MinIO setup
Copy link
Member

Choose a reason for hiding this comment

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

Could maybe have a comment about how the bucket needs to have version control enabled (I see you have code to do this later)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good shout, done!

# - MinIO for snapshot storage

# It is STRONGLY RECOMMENDED not to use this container in a way that makes it accessible to the internet.
# This setup lacks basic security or authentication.
Copy link
Member

Choose a reason for hiding this comment

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

Auth is something people really want, probably ranking over external db / redis / snapshots.

This is certainly a useful example though!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added an Auth example with OIDC. :)

@Spoffy
Copy link
Contributor Author

Spoffy commented Jul 24, 2024

Thanks for the reviews! Adding the OIDC example, then I'll incorporate the feedback from you both :)

@Spoffy Spoffy marked this pull request as ready for review July 29, 2024 19:49
@Spoffy
Copy link
Contributor Author

Spoffy commented Jul 30, 2024

Added some interpolation-based config variables @jordigh, added more docs and also moved all the volumes to exist in a single "persist" sub-directory to make it easier to wipe them all.

Copy link
Contributor

@jordigh jordigh left a comment

Choose a reason for hiding this comment

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

I was able to get the traefik+oidc example working without any hassle after following the instructions. I'm glad that worked.

One general comment: several files are missing ending newlines.

image

According to POSIX, every text file should have a final newline.

# Domain Grist is hosted at. Custom variable that's interpolated into the Authelia config
APP_DOMAIN: 'grist.localhost'
# Where Authelia should redirect to after successful authentication.
GRIST_OAUTH_CALLBACK_URL: https://grist.localhost/oauth2/callback
Copy link
Contributor

Choose a reason for hiding this comment

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

Since I expect that people will copy this file and modify it as little as possible, this callback URL should probably also be parametrised.

Copy link
Contributor Author

@Spoffy Spoffy Aug 5, 2024

Choose a reason for hiding this comment

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

Parameterised this and the Authelia domains. I haven't allowed full URL changes (e.g scheme, or /oauth2/callback) since they're required to be https:// and /oauth2/callback.


## How to run this example

This example can be run with `docker compose up`.
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add instructions on what should be changed, such as the default database and minio passwords.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added some advice to update the _PASSWORD vars in the .env file.

@@ -0,0 +1,1414 @@
# yamllint disable rule:comments-indentation
Copy link
Contributor

Choose a reason for hiding this comment

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

This file was automatically generated, correct? We probably should provide or link to instructions on how to get this file, and what might be changed about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was copied from their Github, rather than auto-generated. I could add a link to the original Github at the top?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, that link would be helpful.


This is automated for you in `generateSecureSecrets.sh`, which uses Authelia's docker image to populate the `./secrets` directory.

This example can then be run with `docker compose up`. This will make Grist available on `https://grist.localhost` with a self-signed certificate (by default), after all the services have started. Note: it may take up to a minute for all of the services to start correctly.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should mention that for local hosting, self-signed certs aren't a problem and should be accepted in the web browser. Not everyone knows how to click past a TLS error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added some details on this.

@jordigh
Copy link
Contributor

jordigh commented Aug 2, 2024

A couple of extra things:

  • The secrets creation script modifies a file checked into git and adds other files that show up as untracked. I recommend we use a template .env file and have the script copy the template over, and some .gitignore rules for the new files it adds.
  • Following @paulfitz's preference to avoid more top-level clutter, I think this belongs under documentation/, as this is supposed to be almost completely working real examples.

@Spoffy
Copy link
Contributor Author

Spoffy commented Aug 5, 2024

With regards to top-level clutter @jordigh - I'd be worried about discoverability. I'd expect documentation to just be a manual, not examples, personally.

I'd propose we keep it top level (could rename to just docker-compose).

However, we could compromise and do documentation/docker-compose-examples and add a section on it to the README?

@Spoffy Spoffy force-pushed the spoffy/docker-compose branch from 2bca4b1 to 9bed145 Compare August 12, 2024 19:40
@Spoffy Spoffy merged commit dfb8168 into main Aug 12, 2024
11 checks passed
@Spoffy Spoffy deleted the spoffy/docker-compose branch August 12, 2024 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants