Skip to content
Rojen Zaman edited this page Oct 21, 2022 · 37 revisions

Amusewiki Docker Usage

To change them, read: Environment Variables

Persistent Volume

You should keep these directories/files as a volume/directory:

  • /var/lib/amusewiki/repo git
  • /var/lib/amusewiki/thumbnails thumb
  • /var/lib/amusewiki/staging staging
  • /var/lib/dbconfig-common/sqlite3/amusewiki db
  • /etc/nginx/sites-enabled web

The following docker-compose examples are connected as a persistent directory.

docker-compose

Clone the repo:

git clone https://github.com/rojenzaman/amusewiki-docker

:package

To use container with official packages, go to package directory:

cd amusewiki-docker/package

:texlive-minimal

To use container with amusewiki git source and texlive-minimal, go to texlive-minimal directory:

cd amusewiki-docker/texlive-minimal

:texlive-base

To use container with amusewiki git source and texlive-base, go to texlive-base directory:

cd amusewiki-docker/texlive-base

:texlive-full

To use container with amusewiki git source and texlive-full, go to texlive-full directory:

cd amusewiki-docker/texlive-full

Create sqlite database and repo files for the amusewiki docker-compose stack (if you have please replace with them):

make setup-example-stack

Then build/pull and run:

# to build and run
docker-compose up -d --build

# to pull and run
cp lib/testing.yml docker-compose.yml
docker-compose up -d

podman-compose (rootless)

If you want to run under rootless podman, please execute the following instead of above:

make setup-example-rootless-podman-stack
# to build and run:
podman-compose up -d --build

# to pull and run:
cp lib/testing.yml docker-compose.yml
podman-compose up -d

Environment Variables

Check table at: README.md#environment-variables

Change Domain

The default domain is amusewiki.localdomain. To change it, edit this line in lib/container.env:

#POST_DOMAIN=localhost

Change Password

To change default password, edit this line in lib/container.env:

#CHANGE_PASSWORD_BEFORE_RUN=true
#AMW_USERNAME=amusewiki
#AMW_PASSWORD=changeme

Set workers

To set workers, edit this line in lib/container.env:

AMW_WORKERS=5

HTTPS Traefik

If your container is running under Traefik, please set the variable CONTAINER_IS_BEHIND_HTTPS_TRAEFIK to true in lib/container.env.

#CONTAINER_IS_BEHIND_HTTPS_TRAEFIK=true

Set SSH Public Key

To set SSH public key, edit this line in lib/container.env:

#HOST_SSH_PUBLIC_KEY=

Expose port 22:

ports:
  - '6022:22'

Define the amusewiki container address to the ssh configuration ~/.ssh/config:

host amusewiki.localdomain
hostname 127.0.0.1
StrictHostKeyChecking no
user amusewiki
port 6022

If you want to generate new SSH private key, set the GENERATE_NEW_SSH_KEY variable to true or mount your keys to /var/lib/amusewiki/.ssh/id_rsa and /var/lib/amusewiki/.ssh/id_rsa.pub.

SMTP

add text here

Other Variables

AMW_NPROC

add text here

AMUSEWIKI_SWITCH_BRANCH

add text here

CREATE_MISSING_STAGING_FILES

add text here

AMW_SQLITE_PATH

add text here

UPDATE_AMUSEWIKI

add text here

Examples

NGINX Reverse Proxy

# the port to proxy is set to 6080, change it according to yourself

server {
	listen X.X.X.X:80;
	#listen [XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX]:80;

	server_name prod.org;
        access_log /var/log/nginx/prod.org.log;
        error_log  /var/log/nginx/prod.org.err.log;

	server_tokens  off;
        port_in_redirect off;

	location / {
		proxy_pass http://127.0.0.1:6080;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Upgrade           $http_upgrade;
                proxy_set_header Connection        "upgrade";
                proxy_set_header Host              $host;
                proxy_set_header X-Real-IP         $remote_addr;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Forwarded-Host  $host;
                proxy_set_header X-Forwarded-Port  $server_port;
	}
}

server {
        listen X.X.X.X:443 ssl;
	#listen [XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX]:443 ssl;

        server_name prod.org;
	access_log /var/log/nginx/prod.org.log;
	error_log  /var/log/nginx/prod.org.err.log;

        ssl_certificate /etc/ssl/certs/prod.org.pem;
        ssl_certificate_key /etc/ssl/private/prod.org.key;

        server_tokens  off;
        port_in_redirect off;

        location / {
                proxy_pass https://127.0.0.1:6443;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Upgrade           $http_upgrade;
                proxy_set_header Connection        "upgrade";
                proxy_set_header Host              $host;
                proxy_set_header X-Real-IP         $remote_addr;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Forwarded-Host  $host;
                proxy_set_header X-Forwarded-Port  $server_port;
        }
}

An example docker-compose.yml for reverse proxy:

version: '3.4'
services:
  app:
    image: rojen/amusewiki:package
    ports:
      -	'6080:80'
      -	'6443:443'
      - '6022:22'
    volumes:
      - repo:/var/lib/amusewiki/repo
      - thumb:/var/lib/amusewiki/thumbnails
      - staging:/var/lib/amusewiki/staging
      - db:/var/lib/dbconfig-common/sqlite3/amusewiki
      - web:/etc/nginx
    env_file: lib/container.env
volumes:
  repo:
  thumb:
  staging:
  db:
  web:

HTTPS Traefik

coop-cloud/amusewiki: Run amusewiki on Co-op Cloud with HTTPS Traefik.

Play with Docker

Check: pwd/README.md

Run a specific branch or older releases

not added yet