Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using a disk image in Ext4 to store the logs #119

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ansible/roles/common/files/nginx/admin.local
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ server {
listen [::]:80;
server_name admin.local www.admin.local admin.elimupi.online local.elimupi.online;
index index.php index.html index.htm;
error_log /var/www/log/admin-log;
error_log /mnt/content/www_log/admin-log;

location / {
autoindex on;
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/common/files/nginx/fdroid.local
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ server {
listen 80;
listen [::]:80;
server_name fdroid.elimupi.online www.fdroid.local fdroid.local;
error_log /var/www/log/fdroid-log;
error_log /mnt/content/www_log/fdroid-log;
location /{
autoindex on;
root /mnt/content/fdroid;
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/common/files/nginx/files.local
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
server {
listen 80;
server_name www.files.local files.local;
error_log /var/www/log/files-log;
error_log /mnt/content/www_log/files-log;
location /{
autoindex on;
root /mnt/content/files;
Expand Down
6 changes: 6 additions & 0 deletions ansible/roles/common/tasks/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
regexp: '^LABEL=Content'
line: 'LABEL=Content /mnt/content ntfs defaults,noatime,nofail 0 0'

- name: Setup | Add the logs image to fstab
ansible.builtin.lineinfile:
path: /etc/fstab
regexp: 'www_log'
line: '/mnt/content/www_log.img /mnt/content/www_log ext4 defaults,noatime,nofail 0 0'

- name: Setup | Install devmon.service systemd unit file
ansible.builtin.template:
src: devmon.service.j2
Expand Down
18 changes: 12 additions & 6 deletions ansible/roles/common/tasks/webserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@
path: /etc/nginx/sites-enabled/default
state: absent

- name: Webserver | Create directory /var/www/log
ansible.builtin.file:
path: /var/www/log
state: directory
mode: '0755'

- name: Webserver | Enable services
ansible.builtin.service:
name: "{{ item }}"
Expand Down Expand Up @@ -96,6 +90,18 @@
regex: '^\s*#? *server_names_hash_bucket_size 64;'
line: server_names_hash_bucket_size 64;

- name: Webserver | set access_log to the mounted device
ansible.builtin.lineinfile:
path: /etc/nginx/nginx.conf
regexp: 'access_log\s+/var/log/nginx/access.log;$'
line: 'access_log /mnt/content/www_log/access.log;'

- name: Webserver | set error_log to the mounted device
ansible.builtin.lineinfile:
path: /etc/nginx/nginx.conf
regexp: 'error_log /var/log/nginx/error.log;$'
line: 'error_log /mnt/content/www_log/error.log;'

# Add Webinterface sudo settings
- name: Webserver | Set sudo file 020_elimupi
ansible.builtin.copy:
Expand Down