revison
This commit is contained in:
parent
b216bbf7d0
commit
0d53ae9768
10 changed files with 25 additions and 89 deletions
|
@ -1 +0,0 @@
|
|||
__sample_bottle_hosting --projectname sample --user app --domain $__target_host sample
|
25
sami/my-cdist/.cdist/type/__my_computer/manifest
Executable file
25
sami/my-cdist/.cdist/type/__my_computer/manifest
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# 2012 Nico Schottelius (nico-cdist at schottelius.org)
|
||||
#
|
||||
# This file is part of cdist.
|
||||
#
|
||||
# cdist is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# cdist is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#
|
||||
# Ensure sipcalc is present
|
||||
#
|
||||
|
||||
__package sipcalc --state present
|
||||
|
|
@ -1 +0,0 @@
|
|||
echo "service nginx restart"
|
|
@ -1,43 +0,0 @@
|
|||
os=$(cat "$__global/explorer/os")
|
||||
|
||||
case "$os" in
|
||||
ubuntu)
|
||||
:
|
||||
;;
|
||||
*)
|
||||
echo "OS $os currently not supported" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
user="$(cat "$__object/parameter/user")"
|
||||
home="/home/$user"
|
||||
apphome="$home/app"
|
||||
|
||||
# create user
|
||||
__user "$user" --home "$home" --shell /bin/bash
|
||||
# create user home dir
|
||||
require="__user/$user" __directory "$home" \
|
||||
--owner "$user" --group "$user" --mode 0755
|
||||
# create app home dir
|
||||
require="__user/$user __directory/$home" __directory "$apphome" \
|
||||
--state present --owner "$user" --group "$user" --mode 0755
|
||||
|
||||
|
||||
# define packages that need to be installed
|
||||
packages_to_install="nginx uwsgi-plugin-python3 python3-dev python3-pip postgresql postgresql-contrib libpq-dev python3-venv uwsgi python3-psycopg2"
|
||||
|
||||
# update package index
|
||||
__apt_update_index
|
||||
# install packages
|
||||
for package in $packages_to_install
|
||||
do require="__apt_update_index" __package $package --state=present
|
||||
done
|
||||
|
||||
# install pip3 packages
|
||||
for package in bottle bottle-pgsql; do
|
||||
__package_pip --pip pip3 $package
|
||||
done
|
||||
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
# required parameter
|
||||
projectname
|
||||
user
|
||||
domain
|
|
@ -1,13 +0,0 @@
|
|||
domain="$(cat "$__object/parameter/domain")"
|
||||
webroot="/var/www/html"
|
||||
__sample_nginx_http_letsencrypt_and_ssl_redirect "$domain" --webroot "$webroot"
|
||||
|
||||
|
||||
# create SSL cert
|
||||
require="__package/nginx __sample_nginx_http_letsencrypt_and_ssl_redirect/$domain" \
|
||||
__letsencrypt_cert --admin-email samuel.hailu@ungleich.ch \
|
||||
--webroot "$webroot" \
|
||||
--automatic-renewal \
|
||||
--renew-hook "service nginx reload" \
|
||||
--domain "$domain" \
|
||||
"$domain"
|
|
@ -1 +0,0 @@
|
|||
echo "service nginx reload"
|
|
@ -1,25 +0,0 @@
|
|||
domain="$__object_id"
|
||||
webroot="$(cat "$__object/parameter/webroot")"
|
||||
# make sure we have nginx package
|
||||
__package nginx
|
||||
# setup Let's Encrypt HTTP acme challenge, redirect HTTP to HTTPS
|
||||
require="__package/nginx" __file "/etc/nginx/sites-enabled/http-$domain" \
|
||||
--source - --mode 0644 << EOF
|
||||
server {
|
||||
listen *:80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name $domain;
|
||||
|
||||
# Let's Encrypt
|
||||
location /.well-known/acme-challenge/ {
|
||||
root $webroot;
|
||||
}
|
||||
|
||||
# Everything else -> SSL
|
||||
location / {
|
||||
return 301 https://\$host\$request_uri;
|
||||
}
|
||||
}
|
||||
|
||||
EOF
|
Loading…
Reference in a new issue