commit e07dba4d5329cc2ea2dea9198698264cb215afec Author: Rob Taglang Date: Sun Jan 1 18:43:58 2023 -0500 Add self hosted deployment files diff --git a/calibre/John Schember/Quick Start Guide (1)/Quick Start Guide - John Schember.epub b/calibre/John Schember/Quick Start Guide (1)/Quick Start Guide - John Schember.epub new file mode 100644 index 0000000..a2167c5 Binary files /dev/null and b/calibre/John Schember/Quick Start Guide (1)/Quick Start Guide - John Schember.epub differ diff --git a/calibre/John Schember/Quick Start Guide (1)/cover.jpg b/calibre/John Schember/Quick Start Guide (1)/cover.jpg new file mode 100644 index 0000000..ce0b28a Binary files /dev/null and b/calibre/John Schember/Quick Start Guide (1)/cover.jpg differ diff --git a/calibre/John Schember/Quick Start Guide (1)/metadata.opf b/calibre/John Schember/Quick Start Guide (1)/metadata.opf new file mode 100644 index 0000000..a05a636 --- /dev/null +++ b/calibre/John Schember/Quick Start Guide (1)/metadata.opf @@ -0,0 +1,19 @@ + + + + 1 + e087b93d-b430-4933-9d85-15b6224bcc32 + Quick Start Guide + John Schember + calibre (4.22.0) [https://calibre-ebook.com] + 0101-01-01T00:00:00+00:00 + calibre Quick Start Guide + eng + + + + + + + + diff --git a/calibre/metadata.db b/calibre/metadata.db new file mode 100644 index 0000000..89c6436 Binary files /dev/null and b/calibre/metadata.db differ diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..2d753b7 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,210 @@ +version: '3' + +networks: + unifi_network: + mayan_network: + gitea_network: + +volumes: + scanned_files: + driver: local + driver_opts: + type: cifs + o: username=defaults,password=defaults,sec=ntlm,vers=1.0,file_mode=0777,dir_mode=0777 + device: "\\\\192.168.1.146\\MEMORYCARD\\EPSCAN\\001" + +services: + nginx: + image: staticfloat/nginx-certbot + restart: always + network_mode: 'host' + environment: + CERTBOT_EMAIL: rob@taglang.io + volumes: + - ./nginx.conf.d:/etc/nginx/user.conf.d:ro + - /opt/services/letsencrypt:/etc/letsencrypt + + sync_files: + build: sync_files + image: sync_files:local + restart: always + volumes: + - scanned_files:/source + - /opt/services/mayan/scanned_files:/target + + unifi_db: + image: mongo:3.4 + restart: always + networks: + - unifi_network + volumes: + - /opt/services/unifi/db:/data/db + + unifi_controller: + image: jacobalberty/unifi:latest + restart: always + depends_on: + - unifi_db + networks: + - unifi_network + volumes: + - /opt/services/unifi/data:/unifi/data + - /opt/services/unifi/log:/unifi/log + - /opt/services/unifi/cert:/unifi/cert + - /opt/services/unifi/init:/unifi/init.d + environment: + DB_URI: mongodb://unifi_db/unifi + STATDB_URI: mongodb://unifi_db/unifi_stat + DB_NAME: unifi + ports: + - "3478:3478/udp" # STUN + - "6789:6789/tcp" # Speed test + - "8080:8080/tcp" # Device/ controller comm. + - "8443:8443/tcp" # Controller GUI/API as seen in a web browser + - "8880:8880/tcp" # HTTP portal redirection + - "8843:8843/tcp" # HTTPS portal redirection + - "10001:10001/udp" # AP discovery + + unifi_logs: + image: bash + restart: always + depends_on: + - unifi_controller + command: bash -c 'tail -F /unifi/log/*.log' + volumes: + - /opt/services/unifi/log:/unifi/log + + gitlab: + image: 'gitlab/gitlab-ce:latest' + restart: always + hostname: 'gitlab.taglang.io' + environment: + GITLAB_OMNIBUS_CONFIG: | + external_url 'https://gitlab.taglang.io' + nginx['listen_port'] = 80 + nginx['listen_https'] = false + gitlab_rails['gitlab_shell_ssh_port'] = 2224 + ports: + - '8881:80' + - '2224:22' + volumes: + - /opt/services/gitlab/config:/etc/gitlab + - /opt/services/gitlab/logs:/var/log/gitlab + - /opt/services/gitlab/data:/var/opt/gitlab + + gitea: + image: 'gitea/gitea:latest' + environment: + - USER_UID=1000 + - USER_GID=1000 + restart: always + networks: + - gitea_network + volumes: + - /opt/services/gitea:/data + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + ports: + - '8885:3000' + - '2222:22' + + mayan_app: + image: mayanedms/mayanedms:3 + depends_on: + - mayan_postgresql + - mayan_redis + # Enable to use RabbitMQ + #- rabbitmq + environment: &mayan_env + # Enable to use RabbitMQ + # MAYAN_CELERY_BROKER_URL: amqp://mayan:mayanrabbitpass@broker:5672/mayan + # Disable Redis Broker to use RabbitMQ as Broker + MAYAN_CELERY_BROKER_URL: redis://:mayanredispassword@mayan_redis:6379/0 + MAYAN_CELERY_RESULT_BACKEND: redis://:mayanredispassword@mayan_redis:6379/1 + MAYAN_DATABASES: "{'default':{'ENGINE':'django.db.backends.postgresql','NAME':'mayan','PASSWORD':'mayandbpass','USER':'mayan','HOST':'mayan_postgresql'}}" + networks: + - mayan_network + ports: + - "8882:8000" + restart: always + volumes: + - /opt/services/mayan/media:/var/lib/mayan + - /opt/services/mayan/scanned_files:/var/lib/mayan/scanned_files + + mayan_postgresql: + image: postgres:9.6-alpine + environment: + POSTGRES_DB: mayan + POSTGRES_PASSWORD: mayandbpass + POSTGRES_USER: mayan + networks: + - mayan_network + restart: always + volumes: + - /opt/services/mayan/postgres:/var/lib/postgresql/data + + mayan_redis: + image: redis:5.0-alpine + command: + - redis-server + - --databases + - "2" + - --maxmemory-policy + - allkeys-lru + - --save + - "" + - --requirepass mayanredispassword + networks: + - mayan_network + restart: always + volumes: + - /opt/services/mayan/redis:/data + + spotify_jenna: + build: spotify + image: spotify:local + restart: always + hostname: Jenna Spotify Server + devices: + - /dev/snd + environment: + SPOTIFY_USERNAME: adrian.jenna.c + SPOTIFY_PASSWORD: fM,KM_xK'Jn9vvU> + + spotify_rob: + build: spotify + image: spotify:local + restart: always + hostname: Rob Spotify Server + devices: + - /dev/snd + environment: + SPOTIFY_USERNAME: lasalvavida + SPOTIFY_PASSWORD: amethyst1 + + calibre_web: + image: linuxserver/calibre-web + container_name: calibre-web + environment: + - PUID=1000 + - PGID=1000 + - TZ=America/New_York + - DOCKER_MODS=linuxserver/calibre-web:calibre + ports: + - 8883:8083 + restart: always + volumes: + - /opt/services/calibre/config:/config + - /opt/services/calibre/library:/books + + koken: + build: koken + image: koken:local + restart: always + hostname: koken.taglang.io + ports: + - 8884:80 + volumes: + - ./koken/99-custom_overrides.ini:/etc/php5/fpm/conf.d/99-custom_overrides.ini:ro + - /opt/services/koken/www:/usr/share/nginx/www + - /opt/services/koken/mysql:/var/lib/mysql diff --git a/host-setup.sh b/host-setup.sh new file mode 100644 index 0000000..32d00e9 --- /dev/null +++ b/host-setup.sh @@ -0,0 +1,2 @@ +#!/bin/bash +echo "options snd-hda-intel index=1" > /etc/modprobe.d/alsa.conf \ No newline at end of file diff --git a/koken/99-custom_overrides.ini b/koken/99-custom_overrides.ini new file mode 100644 index 0000000..bf24fef --- /dev/null +++ b/koken/99-custom_overrides.ini @@ -0,0 +1,2 @@ +upload_max_filesize = 2G +post_max_size = 2G diff --git a/koken/Dockerfile b/koken/Dockerfile new file mode 100644 index 0000000..9743539 --- /dev/null +++ b/koken/Dockerfile @@ -0,0 +1,3 @@ +FROM koken/koken-lemp:latest + +COPY ./nginx.conf /etc/nginx/nginx.conf \ No newline at end of file diff --git a/koken/nginx.conf b/koken/nginx.conf new file mode 100644 index 0000000..2e648dd --- /dev/null +++ b/koken/nginx.conf @@ -0,0 +1,90 @@ +user www-data; +worker_processes auto; +pid /run/nginx.pid; +include /etc/nginx/modules-enabled/*.conf; + +events { + use epoll; + worker_connections 768; + # multi_accept on; +} + +http { + + ## + # Basic Settings + ## + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 2; + client_max_body_size 2G; + port_in_redirect off; + types_hash_max_size 2048; + # server_tokens off; + + # server_names_hash_bucket_size 64; + # server_name_in_redirect off; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + ## + # SSL Settings + ## + + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE + ssl_prefer_server_ciphers on; + + ## + # Logging Settings + ## + + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; + + ## + # Gzip Settings + ## + + gzip on; + gzip_disable "msie6"; + + # gzip_vary on; + # gzip_proxied any; + # gzip_comp_level 6; + # gzip_buffers 16 8k; + # gzip_http_version 1.1; + # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; + + ## + # Virtual Host Configs + ## + + include /etc/nginx/conf.d/*.conf; + include /etc/nginx/sites-enabled/*; +} + + +#mail { +# # See sample authentication script at: +# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript +# +# # auth_http localhost/auth.php; +# # pop3_capabilities "TOP" "USER"; +# # imap_capabilities "IMAP4rev1" "UIDPLUS"; +# +# server { +# listen localhost:110; +# protocol pop3; +# proxy on; +# } +# +# server { +# listen localhost:143; +# protocol imap; +# proxy on; +# } +#} +daemon off; diff --git a/nginx.conf.d/.htpasswd b/nginx.conf.d/.htpasswd new file mode 100644 index 0000000..ef72517 --- /dev/null +++ b/nginx.conf.d/.htpasswd @@ -0,0 +1 @@ +rob:$apr1$9xyPmEcI$/icPEYJeSik0H1H4J3Im4. diff --git a/nginx.conf.d/taglang.io.conf b/nginx.conf.d/taglang.io.conf new file mode 100644 index 0000000..ca99b02 --- /dev/null +++ b/nginx.conf.d/taglang.io.conf @@ -0,0 +1,84 @@ +server { + listen 443 ssl; + server_name unifi.taglang.io; + location / { + proxy_set_header Host $host; + proxy_pass http://localhost:8880; + proxy_redirect off; + } + ssl_certificate /etc/letsencrypt/live/unifi.taglang.io/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/unifi.taglang.io/privkey.pem; +} +server { + listen 443 ssl; + server_name gitlab.taglang.io; + location / { + proxy_set_header Host $host; + proxy_pass http://localhost:8881; + proxy_redirect off; + } + ssl_certificate /etc/letsencrypt/live/gitlab.taglang.io/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/gitlab.taglang.io/privkey.pem; +} +server { + listen 443 ssl; + server_name mayan.taglang.io; + location / { + proxy_set_header Host $host; + proxy_pass http://localhost:8882; + proxy_redirect off; + } + ssl_certificate /etc/letsencrypt/live/mayan.taglang.io/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/mayan.taglang.io/privkey.pem; +} +server { + listen 443 ssl; + server_name calibre.taglang.io; + location / { + proxy_set_header Host $host; + proxy_pass http://localhost:8883; + proxy_redirect off; + } + ssl_certificate /etc/letsencrypt/live/calibre.taglang.io/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/calibre.taglang.io/privkey.pem; + client_max_body_size 2G; +} +server { + listen 443 ssl; + server_name koken.taglang.io; + location / { + proxy_set_header Host $host; + proxy_pass http://localhost:8884; + proxy_redirect off; + auth_basic "Restricted"; + auth_basic_user_file /etc/nginx/user.conf.d/.htpasswd; + } + location /admin { + proxy_set_header Host $host; + proxy_pass http://localhost:8884; + proxy_redirect off; + proxy_set_header X-Forwarded-Proto https; + } + location ~* \.php$ { + proxy_set_header Host $host; + proxy_pass http://localhost:8884; + proxy_redirect off; + proxy_set_header X-Forwarded-Proto https; + } + ssl_certificate /etc/letsencrypt/live/koken.taglang.io/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/koken.taglang.io/privkey.pem; + client_max_body_size 2G; +} +server { + listen 443 ssl; + server_name git.taglang.io; + location / { + proxy_set_header Host $host; + proxy_pass http://localhost:8885; + proxy_redirect off; + } + ssl_certificate /etc/letsencrypt/live/git.taglang.io/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/git.taglang.io/privkey.pem; + client_max_body_size 2G; +} + diff --git a/spotify/Dockerfile b/spotify/Dockerfile new file mode 100644 index 0000000..36280eb --- /dev/null +++ b/spotify/Dockerfile @@ -0,0 +1,29 @@ +FROM ubuntu + +# Install base dependencies +RUN apt-get update && apt-get install -y curl gnupg locales pulseaudio + +# Set the locale/TZ +RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ + locale-gen +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 +ENV TZ America/New_York +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +RUN apt-get install tzdata + +# Set up the virtual display +RUN apt-get install -y xvfb +ENV DISPLAY :1 + +# Install spotify +RUN curl -sS https://download.spotify.com/debian/pubkey_5E3C45D7B312C643.gpg | apt-key add - +RUN echo "deb http://repository.spotify.com stable non-free" | tee /etc/apt/sources.list.d/spotify.list +RUN apt-get update && apt-get install -y spotify-client + +# Start +ADD start.sh / +RUN chmod +x /start.sh + +CMD ["/start.sh"] diff --git a/spotify/start.sh b/spotify/start.sh new file mode 100644 index 0000000..064b1f1 --- /dev/null +++ b/spotify/start.sh @@ -0,0 +1,4 @@ +#!/bin/bash +rm /tmp/.X1-lock +Xvfb :1 -screen 0 1024x768x16 & sleep 1 +spotify --username="${SPOTIFY_USERNAME}" --password="${SPOTIFY_PASSWORD}" --show-console \ No newline at end of file diff --git a/sync_files/Dockerfile b/sync_files/Dockerfile new file mode 100644 index 0000000..306acb9 --- /dev/null +++ b/sync_files/Dockerfile @@ -0,0 +1,10 @@ +FROM ubuntu + +# Install base dependencies +RUN apt-get update && apt-get install -y python3 + +# Start +ADD sync_files.py / +RUN chmod +x /sync_files.py + +CMD ["python3", "-u", "/sync_files.py"] diff --git a/sync_files/start.sh b/sync_files/start.sh new file mode 100644 index 0000000..06c3871 --- /dev/null +++ b/sync_files/start.sh @@ -0,0 +1,5 @@ +#!/bin/bash +rsync --remove-source-files -avz /source/* /target +while inotifywait -r -e modify,create,delete,move /source; do + rsync --remove-source-files -avz /source/* /target +done diff --git a/sync_files/sync_files.py b/sync_files/sync_files.py new file mode 100644 index 0000000..5d28525 --- /dev/null +++ b/sync_files/sync_files.py @@ -0,0 +1,44 @@ +from shutil import copyfile +import os +import time +import uuid + +def is_done_being_written(file_path): + file_size_before = os.path.getsize(file_path) + print('Size before: ', file_size_before) + time.sleep(1) # 1s + file_size_after = os.path.getsize(file_path) + print('Size after: ', file_size_after) + return file_size_before == file_size_after + +def copy(source_file_path): + destination_dir = '/target' + destination_file_path = os.path.join(destination_dir, str(uuid.uuid4()) + '.pdf') + print(source_file_path, ' -> ', destination_file_path) + print('Checking if the file is done being written...') + while not is_done_being_written(source_file_path): + continue + print('File is stable, copying...') + copyfile(source_file_path, destination_file_path) + print('Deleting original...') + os.remove(source_file_path) + +def main(): + while True: + try: + source_dir = '/source' + for file_name in os.listdir(source_dir): + file_path = os.path.join(source_dir, file_name) + try: + copy(file_path) + except Exception as err: + print('Failed to copy ', file_path) + print(err) + except Exception as err: + print(err) + print('Done!') + print('Sleeping for 10m...') + time.sleep(60 * 10) #10m + +if __name__ == "__main__": + main()