Skip to content
Open
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
16 changes: 13 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,23 @@ RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/reposit
COPY docker/Caddyfile /etc/caddy/Caddyfile
COPY build/index.php /srv/app/
COPY docker/run.sh /srv/
COPY docker/peppermint.json /srv/app/
RUN mkdir -p /srv/data &&\
chown 10801:10801 /srv/data &&\
chown 10801:10801 /srv/app/peppermint.json &&\
Copy link
Owner

Choose a reason for hiding this comment

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

I assume by doing docker run -v /test/example.json:/srv/app/peppermint.json .... you overwrite this file? I don't quite understand how that would work in the scenario of a -v if the file doesn't exist on the host, and the alternate situation in which peppermint.json does exist on the host

Copy link
Author

Choose a reason for hiding this comment

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

Oooh, yeah, if it's an update you definitely wouldn't want it in there. But for a first run it's extremely useful. I'm not familiar enough with the code to know if there'd be an easy way of putting in some kinda if statement there, but if there is that might be the best option?

chmod 664 /srv/app/peppermint.json

# /srv/app/peppermint.json needs to be your peppermint.json file.
# This dockerfile uses a basic temporary peppermint.json,
# to ensure the file is created with the right permissions.
# On first run, Pepperminty Wiki will fill out the rest of the missing settings.
#
# Alternatively, you can generate a full peppermint.json, and replace the temporary file.
# To do so, you'll have to setup a temporary instance of Pepperminty Wiki
# (even just using e.g. php -S [::]:35623 -t build after cloning the git repository.)

# IMPORTANT: Set data_storage_dir to /srv/data!
# See also https://starbeamrainbowlabs.com/labs/peppermint/peppermint-config-info.php#config_data_storage_dir
# To generate the peppermint.json file in the first place, you'll have to setup a temporary instance of Pepperminty Wiki (even just using e.g. php -S [::]:35623 -t build after cloning the git repository.)
#
# Alternatively, you can fill peppermint.json with simply e.g. '{ "data_storage_dir": "/srv/data", "firstrun_complete": false }' (omit single quotes), and then mount that writably, and Pepperminty Wiki will fill out the rest of the missing settings.
VOLUME [ "/srv/data" ]

EXPOSE 80
Expand Down
4 changes: 4 additions & 0 deletions docker/peppermint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"data_storage_dir": "/srv/data",
"firstrun_complete": false,
}
85 changes: 85 additions & 0 deletions docs/04-Getting-Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,91 @@ services:

Note that this Docker Compose file is untested. If this doesn't work for you, please open a pull request.

#### Alternate docker-compose file
This file HAS been tested (on a raspberry pi), but uses named volumes, which are not strictly neccesary.

These settings are:
- Named volumes (They may or may not need the driver and driver-opts sections, has not been tested without them. They definitely work with them in.)
- **Note:** You must add the named volume folders to the same directory as your docker-compose file _before you run it_. Weird stuff happens if you don't.
- Relative filepaths work fine with docker-compose, as long as they're relative to the location of the docker-compose file.
- However, absolute filepaths are always the safest option.

```yaml
version: "3"

services:
tribblewiki:
image: pepperminty-wiki
container_name: wiki
restart: unless-stopped
volumes:
- wiki-app:/srv/app
- wiki-data:/srv/data

volumes:
wiki-app:
name: "WikiAppFolder"
driver: local
driver_opts:
type: 'none'
o: 'bind'
device: './app'
wiki-data:
name: "WikiDataFolder"
driver: local
driver_opts:
type: 'none'
o: 'bind'
device: './data'
```

#### How to use the alternate docker-compose file.
This guide is for Linux. Windows machines will need different commands etc.

1. Build the container (see above) on the machine you want to run the container on.
- Building it on the machine itself means you don't need to worry about the motherboard/kernel type - it will build the correct one for that machine automatically.
- If you need to install Apache in order to install PHP so you can build it, remember to turn the 'start on boot' setting off. (Also just turn it off straight away, you don't need it to build.)
Copy link
Owner

Choose a reason for hiding this comment

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

You should be able to use phpX.Y-cli and phpX.Y-zip. You shouldn't need to install Apache to build Pepperminty Wiki?

Copy link
Author

Choose a reason for hiding this comment

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

The advice I got from a quick google is the easiest way to install php is to just install Apache? Haven't used PHP for years before I did this, so if there's an actual better way feel free to get rid of that line. (I did manage to confuse myself with it though so idk might be useful, but I THINK I also put it in the troubleshooting so that should be good enough.)

`sudo systemctl disable apache2`
2. Set up the directory you want your docker-compose to live in.
- You need your docker-compose file, plus the directories that the named volumes will be living in, all in the same folder.
- ``` -Directory-|- app
|- data
|- docker-compose.yaml```
3. OPTIONAL - If you want to be able to edit your peppermint.json file without using sudo (eg. using some kind of GUI):
- Create a new group (eg. pepperminty) with the gid 10801 (or, if you've changed it, to whatever gid is used by pepperminty wiki)
`sudo groupadd pepperminty -g GID`
- Add your editing user (eg. wikiadmin) to the pepperminty group
`sudo usermod -a -G pepperminty wikiadmin`
- Assuming the install went as planned, this should allow you to edit peppermint.json.
- However, if you're still getting access denied problems...
- Reboot your computer. Usergroup stuff likes a reboot.
- Make sure that peppermint.json has 'User and Group' write access. If for some reason it doesn't, you'll need to set it.
`chmod 664 /path/to/peppermint.json`
- Remember to reboot after you do this, too! Just in case.
- Double check the user you're using is in the pepperminty group.
- If you want to edit other files, you can also use this method! However, you'll have to change the write access permissions first; all files other than peppermint.json are likely to be created with 'Only User' write permissions.
`chmod 664 /path/to/file_to_edit.md`
4. Start the container
`docker-compose up -d`
5. First run wiki time! (See below)

#### Troubleshooting

__I can't connect to the wiki!__

Did you make sure to turn Apache off? If you've recently rebooted and suddenly have this problem, make sure it's not set to start on boot.

Otherwise, it's likely a networking issue (are you using a reverse proxy, like Traefik? It's pretty easy to typo in the labels section of a docker-compose...)

__I get a white screen when I try and save a page__

You probably have some kind of permissions mismatch somewhere. :(
Suggestion: back up everything before you try and fix it, it may be easiest to nuke the entire container and start again.

__I can't edit peppermint.json__

Take a look at Step 3 above, it's probably a permissions issue. If all else fails, you can edit it with sudo on a terminal.

### Completing the first run wizrd
Now that your Docker container is started, you should be able to navigate to it in your web browser to complete the first run wizard.

Expand Down