docker docs
This commit is contained in:
		
							parent
							
								
									6308dfefac
								
							
						
					
					
						commit
						bbb8d8be4f
					
				
							
								
								
									
										23
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								README.md
									
									
									
									
									
								
							| @ -1,11 +1,11 @@ | |||||||
| ``` | ``` | ||||||
|      _________.__     .__                   .__         ________    |      _________.__     .__                   .__         ________ | ||||||
|     /   _____/|  |__  |__|  _____    _____  |__|  ____  \_____  \   |     /   _____/|  |__  |__|  _____    _____  |__|  ____  \_____  \ | ||||||
|     \_____  \ |  |  \ |  | /     \  /     \ |  |_/ __ \  /  ____/   |     \_____  \ |  |  \ |  | /     \  /     \ |  |_/ __ \  /  ____/ | ||||||
|     /        \|   Y  \|  ||  Y Y  \|  Y Y  \|  |\  ___/ /       \   |     /        \|   Y  \|  ||  Y Y  \|  Y Y  \|  |\  ___/ /       \ | ||||||
|    /_______  /|___|  /|__||__|_|  /|__|_|  /|__| \___  >\_______ \  |    /_______  /|___|  /|__||__|_|  /|__|_|  /|__| \___  >\_______ \ | ||||||
|            \/      \/           \/       \/          \/         \/  |            \/      \/           \/       \/          \/         \/ | ||||||
|                                                                  | 
 | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| # Shimmie | # Shimmie | ||||||
| @ -60,14 +60,11 @@ Once you have an image which has passed all tests, you can then run it to get | |||||||
| a live system: | a live system: | ||||||
| 
 | 
 | ||||||
| ``` | ``` | ||||||
| docker run -p 0.0.0.0:8123:8000 shimmie | docker run -p 0.0.0.0:8123:8000 -v /mnt/shimmie-data:/app/data shimmie | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| Then you can visit your server on port 8123 to see the site. | Then you can visit your server on port 8123 to see the site, with data | ||||||
| 
 | stored in /mnt/shimmie-data on your local drive. | ||||||
| Note that the docker image is entirely self-contained and has no persistence |  | ||||||
| (assuming you use the sqlite database); each `docker run` will give a clean |  | ||||||
| un-installed image. |  | ||||||
| 
 | 
 | ||||||
| ### Upgrade from earlier versions | ### Upgrade from earlier versions | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -100,8 +100,6 @@ class IPBan extends Extension | |||||||
|     { |     { | ||||||
|         global $cache, $config, $database, $page, $_shm_user_classes; |         global $cache, $config, $database, $page, $_shm_user_classes; | ||||||
| 
 | 
 | ||||||
|         $d = @$_GET['DEBUG']; |  | ||||||
| 
 |  | ||||||
|         // Get lists of banned IPs and banned networks
 |         // Get lists of banned IPs and banned networks
 | ||||||
|         $ips = $cache->get("ip_bans"); |         $ips = $cache->get("ip_bans"); | ||||||
|         $networks = $cache->get("network_bans"); |         $networks = $cache->get("network_bans"); | ||||||
| @ -127,24 +125,11 @@ class IPBan extends Extension | |||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         // Check if our current IP is in either of the ban lists
 |         // Check if our current IP is in either of the ban lists
 | ||||||
|         $remote = $_SERVER['REMOTE_ADDR']; |         $active_ban_id = ( | ||||||
|         $active_ban_id = null; |             $this->find_active_ban($ips, $_SERVER['REMOTE_ADDR'], $networks) || | ||||||
|         if (isset($ips[$remote])) { |             $this->find_active_ban($ips, @$_SERVER['HTTP_X_FORWARDED_FOR'], $networks) | ||||||
|             $active_ban_id = $ips[$remote]; |         ); | ||||||
|         } else { |  | ||||||
|             foreach ($networks as $range => $ban_id) { |  | ||||||
|                 if (ip_in_range($remote, $range)) { |  | ||||||
|                     $active_ban_id = $ban_id; |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 | 
 | ||||||
|         if ($d) { |  | ||||||
|             print($remote); |  | ||||||
|             print("\n"); |  | ||||||
|             print($active_ban_id); |  | ||||||
|             print("\n"); |  | ||||||
|         } |  | ||||||
|         // If an active ban is found, act on it
 |         // If an active ban is found, act on it
 | ||||||
|         if (!is_null($active_ban_id)) { |         if (!is_null($active_ban_id)) { | ||||||
|             $row = $database->get_row("SELECT * FROM bans WHERE id=:id", ["id"=>$active_ban_id]); |             $row = $database->get_row("SELECT * FROM bans WHERE id=:id", ["id"=>$active_ban_id]); | ||||||
| @ -365,4 +350,20 @@ class IPBan extends Extension | |||||||
|             $this->set_version("ext_ipban_version", 10); |             $this->set_version("ext_ipban_version", 10); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     public function find_active_ban($ips, $remote, $networks) | ||||||
|  |     { | ||||||
|  |         if(!$remote) return null; | ||||||
|  |         $active_ban_id = null; | ||||||
|  |         if (isset($ips[$remote])) { | ||||||
|  |             $active_ban_id = $ips[$remote]; | ||||||
|  |         } else { | ||||||
|  |             foreach ($networks as $range => $ban_id) { | ||||||
|  |                 if (ip_in_range($remote, $range)) { | ||||||
|  |                     $active_ban_id = $ban_id; | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return $active_ban_id; | ||||||
|  |     } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user