Skip to content

Commit

Permalink
Initial configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanrousseau committed Oct 2, 2020
1 parent 30b282c commit 56e0f84
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# duck.local

Configure a local instance of Duck using Docker Compose, systemd, and Nginx.

## Disclaimer

No warranty expressed or implied. Code is provided as is.
35 changes: 35 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
tag=$(get_octopusvariable "Project.Duck.ServerTag")

echo "Stop duck-local."
systemctl is-active --quiet jenkins-local && systemctl stop jenkins-local

docker-compose down

if [ ! -d "data" ]; then
echo "Create data folder."
mkdir data
fi

docker-compose pull
docker-compose up -d

mv duck.json data/
mv duck-local.service /etc/systemd/system
mv duck.local /etc/nginx/sites-available

if [ ! -e "/etc/nginx/sites-enabled/duck.local" ]; then
echo "Create /etc/nginx/sites-enabled/duck.local."
ln -s /etc/nginx/sites-available/duck.local /etc/nginx/sites-enabled/duck.local
fi

echo "Start duck-local."
systemctl is-enabled --quiet duck-local || systemctl enable duck-local
systemctl start duck-local
echo "Reload systemctl daemon."
systemctl daemon-reload
echo "Restart nginx."
systemctl restart nginx

write_highlight "[duck.local](https://duck.local)"

exit 0
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: "3"
services:
duck:
image: docker.io/duckhq/duck:latest
ports:
- "8085:15825"
volumes:
- "./data:/data"
container_name: duck
command: ["start", "--config", "/data/duck.json"]
13 changes: 13 additions & 0 deletions duck-local.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=#{Project.Duck.ServiceDescription}
Requires=docker.service
After=docker.service

[Service]
WorkingDirectory=#{Project.Duck.InstallLocation}
ExecStart=/usr/bin/docker-compose up
ExecStop=/usr/bin/docker-compose stop
TimeoutStartSec=0

[Install]
WantedBy=multi-user.target
7 changes: 7 additions & 0 deletions duck.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/duckhq/duck/master/schemas/v0.14.json",
"interval": 30,
"views": [],
"collectors": [],
"observers": []
}
21 changes: 21 additions & 0 deletions duck.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
server {
listen 443 ssl;

ssl_certificate /etc/ssl/duck.crt;
ssl_certificate_key /etc/ssl/duck.key;
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 180m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
add_header Strict-Transport-Security "max-age=31536000" always;

server_name duck.local;

location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

proxy_pass http://127.0.0.1:#{Project.duck.Port};
}
}

0 comments on commit 56e0f84

Please sign in to comment.