-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from mataroa-blog/ansible
Setup ansible for deployment
- Loading branch information
Showing
40 changed files
with
548 additions
and
453 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,24 @@ | ||
# Exceptions and tracebacks on errors | ||
# 1: show | ||
# 0: don't show | ||
export DEBUG=1 | ||
|
||
# Stop real emails and turn https off | ||
# 1: stop and off | ||
# 0: do not stop and on | ||
export LOCALDEV=1 | ||
|
||
# Session cookies secret | ||
export SECRET_KEY=some-secret-key | ||
export DATABASE_URL=postgres://mataroa:db-password@db:5432/mataroa | ||
export EMAIL_HOST_USER=smtp-user | ||
export EMAIL_HOST_PASSWORD=smtp-password | ||
|
||
# Database connection | ||
export DATABASE_URL=postgres://mataroa:xxx@localhost:5432/mataroa | ||
|
||
# SMTP credentials | ||
export EMAIL_HOST_USER= | ||
export EMAIL_HOST_PASSWORD= | ||
|
||
# Stripe payments details | ||
export STRIPE_API_KEY= | ||
export STRIPE_PUBLIC_KEY= | ||
export STRIPE_PRICE_ID= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# inventory.yaml | ||
|
||
# Server IP and user with ssh access | ||
export ANSIBLE_HOST= | ||
export ANSIBLE_USER=root | ||
|
||
|
||
# vars.yaml | ||
|
||
# Domain name and email for Caddy | ||
export DOMAIN=mataroa.blog | ||
export [email protected] | ||
|
||
# Show exceptions and tracebacks on errors | ||
# 1: show | ||
# 0: don't show | ||
export DEBUG=1 | ||
|
||
# Stop real emails and turn https off | ||
# 1: stop and off | ||
# 0: do not stop and on | ||
export LOCALDEV=1 | ||
|
||
# Session cookies secret | ||
export SECRET_KEY=some-secret-key | ||
|
||
# Database connection | ||
export DATABASE_URL=postgres://mataroa:xxx@localhost:5432/mataroa | ||
export POSTGRES_USERNAME=mataroa | ||
export POSTGRES_PASSWORD=xxx | ||
|
||
# SMTP credentials | ||
export EMAIL_HOST_USER= | ||
export EMAIL_HOST_PASSWORD= | ||
|
||
# Stripe payments details | ||
export STRIPE_API_KEY= | ||
export STRIPE_PUBLIC_KEY= | ||
export STRIPE_PRICE_ID= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{{ domain }} { | ||
route { | ||
file_server /static/* { | ||
root /var/www/mataroa | ||
} | ||
reverse_proxy 127.0.0.1:5000 | ||
} | ||
|
||
tls {{ email }} { | ||
on_demand | ||
} | ||
|
||
encode zstd gzip | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[defaults] | ||
inventory = inventory.yaml | ||
pipelining = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
virtualmachines: | ||
hosts: | ||
main: | ||
ansible_host: "{{ lookup('env', 'ANSIBLE_HOST') }}" | ||
ansible_user: "{{ lookup('env', 'ANSIBLE_USER') }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[Unit] | ||
Description=mataroa | ||
After=network.target | ||
|
||
[Service] | ||
Type=simple | ||
User=deploy | ||
Group=www-data | ||
WorkingDirectory=/var/www/mataroa | ||
ExecStart=/var/www/mataroa/.venv/bin/gunicorn -b 127.0.0.1:5000 -w 4 mataroa.wsgi | ||
ExecReload=/bin/kill -HUP $MAINPID | ||
Environment="DOMAIN={{ domain }}" | ||
Environment="EMAIL={{ email }}" | ||
Environment="DEBUG={{ debug }}" | ||
Environment="LOCALDEV={{ localdev }}" | ||
Environment="SECRET_KEY={{ secret_key }}" | ||
Environment="DATABASE_URL={{ database_url }}" | ||
Environment="EMAIL_HOST_USER={{ email_host_user }}" | ||
Environment="EMAIL_HOST_PASSWORD={{ email_host_password }}" | ||
Environment="STRIPE_API_KEY={{ stripe_api_key }}" | ||
Environment="STRIPE_PUBLIC_KEY={{ stripe_public_key }}" | ||
Environment="STRIPE_PRICE_ID={{ stripe_price_id }}" | ||
TimeoutSec=15 | ||
Restart=always | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
Oops, something went wrong.