create examples directory

This commit is contained in:
2021-01-08 15:09:11 -08:00
parent ca9e10e5c2
commit 1c02e61c75
4 changed files with 0 additions and 0 deletions

View File

@ -0,0 +1,34 @@
<VirtualHost *:80>
ServerName photo_app.example.com
ProxyPass "/.well-known" !
ProxyPass "/favicon.ico" !
ProxyPass "/css" !
ProxyPass "/js" !
ProxyPass "/" "http://127.0.0.1:8200/"
ProxyPassReverse "/" "http://127.0.0.1:8200/"
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
alias "/css" "/var/lib/<app_user>/css"
alias "/js" "/var/lib/<app_user>/js"
<Directory "/var/lib/<app_user>/css">
ExpiresActive on
ExpiresDefault "access plus 15 minutes"
Header set Cache-Control max-age=900
Options Indexes
Require all granted
Allow from all
</Directory>
<Directory "/var/lib/<app_user>/js">
ExpiresActive on
ExpiresDefault "access plus 15 minutes"
Header set Cache-Control max-age=900
Options Indexes
Require all granted
Allow from all
</Directory>
</VirtualHost>

View File

@ -0,0 +1,16 @@
<VirtualHost *:80>
ServerName photos.example.com
DocumentRoot /var/lib/<app_user>/photos
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/lib/<app_user>/photos">
ExpiresActive on
ExpiresDefault "access plus 1 year"
Header set Cache-Control max-age=31557600
Options Indexes
Require all granted
</Directory>
</VirtualHost>

View File

@ -0,0 +1,50 @@
#!/bin/bash
# deploy_photo_app.bash
SOURCE="/home/<user>/flaskapps/photo_app"
DESTINATION="/var/lib/<app_user>"
cp -v "$SOURCE"/config.py "$DESTINATION"/
cp -v "$SOURCE"/photo_app.py "$DESTINATION"/
cp -v "$SOURCE"/app/__init__.py "$DESTINATION"/app/
cp -v "$SOURCE"/app/routes.py "$DESTINATION"/app/
cp -v "$SOURCE"/app/sendxmpp_handler.py "$DESTINATION"/app/
cp -v "$SOURCE"/app/models.py "$DESTINATION"/app/
cp -v "$SOURCE"/app/forms.py "$DESTINATION"/app/
cp -v "$SOURCE"/app/email.py "$DESTINATION"/app/
cp -v "$SOURCE"/app/templates/base.html "$DESTINATION"/app/templates/
cp -v "$SOURCE"/app/templates/index.html "$DESTINATION"/app/templates/
cp -v "$SOURCE"/app/templates/login.html "$DESTINATION"/app/templates/
cp -v "$SOURCE"/app/templates/register.html "$DESTINATION"/app/templates/
cp -v "$SOURCE"/app/templates/reset_password.html "$DESTINATION"/app/templates/
cp -v "$SOURCE"/app/templates/reset_password_request.html "$DESTINATION"/app/templates/
cp -v "$SOURCE"/app/templates/edit_profile.html "$DESTINATION"/app/templates/
cp -v "$SOURCE"/app/templates/change_password.html "$DESTINATION"/app/templates/
cp -v "$SOURCE"/app/templates/qr.html "$DESTINATION"/app/templates/
cp -v "$SOURCE"/app/templates/disable_2fa.html "$DESTINATION"/app/templates/
cp -v "$SOURCE"/app/templates/two_factor_input.html "$DESTINATION"/app/templates/
cp -v "$SOURCE"/app/templates/upload.html "$DESTINATION"/app/templates/
cp -v "$SOURCE"/app/templates/photo.html "$DESTINATION"/app/templates/
cp -v "$SOURCE"/app/templates/delete_photo.html "$DESTINATION"/app/templates/
cp -v "$SOURCE"/app/templates/email/reset_password_email_html.html "$DESTINATION"/app/templates/email/
cp -v "$SOURCE"/app/templates/email/reset_password_email_text.txt "$DESTINATION"/app/templates/email/
cp -v "$SOURCE"/app/scripts/set_contributor_id_seq.py "$DESTINATION"/app/scripts/
cp -v "$SOURCE"/app/scripts/totp_utils.py "$DESTINATION"/app/scripts/
cp -v "$SOURCE"/app/scripts/process_uploaded_photo.py "$DESTINATION"/app/scripts/
cp -v "$SOURCE"/app/scripts/crop_photo.py "$DESTINATION"/app/scripts/
cp -v "$SOURCE"/app/scripts/get_exif_data.py "$DESTINATION"/app/scripts/
cp -v "$SOURCE"/app/scripts/get_photo_list.py "$DESTINATION"/app/scripts/
cp -v "$SOURCE"/app/scripts/delete_photo.py "$DESTINATION"/app/scripts/
cp -v "$SOURCE"/css/photo_app.css "$DESTINATION"/css/
cp -v "$SOURCE"/js/photo_app.js "$DESTINATION"/js/
chown -R photo_app:photo_app "$DESTINATION"
chmod 600 "$DESTINATION"/.env

View File

@ -0,0 +1,15 @@
[Unit]
Description=Photo Application
After=network.target
[Service]
User=<app_user>
Group=<app_user>
WorkingDirectory=/var/lib/<app_user>
Environment=FLASK_DEBUG=0
# apt-get install python3-gunicorn gunicorn
ExecStart=/usr/bin/gunicorn3 --access-logfile '-' -b 127.0.0.1:8200 -w 1 <app_user>:app
Restart=always
[Install]
WantedBy=multi-user.target