Sign inSign up

ahaasler/stash

By ahaasler

Updated over 10 years ago

Image
0

4.3K

ahaasler/stash repository overview

docker-stash: A Docker image for Stash.

Build status Docker Repository on Quay.io Release Docker Stars Docker Pulls Image Size

Features

  • Runs on a production ready OpenJDK 8 - Zulu by Azul Systems.
  • Ready to be configured with Nginx as a reverse proxy (https available).
  • Built on top of Debian for a minimal image size.

Usage

docker run -d -p 7990:7990 -p 7999:7999 ahaasler/stash
Parameters

You can use this parameters to configure your stash instance:

  • -s: Enables the connector security and sets https as connector scheme.
  • -n <proxyName>: Sets the connector proxy name.
  • -p <proxyPort>: Sets the connector proxy port.
  • -c <contextPath>: Sets the context path (do not write the initial /).

This parameters should be given to the entrypoint (passing them after the image):

docker run -d -p 7990:7990 -p 7999:7999 ahaasler/stash <parameters>

If you want to execute another command instead of launching stash you should overwrite the entrypoint with --entrypoint <command> (docker run parameter).

Nginx as reverse proxy

Lets say you have the following nginx configuration for stash:

server {
	listen                          80;
	server_name                     example.com;
	return                          301 https://$host$request_uri;
}
server {
	listen                          443;
	server_name                     example.com;

	ssl                             on;
	ssl_certificate                 /path/to/certificate.crt;
	ssl_certificate_key             /path/to/key.key;
	location /stash {
		proxy_set_header X-Forwarded-Host $host;
		proxy_set_header X-Forwarded-Server $host;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_pass http://127.0.0.1:7990;
		proxy_redirect off;
	}
}

This is only an example, please secure you nginx better.

For that configuration you should run your stash container with:

docker run -d -p 7990:7990 -p 7999:7999 ahaasler/stash -s -n example.com -p 443 -c stash
Persistent data

The stash home is set to /data/stash. If you want to persist your data you should use a data volume for /data/stash.

Binding a host directory
docker run -d -p 7990:7990 -p 7999:7999 -v /home/user/stash-data:/data/stash ahaasler/stash

Make sure that the stash user (with id 782) has read/write/execute permissions.

If security is important follow the Atlassian recommendation:

Ensure that only the user running Stash can access the Stash home directory, and that this user has read, write and execute permissions, by setting file system permissions appropriately for your operating system.

Using a data-only container
  1. Create the data-only container and set proper permissions:

docker run --name stash-data ahaasler/stash-data ```

* *I-wan't-to-know-what-I'm-doing* way:

	```bash

docker run --name stash-data -v /data/stash busybox true docker run --rm -it --volumes-from stash-data debian bash ```

	The last command will open a *debian* container. Execute this inside that container:

	```bash

chown 782:root /data/stash; chmod 770 /data/stash; exit; ```

  1. Use it in the stash container:

docker run --name stash --volumes-from stash-data -d -p 7990:7990 -p 7999:7999 ahaasler/stash ```

PostgreSQL external database

A great way to connect your Stash instance with a PostgreSQL database is using the docker-stash-postgres image.

  1. Create and name the database container:

docker run --name stash-postgres -d ahaasler/stash-postgres ```

  1. Use it in the Stash container:

docker run --name stash --link stash-postgres:stash-postgres -d -p 7990:7990 -p 7999:7999 ahaasler/stash ```

  1. Connect your Stash instance following the Atlassian documentation: Connecting Stash to PostgreSQL.

See docker-stash-postgres for more information an configuration options.

Thanks

License

This image is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

Tag summary

Content type

Image

Digest

sha256:f8573553d

Size

301.3 MB

Last updated

over 10 years ago

docker pull ahaasler/stash