archive
This commit is contained in:
107
firefly/ubuntu-old/Dockerfile
Executable file
107
firefly/ubuntu-old/Dockerfile
Executable file
@@ -0,0 +1,107 @@
|
||||
FROM ubuntu:18.10
|
||||
|
||||
### APT
|
||||
RUN apt -y update \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt -y install tzdata \
|
||||
&& apt -y install locales language-pack-en-base \
|
||||
&& echo '127.0.0.1 firefly-iii-domain.com firefly-iii localhost' >> /etc/hosts \
|
||||
&& apt -y install \
|
||||
mariadb-server \
|
||||
nginx \
|
||||
php-fpm php7.2-mysql php-curl php-gd php-bcmath php-zip php-intl php-mbstring php-xml \
|
||||
curl \
|
||||
gcc \
|
||||
cron \
|
||||
&& rm /etc/nginx/sites-enabled/default \
|
||||
&& touch /etc/nginx/sites-available/firefly-iii.conf \
|
||||
&& ln -s /etc/nginx/sites-available/firefly-iii.conf /etc/nginx/sites-enabled/firefly-iii.conf \
|
||||
&& openssl dhparam 2048 > /etc/nginx/dhparam.pem \
|
||||
&& service mysql start && sleep 5 \
|
||||
&& echo 'FLUSH PRIVILEGES; ' \
|
||||
'USE mysql; ' \
|
||||
'UPDATE user SET authentication_string=PASSWORD("pwd") WHERE User='"'"'root'"'"'; ' \
|
||||
'UPDATE user SET plugin="mysql_native_password" WHERE User='"'"'root'"'"'; ' \
|
||||
| mysql --user=root mysql || true && echo made user \
|
||||
&& service mysql stop && sleep 5 \
|
||||
&& sed 's/^password .*/password = pwd/' /etc/mysql/debian.cnf > /tmp/cnf \
|
||||
&& mv /tmp/cnf /etc/mysql/debian.cnf \
|
||||
&& service mysql start && sleep 5 \
|
||||
&& echo 'create database fireflyiii character set utf8 collate utf8_bin; ' \
|
||||
'grant all privileges on fireflyiii.* to fireflyiii@localhost identified by '"'"'pwd'"'"'; ' \
|
||||
| mysql --user=root --password=pwd mysql && echo made fireflyiii
|
||||
|
||||
### PHP
|
||||
RUN service mysql start && sleep 10 \
|
||||
&& curl -sS https://getcomposer.org/installer \
|
||||
| php -- --install-dir=/usr/local/bin --filename=composer \
|
||||
&& cd /opt \
|
||||
&& composer create-project grumpydictator/firefly-iii --no-dev --prefer-dist firefly-iii 4.7.4
|
||||
COPY ./env /opt/firefly-iii/.env
|
||||
RUN service mysql start && sleep 10 \
|
||||
&& cd /opt/firefly-iii \
|
||||
&& php artisan migrate:refresh --seed \
|
||||
&& php artisan passport:install \
|
||||
&& chown -R www-data:www-data /opt/firefly-iii \
|
||||
&& mkdir -p /run/php
|
||||
|
||||
### WAIT
|
||||
COPY ./pause /xfer/
|
||||
RUN cd /xfer && gcc main.c -o /xfer/pauser
|
||||
|
||||
### CONFIG
|
||||
COPY ./env /opt/firefly-iii/.env
|
||||
COPY ./firefly-iii.conf /etc/nginx/sites-enabled/
|
||||
|
||||
RUN apt -y autoremove \
|
||||
&& apt -y purge --auto-remove gcc curl \
|
||||
&& rm -rf /var/lib/apt \
|
||||
&& apt clean
|
||||
|
||||
### CRON
|
||||
RUN echo \
|
||||
'lastback="$(find /mnt/back/ -maxdepth 1 -mindepth 1 | sort | tail -n 1)"; ' \
|
||||
'mkdir -p $lastback/inc; ' \
|
||||
'thisback="$lastback/inc/$(date -u +%Y%m%d%H%M)/"; ' \
|
||||
'rm -rf $thisback; ' \
|
||||
'mariabackup --backup --target-dir="$thisback" --user root --password=pwd --incremental-basedir $lastback/full; ' \
|
||||
> /backup-inc.sh \
|
||||
&& echo \
|
||||
'set -e; ' \
|
||||
'service mysql start; ' \
|
||||
'thisback="/mnt/back/$(date -u +%Y%m%d)"/full; ' \
|
||||
'mkdir -p $thisback; ' \
|
||||
'rm -rf "$(dirname "$thisback")"; ' \
|
||||
'mkdir -p "$(dirname "$thisback")"; ' \
|
||||
'mariabackup --backup --target-dir="$thisback" --user=root --password=pwd; ' \
|
||||
> /backup.sh \
|
||||
&& echo \
|
||||
'set -e; ' \
|
||||
'rm -rf /var/lib/mysql-old; ' \
|
||||
'mkdir -p /mnt/back; ' \
|
||||
'lastback="$(find /mnt/back/ -maxdepth 1 -mindepth 1 | sort | tail -n 1)"; ' \
|
||||
'if [ -z "$lastback" ]; then exit 0; fi; ' \
|
||||
'service mysql stop || true; ' \
|
||||
'restoring=/tmp/restoring; ' \
|
||||
'cp -r "${lastback}/full" "$restoring"; ' \
|
||||
'mariabackup --prepare --target-dir="$restoring" --user=root --password=pwd --apply-log-only || true; ' \
|
||||
'inc_back="$(find $lastback/inc/ -maxdepth 1 -mindepth 1 | sort | tail -n 1)"; ' \
|
||||
'echo --- inc restore $inc_back ---; ' \
|
||||
'mariabackup --prepare --target-dir="$restoring" --user=root --password=pwd --incremental-dir "$inc_back" --apply-log-only || true; ' \
|
||||
'mv /var/lib/mysql /var/lib/mysql-old; ' \
|
||||
'mariabackup --copy-back --target-dir="$restoring" --user=root --password=pwd; ' \
|
||||
'rm -rf "$restoring"; ' \
|
||||
'chown -R mysql:mysql /var/lib/mysql; ' \
|
||||
'service mysql start; ' \
|
||||
> /restore.sh \
|
||||
&& echo '0 * * * * bash /backup-inc.sh >> /var/log/cronj.log 2>&1' > /etc/cron.d/backups \
|
||||
&& echo '' >> /etc/cron.d/backups \
|
||||
&& chmod 0644 /etc/cron.d/backups \
|
||||
&& crontab /etc/cron.d/backups \
|
||||
&& touch /var/log/cronj.log
|
||||
|
||||
### on enter/exit, rsync to/from /var/lib/mysql and /mnt
|
||||
ENTRYPOINT true \
|
||||
&& bash /restore.sh \
|
||||
&& bash /backup.sh \
|
||||
&& for s in mysql nginx php7.2-fpm cron; do service $s restart ; done && sleep 10 \
|
||||
&& exec /xfer/pauser
|
||||
6
firefly/ubuntu-old/build.sh
Executable file
6
firefly/ubuntu-old/build.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#! /bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
docker build -t dev:dev .
|
||||
docker run --rm -it -p 8031:8031 dev:dev
|
||||
102
firefly/ubuntu-old/env
Executable file
102
firefly/ubuntu-old/env
Executable file
@@ -0,0 +1,102 @@
|
||||
# You can leave this on "local". If you change it to production most console commands will ask for extra confirmation.
|
||||
# Never set it to "testing".
|
||||
APP_ENV=local
|
||||
|
||||
# Set to true if you want to see debug information in error screens.
|
||||
APP_DEBUG=true
|
||||
|
||||
# This should be your email address
|
||||
SITE_OWNER=admin@email.com
|
||||
|
||||
# The encryption key for your database and sessions. Keep this very secure.
|
||||
# If you generate a new one all existing data must be considered LOST.
|
||||
# Change it to a string of exactly 32 chars or use command `php artisan key:generate` to generate it
|
||||
APP_KEY=11111111111111111111111111111111
|
||||
|
||||
# Change this value to your preferred time zone.
|
||||
# Example: Europe/Amsterdam
|
||||
TZ=America/Chicago
|
||||
|
||||
# APP_URL and TRUSTED_PROXIES are useful when using Docker and/or a reverse proxy.
|
||||
APP_URL=http://localhost
|
||||
TRUSTED_PROXIES=
|
||||
|
||||
# The log channel defines where your log entries go to.
|
||||
LOG_CHANNEL=daily
|
||||
|
||||
# Database credentials. Make sure the database exists. I recommend a dedicated user for Firefly III
|
||||
# For other database types, please see the FAQ: http://firefly-iii.readthedocs.io/en/latest/support/faq.html
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=fireflyiii
|
||||
DB_USERNAME=fireflyiii
|
||||
DB_PASSWORD=pwd
|
||||
|
||||
# 'daily' is the default logging mode giving you 5 daily rotated log files in /storage/logs/.
|
||||
# Several other options exist. You can use 'single' for one big fat error log (not recommended).
|
||||
# Also available are 'syslog' and 'errorlog' which will log to the system itself.
|
||||
APP_LOG=daily
|
||||
|
||||
# Log level. You can set this from least severe to most severe:
|
||||
# debug, info, notice, warning, error, critical, alert, emergency
|
||||
# If you set it to debug your logs will grow large, and fast. If you set it to emergency probably
|
||||
# nothing will get logged, ever.
|
||||
APP_LOG_LEVEL=notice
|
||||
|
||||
# If you're looking for performance improvements, you could install memcached.
|
||||
CACHE_DRIVER=file
|
||||
SESSION_DRIVER=file
|
||||
|
||||
# Cookie settings. Should not be necessary to change these.
|
||||
COOKIE_PATH="/"
|
||||
COOKIE_DOMAIN=
|
||||
COOKIE_SECURE=false
|
||||
|
||||
# If you want Firefly III to mail you, update these settings
|
||||
MAIL_DRIVER=smtp
|
||||
MAIL_HOST=smtp.server.com
|
||||
MAIL_PORT=587
|
||||
MAIL_FROM=<from_email>
|
||||
MAIL_USERNAME=<email_username>
|
||||
MAIL_PASSWORD=<user_password>
|
||||
MAIL_ENCRYPTION=tls
|
||||
|
||||
# Firefly III can send you the following messages
|
||||
SEND_REGISTRATION_MAIL=true
|
||||
SEND_ERROR_MESSAGE=true
|
||||
|
||||
# Set a Mapbox API key here (see mapbox.com) so there might be a map available at various places.
|
||||
MAPBOX_API_KEY=
|
||||
|
||||
# Set a Fixer IO API key here (see https://fixer.io) to enable live currency exchange rates.
|
||||
# Please note that this will only work for paid fixer.io accounts because they severly limited
|
||||
# the free API up to the point where you might as well offer nothing.
|
||||
FIXER_API_KEY=
|
||||
|
||||
# If you wish to track your own behavior over Firefly III, set a valid analytics tracker ID here.
|
||||
ANALYTICS_ID=
|
||||
|
||||
# Most parts of the database are encrypted by default, but you can turn this off if you want to.
|
||||
# This makes it easier to migrate your database. Not that some fields will never be decrypted.
|
||||
USE_ENCRYPTION=true
|
||||
|
||||
# Leave the following configuration vars as is.
|
||||
# Unless you like to tinker and know what you're doing.
|
||||
APP_NAME=FireflyIII
|
||||
BROADCAST_DRIVER=log
|
||||
QUEUE_DRIVER=sync
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
CACHE_PREFIX=firefly
|
||||
SEARCH_RESULT_LIMIT=50
|
||||
PUSHER_KEY=
|
||||
PUSHER_SECRET=
|
||||
PUSHER_ID=
|
||||
DEMO_USERNAME=
|
||||
DEMO_PASSWORD=
|
||||
IS_DOCKER=true
|
||||
IS_SANDSTORM=false
|
||||
BUNQ_USE_SANDBOX=false
|
||||
IS_HEROKU=false
|
||||
29
firefly/ubuntu-old/firefly-iii.conf
Executable file
29
firefly/ubuntu-old/firefly-iii.conf
Executable file
@@ -0,0 +1,29 @@
|
||||
server {
|
||||
listen 8031;
|
||||
listen [::]:8031;
|
||||
|
||||
root /opt/firefly-iii/public;
|
||||
|
||||
# Add index.php to the list if you are using PHP
|
||||
client_max_body_size 300M;
|
||||
index index.html index.htm index.php;
|
||||
|
||||
# Load configuration files for the default server block.
|
||||
include /etc/nginx/default.d/*.conf;
|
||||
location ~ \.php$ {
|
||||
try_files $uri =404;
|
||||
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
|
||||
}
|
||||
|
||||
index index.php index.htm index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
autoindex on;
|
||||
sendfile off;
|
||||
}
|
||||
}
|
||||
20
firefly/ubuntu-old/pause/main.c
Executable file
20
firefly/ubuntu-old/pause/main.c
Executable file
@@ -0,0 +1,20 @@
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main() {
|
||||
int stat;
|
||||
int sig;
|
||||
sigset_t set;
|
||||
sigemptyset(&set);
|
||||
printf("add signal SIGINT: %i\n", sigaddset(&set, SIGINT));
|
||||
printf("add signal SIGKILL: %i\n", sigaddset(&set, SIGKILL));
|
||||
printf("add signal SIGTERM: %i\n", sigaddset(&set, SIGTERM));
|
||||
sigprocmask(SIG_BLOCK, &set, NULL);
|
||||
printf("Waiting...\n");
|
||||
stat = sigwait(&set, &sig);
|
||||
printf("Wait complete: %i (%i)\n", sig, stat);
|
||||
printf("Backed incremental: %i\n", system("bash /backup-inc.sh"));
|
||||
printf("Stopped mysql: %i\n", system("mysqladmin shutdown -ppwd"));
|
||||
return 0;
|
||||
}
|
||||
50
firefly/ubuntu-old/script.sh
Executable file
50
firefly/ubuntu-old/script.sh
Executable file
@@ -0,0 +1,50 @@
|
||||
#! /bin/bash
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
apt -y update && apt -y upgrade && apt -y autoremove
|
||||
DEBIAN_FRONTEND=noninteractive apt -y install tzdata
|
||||
apt -y install vim locales language-pack-en-base
|
||||
|
||||
echo '127.0.0.1 firefly-iii-domain.com firefly-iii localhost' >> /etc/hosts
|
||||
|
||||
apt -y install fail2ban
|
||||
|
||||
apt -y install mariadb-server nginx php-fpm php7.2-mysql php-curl php-gd php-bcmath php-zip php-intl php-mbstring php-xml
|
||||
|
||||
service mysql start
|
||||
echo 'FLUSH PRIVILEGES; ' \
|
||||
'USE mysql; ' \
|
||||
'UPDATE user SET authentication_string=PASSWORD("pwd") WHERE User='"'"'root'"'"'; ' \
|
||||
'UPDATE user SET plugin="mysql_native_password" WHERE User='"'"'root'"'"'; ' \
|
||||
| mysql -u root || true
|
||||
service mysql restart
|
||||
sleep 5
|
||||
|
||||
echo 'create database fireflyiii character set utf8 collate utf8_bin; ' \
|
||||
'grant all privileges on fireflyiii.* to fireflyiii@localhost identified by '"'"'pwd'"'"'; ' \
|
||||
| mysql -uroot -ppwd
|
||||
service mysql restart
|
||||
|
||||
apt -y install curl
|
||||
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
cd /opt
|
||||
composer create-project grumpydictator/firefly-iii --no-dev --prefer-dist firefly-iii 4.7.4
|
||||
|
||||
cp /copied/env /opt/firefly-iii/.env
|
||||
|
||||
cd firefly-iii
|
||||
php artisan migrate:refresh --seed
|
||||
php artisan passport:install
|
||||
|
||||
chown -R www-data:www-data /opt/firefly-iii/
|
||||
|
||||
rm /etc/nginx/sites-enabled/default
|
||||
touch /etc/nginx/sites-available/firefly-iii.conf
|
||||
ln -s /etc/nginx/sites-available/firefly-iii.conf /etc/nginx/sites-enabled/firefly-iii.conf
|
||||
openssl dhparam 2048 > /etc/nginx/dhparam.pem
|
||||
cp /copied/firefly-iii.conf /etc/nginx/sites-enabled/firefly-iii.conf
|
||||
|
||||
mkdir -p /run/php
|
||||
Reference in New Issue
Block a user