Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Docker support #183

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ remotefiles/
*.sqlite
dev_settings.py
*.log
*.vagrant
*.vagrant
mongodb
caddy
8 changes: 8 additions & 0 deletions Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
http://example.com {
tls self_signed
root /srv
proxy / http://amon:8000 {
transparent
except /static
}
}
36 changes: 36 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM frolvlad/alpine-python3

# Install all required dependencies
RUN apk add --no-cache gcc yaml-dev libev-dev git gcc g++ make libffi-dev openssl-dev
RUN apk add --no-cache python3-dev

# Create the directories where you are going to store the configs, logs and Amon itself
RUN mkdir -p /opt/amon
RUN mkdir -p /var/log/amon
RUN mkdir -p /etc/opt/amon

# Clone repo into app directory
RUN git clone https://github.com/amonapp/amon.git /opt/amon

# Install Python deps
RUN pip install -r /opt/amon/requirements.txt

# Setup Unicorn
COPY gunicorn.conf /opt/amon/gunicorn.conf

# Copy defaults and setup working directroy
COPY amon-defaults.yml /etc/opt/amon/amon.yml
WORKDIR /opt/amon

# Run the database migrations and cron install tasks
RUN python3 manage.py migrate
RUN python3 manage.py installtasks

# Setup external volumes
VOLUME ["/opts/amon", "/var/log/amon", "/etc/opt/amon"]

# Setup Ports
EXPOSE 8000

# Start webserver
CMD gunicorn wsgi -c /opt/amon/gunicorn.conf
9 changes: 9 additions & 0 deletions amon-defaults.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
host: http://example.com
mongo_uri: mongodb://mongodb:27017
smtp:
host: smtp.mailgun.org
port: 587
username: amon_alerts
password: amon_password
use_tls: true
sent_from: alerts@yourdomain.com
32 changes: 32 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: '2'
services:
caddy:
image: abiosoft/caddy
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- "./Caddyfile:/etc/Caddyfile"
- "./caddy:/root/.caddy"
- "./amon/static:/srv/static"
links:
- "amon:amon"
depends_on:
- "amon"
mongodb:
image: "mongo"
restart: always
expose:
- "27017"
volumes:
- "./mongodb:/data/db:rw"
amon:
build: "."
restart: always
expose:
- "8000"
links:
- "mongodb:mongodb"
depends_on:
- "mongodb"