commit eabb01cfefb7ea4eb9933aeb76a86576c66493f9 Author: poiuty Date: Wed Jul 27 11:48:27 2022 +0300 update diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..445e913 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +/app/chaturbate/chaturbate +/app/bongacams/bongacams diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8531c11 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 poiuty + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..8620fc8 --- /dev/null +++ b/README.md @@ -0,0 +1,45 @@ +

+ +

+ +``` +apt-get update +apt-get upgrade +apt-get install htop bwm-ng strace lsof iotop git build-essential screen +adduser --disabled-login stat +``` + +``` +git clone https://github.com/poiuty/statbate.git + +mkdir /home/stat/go +mkdir /home/stat/php +mkdir /home/stat/python +mkdir /var/www/statbate + +cp -r /statbate/app /home/stat/go +cp -r /statbate/cli/*.php /home/stat/php +cp -r /statbate/cli/*.py /home/stat/python +cp -r /statbate/html/* /var/www/statbate + +chown -R stat:stat /home/stat +chown -R www-data:www-data /var/www/statbate +``` + +1. Mariadb
+2. ClickHouse
+3. Nginx
+4. PHP
+5. Python
+6. Redis
+7. App +8. Add cron +``` +# nano /etc/cron.d/php + +*/10 * * * * stat php /home/stat/php/start2.php > /home/stat/php/log.txt 2>&1 +* * * * * www-data php /var/www/statbate/root/index.php >/dev/null 2>&1 + +# systemctl restart cron +# systemctl status cron +``` diff --git a/install/app.md b/install/app.md new file mode 100644 index 0000000..36c2a81 --- /dev/null +++ b/install/app.md @@ -0,0 +1,52 @@ +Install Golang (https://golang.org/dl/). +``` +wget https://dl.google.com/go/go1.14.1.linux-amd64.tar.gz +tar -xf go1.14.1.linux-amd64.tar.gz +ln -s /usr/local/go/bin/go /usr/local/bin/ +ln -s /usr/local/go/bin/gofmt /usr/local/bin/ +go version +``` + +Add user and service. +``` +# adduser --disabled-login stat +# nano /etc/systemd/system/app.service +[Unit] +Description=Stat Daemon +After=network.target manticore.service + +[Service] +LimitNOFILE=65535 +Type=simple +GuessMainPID=no +ExecStart=/home/stat/go/app/app +Restart=always +User=stat +StandardOutput=syslog +StandardError=syslog + +[Install] +WantedBy=multi-user.target + +# systemctl daemon-reload +# systemctl enable app +``` + +Build app. +``` +su stat +mkdir ~/go +cd ~/go +go get github.com/gorilla/websocket +go get github.com/go-sql-driver/mysql +go get github.com/jmoiron/sqlx +cd app +go build -ldflags "-s -w" +``` + +Start service. +``` +exit +systemctl start app +systemctl status app +``` diff --git a/install/cli/cloudscraper.py b/install/cli/cloudscraper.py new file mode 100644 index 0000000..7e3e981 --- /dev/null +++ b/install/cli/cloudscraper.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 + +import cloudscraper +import sys + +scraper = cloudscraper.create_scraper( + delay=15, + interpreter='nodejs', + captcha={ + 'provider': '2captcha', + 'api_key': '' + } +) + +if len(sys.argv) < 2: + print('no url'); + exit(0) + +print(scraper.get(sys.argv[1]).text) diff --git a/install/cli/import_clickhouse.php b/install/cli/import_clickhouse.php new file mode 100644 index 0000000..8001ac6 --- /dev/null +++ b/install/cli/import_clickhouse.php @@ -0,0 +1,36 @@ +query("select min(id) as min, max(id) as max from `stat`"); +if($query->rowCount() == 0){ + die("no data\n"); +} +$row = $query->fetch(); + +$min = $row['min']; +$max = $row['max']; + +$query = $clickhouse->query("SELECT max(id) as max FROM stat"); +if($query->rowCount() != 0){ + $min = $query->fetch()['max']+1; +} + +$step = 2048; + +for($i = $min; $i < $max; $i+=$step){ + $sql = ''; + $start = $i; + $end = $start+$step; + $query = $db->query("SELECT * FROM `stat` WHERE `id` >= $start AND `id` < $end"); + if($query->rowCount() == 0){ + continue; + } + while($row = $query->fetch()){ + $sql .= "({$row['id']}, {$row['did']}, {$row['rid']}, {$row['token']}, {$row['time']}),"; + } + $sql = rtrim($sql, ','); + $clickhouse->query("INSERT INTO stat VALUES $sql"); +} diff --git a/install/cli/start.php b/install/cli/start.php new file mode 100644 index 0000000..8feae21 --- /dev/null +++ b/install/cli/start.php @@ -0,0 +1,260 @@ +#!/usr/bin/env php +loadHTML($content, LIBXML_NOERROR | LIBXML_ERR_NONE); + $sxml = simplexml_import_dom($doc); + foreach ($sxml->xpath('//script') as $script) { + $text = (string)$script; + if(strpos($text, 'window.initial')) { + preg_match('/window.initialRoomDossier = \"(.*?)\"/', $text, $matches); + $str = preg_replace_callback('/\\\\u([0-9a-fA-F]{4})/', function ($match) { + return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); + }, $matches[1]); + $params = json_decode($str, true); + if(!is_array($params)){ + + var_dump($params); + + return false; + } + return $params; + } + } + file_put_contents('/home/stat/php/page.html', $content); + */ + $json = getPage("https://chaturbate.com/api/chatvideocontext/$room/"); + $params = json_decode($json, true); + if(!is_array($params)){ + var_dump($params); + return false; + } + return $params; +} + +function getServerWS($params){ + $host = $params['wschat_host']; + if(empty($host)){ + echo "server empty 1\n"; + return false; + } + $host = str_replace("https://", "", $host); + $host = str_replace("/ws", "", $host); + $server = explode('.', $host); + if(empty($server['0'])){ + echo "server empty 2\n"; + return false; + } + return $server['0']; +} + +function updateGender($id, $params){ + global $db; + + $arr = ['male', 'female', 'trans', 'couple']; + $gender = array_search($params['broadcaster_gender'], $arr); + if(empty($gender)){ + var_dump($params['broadcaster_gender']); + return; + } + $query = $db->prepare("UPDATE `room` SET `gender` = :gender WHERE `id` = :id"); + $query->bindParam(':id', $id); + $query->bindParam(':gender', $gender); + $query->execute(); +} + +function updateFollowers($name, $num){ + global $db; + if(empty($num)){ + return false; + } + $query = $db->prepare("UPDATE `room` SET `fans` = :fans WHERE `name` = :name"); + $query->bindParam(':name', $name); + $query->bindParam(':fans', $num); + $query->execute(); +} + +function getAPIList(){ + global $redis; + $stat = []; + $json = getPage('https://chaturbate.com/affiliates/api/onlinerooms/?format=json&wm=50xHQ'); + randSleep(); + if(!isJson($json)){ + return false; + } + $arr = json_decode($json, true); + if(!is_array($arr) || empty($arr)){ + return false; + } + $redis->setex('chaturbateList', 86400, $json); + usort($arr, function($a, $b){ + return $a['num_users'] < $b['num_users']; + }); + $viewers = 0; + foreach($arr as $val){ + cacheResult('getRoomInfo', ['name' => $val['username']], 3600, true); + updateFollowers($val['username'], $val['num_followers']); + $viewers += $val['num_users']; + if($val['num_users'] < 10){ + continue; + } + $stat[] = $val['username']; + } + if(empty($stat) || !is_array($stat)){ + return false; + } + return $stat; +} + +function randSleep(){ + $t = mt_rand(10,15); + echo "wait $t seconds...\n"; + sleep($t); +} + +function getFromPages(){ + $pages = 3; + echo "get list from pages"; + for($i=1; $i<=$pages; $i++){ + $html = getPage("https://chaturbate.com/?page=$i"); + preg_match_all('/alt="(.*)\'s/', $html, $tmp); + foreach($tmp[1] as $k => $v){ + $pos = stripos($v, ' '); + if($pos === false){ + $rooms[] = $v; + } + } + echo " $i"; + sleep(mt_rand(10,15)); + } + echo "\n"; + if(empty($rooms) || !is_array($rooms)){ + return false; + } + return $rooms; +} + +function sendStart($room){ + global $onlineList, $timeEnd; + if(time() > $timeEnd){ + die("Stop task\n"); + } + if(array_key_exists($room, $onlineList)){ + echo $room." already online\n"; + return true; + } + echo "start add $room\n"; + randSleep(); + $info = cacheResult('getRoomInfo', ['name' => $room], 3600, true); + if(!$info){ + echo "cant getRoomInfo\n"; + return false; + } + $params = getRoomParams($room); + if(!$params){ + echo "cant getRoomParams\n"; + return false; + } + updateGender($info['id'], $params); + $server = getServerWS($params); + if(!$server){ + echo "cant getServerWS\n"; + return false; + } + startBot($room, $server); + //die; +} + +function importList(){ + global $redis, $onlineList; + $online = file_get_contents('https://statbate.com/list/'); + if(isJson($online)){ + $onlineList = json_decode($online, true); + if(!empty($onlineList) && count($onlineList) > 100){ + $redis->setex('importList', 3600, $online); + return; + } + } + $online = $redis->get('importList'); + if($online !== false && isJson($online)){ + $onlineList = json_decode($online, true); + foreach($onlineList as $key => $val){ + echo "import from importList $key {$val['server']}\n"; + startBot($key, $val['server']); + } + } +} + +$timeEnd = time() + 590; + +$onlineList = []; +importList(); + +$arr100 = cacheResult('getTop', [], 600, true); +$arrPagesList = getFromPages(); +$arrApiList = getAPIList(); + +if(!empty($arrApiList) && !empty($arrPagesList)){ // Stop offline rooms + foreach($onlineList as $key => $val){ + if(!in_array($key, $arrApiList) && $val['last'] < time()+60*15){ + if(in_array($key, $arrPagesList)){ + continue; + } + stopBot($key); + } + } +} + +echo "Top100 \n"; +foreach($arr100 as $val){ // Start top 100 + if(in_array($val['name'], $arrPagesList) || in_array($val['name'], $arrApiList)){ + sendStart($val['name']); + } +} + +echo "PagesList \n"; +foreach($arrPagesList as $val){ // Start hiden rooms + if(!in_array($val, $arrApiList)){ + sendStart($val); + } +} + +echo "ApiList \n"; +foreach($arrApiList as $val){ // Start api list by num_users + sendStart($val); +} diff --git a/install/clickhouse.md b/install/clickhouse.md new file mode 100644 index 0000000..fe8ab6a --- /dev/null +++ b/install/clickhouse.md @@ -0,0 +1,35 @@ +https://clickhouse.com/docs/en/getting-started/install/ + +``` +apt-get install -y apt-transport-https ca-certificates dirmngr +apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 8919F6BD2B48D754 + +echo "deb https://packages.clickhouse.com/deb stable main" | sudo tee \ + /etc/apt/sources.list.d/clickhouse.list + +apt-get update + +apt-get install -y clickhouse-server clickhouse-client +systemctl start clickhouse-server +``` + +Disable logs. +``` +# nano /etc/clickhouse-server/config.d/z_log_disable.xml + + + + + + + + + + + + +``` +``` +# nano /etc/clickhouse-server/config.xml +warning +``` diff --git a/install/conf/app.service b/install/conf/app.service new file mode 100644 index 0000000..55a5c87 --- /dev/null +++ b/install/conf/app.service @@ -0,0 +1,16 @@ +[Unit] +Description=Stat Daemon +After=network.target manticore.service + +[Service] +LimitNOFILE=65535 +Type=simple +GuessMainPID=no +ExecStart=/home/stat/go/app/app +Restart=always +User=stat +StandardOutput=syslog +StandardError=syslog + +[Install] +WantedBy=multi-user.target diff --git a/install/conf/cron b/install/conf/cron new file mode 100644 index 0000000..5b4117c --- /dev/null +++ b/install/conf/cron @@ -0,0 +1,4 @@ +*/5 * * * * stat php /home/stat/php/start.php > /home/stat/php/log.txt 2>&1 +0 12 1 * * stat php /home/stat/php/telegram.php >/dev/null 2>&1 +0 12 15 */3 * stat php /home/stat/php/telegram2.php >/dev/null 2>&1 +* * * * * www-data curl --silent https://chaturbate100.com/index.php >/dev/null 2>&1 diff --git a/install/conf/default b/install/conf/default new file mode 100644 index 0000000..b79ced7 --- /dev/null +++ b/install/conf/default @@ -0,0 +1,45 @@ +server { + listen 80; + listen [::]:80; + server_name _; + location ^~ /.well-known/ { + root /var/www/html; + default_type "text/plain"; + } + location / { + return 301 https://$host$request_uri; + } +} + +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + server_name chaturbate100.com; + ssl_certificate /etc/letsencrypt/live/chaturbate100.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/chaturbate100.com/privkey.pem; + index index.php index.html index.htm; + root /var/www/chaturbate100.com; + location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|ico|bmp|woff)$ { + expires 30d; + access_log off; + } + location ~ \.php$ { + try_files $uri $uri/ =404; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name; + fastcgi_pass unix:/run/php/php7.3-fpm.sock; + } + location /ws/ { + proxy_pass http://localhost:8080; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + } + location ~ ^/(cmd|list)/ { + access_log off; + allow 127.0.0.1; + deny all; + proxy_pass http://localhost:8080; + } +} diff --git a/install/conf/manticore.conf b/install/conf/manticore.conf new file mode 100644 index 0000000..7149a4e --- /dev/null +++ b/install/conf/manticore.conf @@ -0,0 +1,19 @@ +index stat { + type = rt + rt_mem_limit = 1024M + rt_attr_uint = did + rt_attr_uint = rid + rt_attr_uint = token + rt_attr_timestamp = time + rt_field = tmp + path = /var/lib/manticore/data/stat +} + +searchd { + listen = 127.0.0.1:9312 + listen = 127.0.0.1:9306:mysql41 + log = /var/log/manticore/searchd.log + query_log = /var/log/manticore/query.log + pid_file = /var/run/manticore/searchd.pid + binlog_path = /var/lib/manticore/data +} diff --git a/install/conf/nginx.conf b/install/conf/nginx.conf new file mode 100644 index 0000000..5ec917b --- /dev/null +++ b/install/conf/nginx.conf @@ -0,0 +1,60 @@ +user www-data; +worker_processes auto; +pid /run/nginx.pid; +include /etc/nginx/modules-enabled/*.conf; +worker_rlimit_nofile 65535; + +events { + worker_connections 32768; + # multi_accept on; + use epoll; +} + +http { + + ## + # Basic Settings + ## + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + 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_dhparam /etc/nginx/ssl/dhparam.pem; + ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # 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_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; + + ## + # Virtual Host Configs + ## + + include /etc/nginx/conf.d/*.conf; + include /etc/nginx/sites-enabled/*; +} diff --git a/install/manticoresearch.md b/install/manticoresearch.md new file mode 100644 index 0000000..97471e8 --- /dev/null +++ b/install/manticoresearch.md @@ -0,0 +1,36 @@ +https://manticoresearch.com/downloads/ + +``` +wget https://github.com/manticoresoftware/manticoresearch/releases/download/3.4.0/manticore_3.4.0-200326-0686d9f0-release.buster_amd64-bin.deb +dpkg -i manticore_3.4.0-200326-0686d9f0-release.buster_amd64-bin.deb +``` + +``` +# nano /etc/ + +index stat { + type = rt + rt_mem_limit = 1024M + rt_attr_uint = did + rt_attr_uint = rid + rt_attr_uint = token + rt_attr_timestamp = time + rt_field = tmp + path = /var/lib/manticore/data/stat +} + +searchd { + listen = 127.0.0.1:9312 + listen = 127.0.0.1:9306:mysql41 + log = /var/log/manticore/searchd.log + query_log = /var/log/manticore/query.log + pid_file = /var/run/manticore/searchd.pid + binlog_path = /var/lib/manticore/data +} +``` + +``` +systemctl enable manticore.service +systemctl start manticore.service +systemctl status manticore.service +``` diff --git a/install/mariadb.md b/install/mariadb.md new file mode 100644 index 0000000..4b8b353 --- /dev/null +++ b/install/mariadb.md @@ -0,0 +1,106 @@ +List of repositories https://downloads.mariadb.org/mariadb/repositories/ + +``` +apt-get install software-properties-common dirmngr +apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc' +add-apt-repository 'deb [arch=amd64] http://mirror.rackspace.com/mariadb/repo/10.4/debian buster main' + +apt-get update +apt-get install mariadb-server +mysql_secure_installation +mysql -uroot -p +``` + +MariaDB config +``` +# nano /etc/mysql/my.cnf + +[client] +port = 3306 +socket = /var/run/mysqld/mysqld.sock +default-character-set = utf8mb4 + +[mysqld_safe] +socket = /var/run/mysqld/mysqld.sock +nice = 0 +malloc-lib = /usr/lib/x86_64-linux-gnu/libjemalloc.so.1 + +[mysqld] +user = mysql +pid-file = /var/run/mysqld/mysqld.pid +socket = /var/run/mysqld/mysqld.sock +port = 3306 +basedir = /usr +datadir = /var/lib/mysql +tmpdir = /tmp +skip-networking +skip-name-resolve + +# Other +default-storage-engine = INNODB +character-set-server = utf8mb4 +max_connections = 100 +wait_timeout = 7200 +max_allowed_packet = 16M +skip-external-locking +open_files_limit = 16000 + +# MyISAM settings +key_buffer_size = 128M + +# InnoDB settings +innodb_buffer_pool_size = 32G +innodb_buffer_pool_instances = 32 +innodb_log_file_size = 1G +innodb_flush_log_at_trx_commit = 0 +innodb_log_buffer_size = 16M +innodb_log_files_in_group = 2 +innodb_flush_method = O_DIRECT +innodb_thread_concurrency = 16 + +# Buffer settings +join_buffer_size = 2M + +# TMP & memory settings +tmp_table_size = 32M +max_heap_table_size = 32M + +# Try off https://community.centminmod.com/threads/mysqltuner.6779/ +query_cache_type = 0 # for OFF +query_cache_size = 0 # to ensure QC is NOT USED + +# Slowlog settings +slow_query_log = 1 +long_query_time = 5 +slow_query_log_file = /var/log/mysql/mariadb-slow.log + +#Set General Log +#general_log = on +#general_log_file = /var/log/mysql/full.log + +[mysqldump] +# Do not buffer the whole result set in memory before writing it to +# file. Required for dumping very large tables +quick + +max_allowed_packet = 32M +default-character-set = utf8mb4 + +[mysql] +no-auto-rehash +default-character-set = utf8mb4 + +[isamchk] +key_buffer_size = 8M +sort_buffer_size = 8M +read_buffer = 8M +write_buffer = 8M +default-character-set = utf8mb4 + +# +# * IMPORTANT: Additional settings that can override those from this file! +# The files must end with '.cnf', otherwise they'll be ignored. +# +!include /etc/mysql/mariadb.cnf +!includedir /etc/mysql/conf.d/ +``` diff --git a/install/nginx.md b/install/nginx.md new file mode 100644 index 0000000..f0e1cee --- /dev/null +++ b/install/nginx.md @@ -0,0 +1,23 @@ +``` +apt-get install nginx certbot +mkdir /etc/nginx/ssl/ +openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 +chown www-data:www-data /etc/nginx/ssl/dhparam.pem +chmod 400 /etc/nginx/ssl/dhparam.pem +``` + +Create SSL certificate. +``` +certbot certonly --webroot -w /var/www/html -d chaturbate100.com -m test@test.com --agree-tos +``` + +Update config files. +``` +wget -O /etc/nginx/nginx.conf https://raw.githubusercontent.com/poiuty/chaturbate100.com/master/conf/nginx.conf +wget -O /etc/nginx/sites-available/default https://raw.githubusercontent.com/poiuty/chaturbate100.com/master/conf/default +``` + +``` +systemctl restart nginx +systemctl status nginx +``` diff --git a/install/php.md b/install/php.md new file mode 100644 index 0000000..79446ea --- /dev/null +++ b/install/php.md @@ -0,0 +1,55 @@ +``` +apt-get install php-cli php-fpm +apt-get install php-redis php-mysql php-xml php-json php-gd php-igbinary php-curl php-mbstring php-xml +``` +``` +# nano /etc/php/7.3/fpm/pool.d/www.conf + +[www] +listen = /run/php/php7.3-fpm.sock + +user = www-data +group = www-data + +listen.owner = www-data +listen.group = www-data + +pm = static +pm.max_children = 50 +pm.max_requests = 10000 + +chdir = / + +php_admin_value[error_log] = /var/log/fpm-php.www.log +php_admin_flag[log_errors] = On +php_admin_flag[report_memleaks] = On + +php_admin_value[memory_limit] = 128M +php_admin_value[max_execution_time] = 30 +php_admin_value[date.timezone] = "Europe/Moscow" +php_admin_value[upload_max_filesize] = 4M +php_admin_value[post_max_size] = 4M +php_admin_flag[display_errors] = Off +php_admin_flag[expose_php] = Off + +php_admin_value[upload_tmp_dir] = "/tmp" + +php_admin_value[opcache.enable] = 1 +php_admin_value[opcache.interned_strings_buffer] = 8 +php_admin_value[opcache.max_accelerated_files] = 4000 + +php_admin_value[session.gc_probability] = 1 +php_admin_value[session.gc_divisor] = 1000 +php_admin_value[session.gc_maxlifetime] = 2592000 +php_admin_value[session.use_only_cookies] = 1 +php_admin_value[session.save_handler] = redis +php_admin_value[session.serialize_handler] = igbinary +php_admin_value[session.save_path] = "unix:///var/run/redis/redis-server.sock?persistent=1&weight=1&database=0" + +php_admin_value[disable_functions] = "apache_setenv, chown, chgrp, closelog, define_syslog_variables, dl, exec, ftp_exec, openlog, passthru, pcntl_exec, popen, posix_getegid, posix_geteuid, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, posix_uname, proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, syslog, system, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority, shell_exec" +``` + +``` +systemctl restart php7.3-fpm +systemctl status php7.3-fpm +``` diff --git a/install/python.md b/install/python.md new file mode 100644 index 0000000..e672fbe --- /dev/null +++ b/install/python.md @@ -0,0 +1,16 @@ +Chaturbate.com use Cloudflare. Sometime get problem with human check.
+Solution: https://github.com/VeNoMouS/cloudscraper +``` +start cloudscraper => get cookie => use it when send requests. +``` + +Install. +``` +apt-get install python-pip +pip install cloudscraper +``` + +Update. +``` +pip install cloudscraper -U +``` diff --git a/install/redis.md b/install/redis.md new file mode 100644 index 0000000..4fb1423 --- /dev/null +++ b/install/redis.md @@ -0,0 +1,12 @@ +``` +apt-get install redis-server +``` +``` +# nano /etc/redis/redis.conf + +... +unixsocket /var/run/redis/redis-server.sock +unixsocketperm 777 +... + +``` diff --git a/install/sql/clickhouse.sql b/install/sql/clickhouse.sql new file mode 100644 index 0000000..918947c --- /dev/null +++ b/install/sql/clickhouse.sql @@ -0,0 +1,32 @@ +CREATE DATABASE statbate; +USE statbate; + +CREATE TABLE room +( + id Int32, + gender UInt8 +) ENGINE = MySQL('127.0.0.1:3306', 'base', 'room', 'user', 'passwd'); + + +CREATE TABLE stat +( + did UInt32, + rid UInt32, + token UInt32, + time Date, + INDEX a did TYPE bloom_filter() GRANULARITY 1, + INDEX b rid TYPE bloom_filter() GRANULARITY 1 +) +ENGINE = MergeTree() +PARTITION BY toYYYYMMDD(time) +ORDER BY (time, rid, did) +PRIMARY KEY (time) +SETTINGS index_granularity = 8192; + +#CREATE TABLE stat_buffer ( +# did UInt32, +# rid UInt32, +# token UInt32, +# time Date +#) +#ENGINE = Buffer('statbate', 'stat', 16, 5, 30, 1000, 10000, 1000000, 10000000); diff --git a/install/sql/stat.sql b/install/sql/stat.sql new file mode 100644 index 0000000..75e6d00 --- /dev/null +++ b/install/sql/stat.sql @@ -0,0 +1,26 @@ +CREATE TABLE `donator` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varbinary(30) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=binary ROW_FORMAT=DYNAMIC; + +CREATE TABLE `room` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varbinary(30) NOT NULL, + `gender` tinyint(1) NOT NULL DEFAULT 0, + `fans` int(11) NOT NULL DEFAULT 0, + `last` int(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`), + KEY `gender` (`gender`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=binary ROW_FORMAT=DYNAMIC; + +CREATE TABLE `stat` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `did` int(11) NOT NULL, + `rid` int(11) NOT NULL, + `token` int(11) NOT NULL, + `time` int(11) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=binary ROW_FORMAT=DYNAMIC;