Differences

This shows you the differences between two versions of the page.

Link to this comparison view

internet:self-hosting [2011/12/24 18:53]
cyril
internet:self-hosting [2013/09/19 16:40]
Line 1: Line 1:
-====== Website Self Hosting ====== 
  
-===== IP ===== 
- 
-Dynamic DNS service if you don't have a static IP. 
- 
-===== Hardware ===== 
- 
-Any old machine, or even  better an old laptop (less power, less noise, less room). 
- 
-==== Flash cache ==== 
- 
-Solutions for hybriding flash drives and hard drives have been experimented to save power on laptops, but it is quite complex in the general case and there is no final-user implementation yet, and the gains are limited on an everyday use machine. However it is a lot more efficient and simple on a server, as there are a lot less interactions with users and the panel of activities is largely reduced. Hence you only have to put on flash disk a few directories and files that the system regularly write to (the cache in RAM is enough for reading), and the disk can remain spun down for hours or days if you don't start unusual applications. 
- 
-You need an USB stick or SD Card of at least 2GB (4GB is advised), and an init script to mount and fetch during early boot process, and unmount and flush during late shutdown process. For instance I wrote this one for Gentoo: [[init_fcache|/etc/init.d/fcache]] with conf [[conf_fcache|/etc/conf.d/fcache]], add it to the boot runlevel (''rc-update add fcache boot''). 
- 
-The main directories you need to take care of are: 
-  * ''/var'' 
-  * ''/tmp'' if not already mounted as tmpfs in ram 
-  * ''/home'' and ''/etc'' if you have enough space 
- 
-For files, create a ''~/.fcache'' directory, and move all the files you want to cache to it. Then either create a symbolic link or configure the program to use this new location: 
-  * ''~/.history'': shell history for all users including root; set the new location with the $HISTFILE environment variable for zsh in .zshrc file. 
-  * ''~/.lesshst'': ''less'' history; works with symlink. 
-  * ''~/.xsession-errors'': gdm file; needs version >2.32.1 so that symlink works, or maybe recreate it at beginning of each session. 
-  * ''~/.Xauthority'': xauth file;  
-    * for GDM: set ''[daemon] UserAuthDir=/home/cyril/.fcache'' in ''/etc/X11/gdm/custom.conf'' 
-    * for SSHD: set ''XAUTHORITY=/home/cyril/.fcache/.Xauthority'' in ''~/.ssh/environment'', and ''PermitUserEnvironment yes'' in ''/etc/ssh/sshd_config''  
-    * for SU: set ''cyril'' (your username) in ''/root/.xauth/import'', to avoid creation of ''/root/.xauthXXXXX'' files 
-    * for the rest: set ''export XAUTHORITY=/home/cyril/.fcache/.Xauthority'' in ''~/.zshenv'' file (or if there is somewhere else upstream enough to avoid point for SSHD it would be better) 
- 
-You can use a script similar to this one to monitor what files are being used and add them to the cache (you can then grep "sda" and "dirtied"), and monitor if the drive remains spun down: 
-<code sh> 
-#!/bin/sh 
- 
-rm -f /mnt/ram/disk.log 
-dmesg -c 
-#sudo sysctl vm.block_dump=1 
-echo 1 > /proc/sys/vm/block_dump 
-watch --interval=5 'dmesg -c | grep sda >> /mnt/ram/disk.log ; hdparm -C /dev/sda | grep "drive state" | cut -d":" -f2 >> /mnt/ram/disk.log' 
-echo 0 > /proc/sys/vm/block_dump 
-</code> 
- 
-Eventually if you run ''smartd'' daemon, it will wakes up the drive every 30min by default to perform some checks. You have to tell it to not do tests if the drive is in standby powermode. Edit ''/etc/smartd.conf'': 
-<code diff> 
--DEVICESCAN 
-+#DEVICESCAN 
-+/dev/sda -d ata -n standby 
-</code> 
- 
-You can try to tune how syslog will write to the disk to save the flash life, in ''/etc/syslog-ng/syslog-ng.conf'': 
-<code> 
-options { 
-    mark_freq(0); # remove --MARK-- lines issued by default every 20s 
-    flush_lines(20); 
-    flush_timeout(60000); # in ms 
-}; 
-</code> 
internet/self-hosting.txt ยท Last modified: 2013/09/19 16:40 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0