Skip to content

Commit

Permalink
initial code commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Holloway committed Jun 12, 2019
1 parent 7161769 commit 0afc790
Show file tree
Hide file tree
Showing 9 changed files with 191 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# swarmstack/teampass

Docker compose file for TeamPass. Requires Docker swarm.

## USAGE

Edit the docker-compose.yml and replace fqdn.example.com with your swarm http address. TeamPass database credentials for later configuration are also found within this same file.

```
docker stack deploy -c docker-compose.yml teampass
```

[swarmstack](https://github.com/swarmstack/swarmstack) users should use docker-compose-swarmstack.yml above instead.

---

You can then configure TeamPass at http://fqdn.example.com:6443/index.php

It is HIGHLY recommended to remove the exposed "ports:" section within the compose file, and instead secure the traffic behind HTTPS/TLS via a proxy. swarmstack users can add the following stanza to their existing Caddy proxy configuration:

```
{$CADDY_URL}:6443 {
errors stderr
prometheus 0.0.0.0:9180 {
hostname 6443
}
tls {$CADDY_CERT} {$CADDY_KEY}
proxy / teampass:80 {
transparent
}
}
```
5 changes: 5 additions & 0 deletions bounce
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

./down
sleep 5
./up
63 changes: 63 additions & 0 deletions docker-compose-swarmstack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
version: "3.4"

networks:
default:
external:
name: swarmstack_net

configs:
teampass_docker_start:
file: ./teampass-docker-start.sh

volumes:
teampass-data:
driver: pxd
driver_opts:
repl: 2
size: 2
teampass-php:
driver: pxd
driver_opts:
repl: 2
size: 1
teampass-mysql:
driver: pxd
driver_opts:
repl: 2
size: 4

services:
teampass:
image: teampass/teampass
configs:
- source: teampass_docker_start
target: /teampass-docker-start.sh
deploy:
mode: replicated
placement:
constraints:
- node.Labels.storagegroup==RED
replicas: 1
environment:
VIRTUAL_HOST: fqdn.example.com
ports:
- "6443:80"
volumes:
- teampass-data:/var/www/html
- teampass-php:/var/php/session

db:
image: mysql/mysql-server:5.7
deploy:
mode: replicated
placement:
constraints:
- node.Labels.storagegroup==RED
replicas: 1
environment:
MYSQL_ROOT_PASSWORD: mypass
MYSQL_DATABASE: teampass
MYSQL_PASSWORD: teampass
MYSQL_USER: teampass
volumes:
- teampass-mysql:/var/lib/mysql
35 changes: 35 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: "3.4"

configs:
teampass_docker_start:
file: ./teampass-docker-start.sh

services:
teampass:
image: teampass/teampass
configs:
- source: teampass_docker_start
target: /teampass-docker-start.sh
deploy:
mode: replicated
replicas: 1
environment:
VIRTUAL_HOST: fqdn.example.com
ports:
- "6443:80"
volumes:
- ./local_bind_volume_dir/var/www/html:/var/www/html
- ./local_bind_volume_dir/var/php/session:/var/php/session

db:
image: mysql/mysql-server:5.7
deploy:
mode: replicated
replicas: 1
environment:
MYSQL_ROOT_PASSWORD: mypass
MYSQL_DATABASE: teampass
MYSQL_PASSWORD: teampass
MYSQL_USER: teampass
volumes:
- ./local_bind_volume_dir/var/lib/mysql:/var/lib/mysql
3 changes: 3 additions & 0 deletions down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

docker stack rm teampass
1 change: 1 addition & 0 deletions local_bind_volume_dir/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This directory exists as "permanent" storage for your container, just in case you forget to edit the local_bind_volume_dir to another directory on your local Docker system towards the bottom of docker-compose.yml, or use persistent storage as with the swarmstack version.
22 changes: 22 additions & 0 deletions teampass-docker-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh
if [ ! -d ${VOL}/.git ];
then
echo "Initial setup..."
rm -Rf ${VOL}/*
git clone $REPO_URL ${VOL}
mkdir ${VOL}/sk
chown -Rf nginx:nginx ${VOL}
fi

if [ -f ${VOL}/includes/config/settings.php ] ;
then
echo "Teampass is ready."
rm -rf ${VOL}/install
else
echo "Teampass is not configured yet. Open it in a web browser to run the install process."
echo "Use ${VOL}/sk for the absolute path of your saltkey."
echo "When setup is complete, restart this image to remove the install directory."
fi

# Pass off to the image's script
exec /start.sh
3 changes: 3 additions & 0 deletions up
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

docker stack deploy -c docker-compose.yaml teampass

0 comments on commit 0afc790

Please sign in to comment.