Compare commits
	
		
			2 Commits
		
	
	
		
			bf9c98fd3f
			...
			timetrex
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| f42cb94872 | |||
| 3abca7ce15 | 
| @@ -1,140 +0,0 @@ | ||||
| # Copyright (C) 2019-2020  Free I.T. Athens | ||||
| # | ||||
| # This program 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, version 3 of the License. | ||||
| # | ||||
| # This program 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 this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  | ||||
| - name: Install MySQL Support for Python | ||||
|   apt: | ||||
|     name: python-pymysql | ||||
|     state: present | ||||
|  | ||||
| - name: Create Database | ||||
|   mysql_db: | ||||
|     name: "{{ nc_db_name }}" | ||||
|     state: present | ||||
|     login_unix_socket: /var/run/mysqld/mysqld.sock | ||||
|  | ||||
| - name: Create Database User | ||||
|   mysql_user: | ||||
|     name: "{{ nc_db_user }}" | ||||
|     password: "{{ nc_db_pass }}" | ||||
|     priv: "{{ nc_db_name }}.*:ALL,GRANT" | ||||
|     state: present | ||||
|     login_unix_socket: /var/run/mysqld/mysqld.sock | ||||
|  | ||||
| - name: Install PHP Modules | ||||
|   apt: | ||||
|     name: [ | ||||
|             # Required | ||||
|             'php-ctype', 'php-curl', 'php-dom', | ||||
|             'php-gd', 'php-iconv', 'php-json', 'php-xml', | ||||
|             'php-mbstring', 'php-posix', 'php-simplexml', | ||||
|             'php-xmlreader', 'php-xmlwriter', 'php-zip', | ||||
|  | ||||
|             # Database Connectors | ||||
|             'php-pgsql', | ||||
|  | ||||
|             # Recommended Packages | ||||
|             'php-fileinfo', 'php-bz2', 'php-intl', | ||||
|  | ||||
|             # Enhanced Performance | ||||
|             'php-redis', 'redis-server', | ||||
|  | ||||
|             # Preview Generation | ||||
|             'php-imagick' | ||||
|           ] | ||||
|     state: present | ||||
|   notify: Reload Apache2 | ||||
|  | ||||
| - name: Create Public HTML Directory | ||||
|   file: | ||||
|     path: "{{ nc_dir }}/public_html" | ||||
|     state: directory | ||||
|  | ||||
| - name: Create Nextcloud Directories | ||||
|   file: | ||||
|     path: "{{ nc_dir }}/public_html/data" | ||||
|     state: directory | ||||
|     owner: www-data | ||||
|     group: www-data | ||||
|  | ||||
| - name: Create Logs Directory | ||||
|   file: | ||||
|     path: "{{ nc_dir }}/logs" | ||||
|     state: directory | ||||
|  | ||||
| - name: Download Nextcloud | ||||
|   get_url: | ||||
|     url: "https://download.nextcloud.com/server/releases/\ | ||||
|           nextcloud-{{ nc_version }}.tar.bz2" | ||||
|     dest: /tmp/nextcloud-{{ nc_version }}.tar.bz2 | ||||
|     checksum: sha256:{{ nc_sha256_hash }} | ||||
|  | ||||
| - name: Extract Nextcloud | ||||
|   unarchive: | ||||
|     src: /tmp/nextcloud-{{ nc_version }}.tar.bz2 | ||||
|     dest: "{{ nc_dir }}/public_html" | ||||
|     owner: www-data | ||||
|     group: www-data | ||||
|     extra_opts: [--strip-components=1] | ||||
|     remote_src: yes | ||||
|  | ||||
| - name: Install Nextcloud | ||||
|   command: | | ||||
|     php occ maintenance:install --database mysql \ | ||||
|     --database-name {{ nc_db_name }} --database-host {{ nc_db_host }} \ | ||||
|     --database-user {{ nc_db_user }} --database-pass {{ nc_db_pass }} \ | ||||
|     --admin-user {{ nc_admin }} --admin-pass {{ nc_admin_pass }} \ | ||||
|     --data-dir {{ nc_dir }}/public_html/data | ||||
|   become_user: www-data | ||||
|   register: nextcloud_install | ||||
|   args: | ||||
|     chdir: "{{ nc_dir }}/public_html" | ||||
|     creates: "{{ nc_dir }}/public_html/config/config.php" | ||||
|  | ||||
| - name: Add Missing Database Indexes | ||||
|   command: php occ db:add-missing-indices | ||||
|   become_user: www-data | ||||
|   register: nextcloud_db_update | ||||
|   args: | ||||
|     chdir: "{{ nc_dir }}/public_html" | ||||
|   when: nextcloud_install.changed | ||||
|  | ||||
| - name: Convert Database Columns to BIGINT | ||||
|   command: php occ db:convert-filecache-bigint | ||||
|   become_user: www-data | ||||
|   args: | ||||
|     chdir: "{{ nc_dir }}/public_html" | ||||
|   when: nextcloud_db_update.changed | ||||
|  | ||||
| - name: Add Domain Name to Trusted Domains | ||||
|   command: | | ||||
|     php occ config:system:set trusted_domains 0 --value={{ nc_domain }} | ||||
|   become_user: www-data | ||||
|   args: | ||||
|     chdir: "{{ nc_dir }}/public_html" | ||||
|   when: nextcloud_install.changed | ||||
|  | ||||
| - name: "Enable Apache2 Module: rewrite" | ||||
|   apache2_module: name=rewrite state=present | ||||
|  | ||||
| - name: Apply Apache Configuration | ||||
|   template: | ||||
|     src: nextcloud.conf.j2 | ||||
|     dest: /etc/apache2/sites-available/{{ nc_domain }}.conf | ||||
|   notify: Reload Apache2 | ||||
|  | ||||
| - name: Enable Apache Website | ||||
|   shell: a2ensite {{ nc_domain }} | ||||
|   args: | ||||
|     creates: /etc/apache2/sites-enabled/{{ nc_domain }}.conf | ||||
|   notify: Reload Apache2 | ||||
| @@ -1,27 +0,0 @@ | ||||
| <VirtualHost *:80> | ||||
|   ServerName {{ nc_domain }} | ||||
|  | ||||
|   ServerAdmin {{ nc_admin_email }} | ||||
|   DocumentRoot {{ nc_dir }}/public_html | ||||
|  | ||||
|   <Directory {{ nc_dir }}/public_html> | ||||
|  | ||||
|     Options +FollowSymLinks | ||||
|     AllowOverride All | ||||
|  | ||||
|     <IfModule mod_dav.c> | ||||
|       Dav off | ||||
|     </IfModule> | ||||
|  | ||||
|     SetEnv HOME {{ nc_dir }}/public_html | ||||
|     SetEnv HTTP_HOME {{ nc_dir }}/public_html | ||||
|  | ||||
|     # Nextcloud recommends 512MB | ||||
|     php_value memory_limit 512M | ||||
|   </Directory> | ||||
|  | ||||
|   ErrorLog {{ nc_dir }}/logs/error.log | ||||
|   CustomLog {{ nc_dir }}/logs/access.log combined | ||||
| </VirtualHost> | ||||
|  | ||||
| # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | ||||
| @@ -3,10 +3,13 @@ version: '3.5' | ||||
| volumes: | ||||
|   wordpress: | ||||
|   nextcloud: | ||||
|   postgres: | ||||
|  | ||||
| networks: | ||||
|   traefik: | ||||
|     name: traefik | ||||
|   postgres: | ||||
|     name: postgres | ||||
|  | ||||
| services: | ||||
|   traefik: | ||||
| @@ -108,3 +111,36 @@ services: | ||||
|       - traefik | ||||
|     extra_hosts: | ||||
|       - host.docker.internal:host-gateway | ||||
|  | ||||
|   timetrex: | ||||
|     image: freeitathens/timetrex:${TIMETREX_VERSION:-latest} | ||||
|     restart: always | ||||
|     environment: | ||||
|       POSTGRES_PASSWORD: password | ||||
|       POSTGRES_HOST: postgres | ||||
|     links: | ||||
|       - postgres | ||||
|     labels: | ||||
|       traefik.http.routers.timetrex.rule: "Host(`${TIMETREX_DOMAIN:-time.local.freeitathens.org}`)" | ||||
|       traefik.http.routers.timetrex.entrypoints: websecure | ||||
|       traefik.http.routers.timetrex.tls: true | ||||
|       traefik.http.routers.timetrex.tls.certresolver: letsencrypt | ||||
|       traefik.http.routers.timetrex.tls.domains[0].main: ${TRAEFIK_ACME_DOMAIN_MAIN:-local.freeitathens.org} | ||||
|       traefik.http.routers.timetrex.tls.domains[0].sans: "${TRAEFIK_ACME_DOMAIN_SANS:-*.local.freeitathens.org}" | ||||
|       traefik.http.services.timetrex.loadbalancer.server.port: 80 | ||||
|       traefik.docker.network: traefik | ||||
|       traefik.enable: ${NEXTCLOUD_WEB_ENABLED:-true} | ||||
|     networks: | ||||
|       - postgres | ||||
|       - traefik | ||||
|  | ||||
|   postgres: | ||||
|     image: postgres:13-bullseye | ||||
|     volumes: | ||||
|       - postgres:/var/lib/postgresql/data | ||||
|     environment: | ||||
|       POSTGRES_DB: timetrex | ||||
|       POSTGRES_USER: timetrex | ||||
|       POSTGRES_PASSWORD: password | ||||
|     networks: | ||||
|       - postgres | ||||
|   | ||||
		Reference in New Issue
	
	Block a user