Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:comet:building-from-source [2017/04/18 04:30]
levhav [Settings]
en:comet:building-from-source [2019/12/18 02:05] (current)
Line 1: Line 1:
 +<​rst>​EN::​004-Administration::​004-Install</​rst>​
 +<​rst>​Header:​ Install</​rst>​
 +
 ====== Install ====== ====== Install ======
  
Line 13: Line 16:
 cmake . cmake .
 make make
 +make install
 </​code>​ </​code>​
  
Line 19: Line 23:
    
   * Create a database in mysql based on [[https://​github.com/​Levhav/​comet-server/​blob/​master/​db.sql|db.sql]] file   * Create a database in mysql based on [[https://​github.com/​Levhav/​comet-server/​blob/​master/​db.sql|db.sql]] file
-  * In comet.conf file, set the details to access the database +  * In [[https://​github.com/​CppComet/​comet-server/​blob/​master/​comet.ini|comet.ini]] file, set the details to access the database 
-<​code ​txt+<​code ​ini
-db_host 127.0.0.1 ​# The server address database +[db] 
-db_pw pass        # Password +host = localhost ​  # The server address database 
-db_user comet     # User +user = root        # User 
-db_port 3306      ​Port +password = root    ​Password 
-db_name ​comet_db ​ # database name+name = comet_db ​   # database name 
 +port = 3305        # Port
 </​code>​ </​code>​
 Enter the password to access the comet-server api Enter the password to access the comet-server api
-<​code ​txt+<​code ​ini> 
-password 0000000000000000000000000000000000000000000000000000000000000000  +[main]  ​ 
-</​code> ​+password ​0000000000000000000000000000000000000000000000000000000000000000 
 +</​code>​ 
 +  
 +===== Add to Startup ===== 
 +  
 +<code sh>cp ./​comet.service /​etc/​systemd/​system 
 +systemctl daemon-reload 
 +systemctl enable comet.service</​code>​ 
 + 
 +After successes run server we can begin create chat. If you get error, you should create issue in [[https://​github.com/​Levhav/​comet-server/​issues|github repository]].
  
 ====== Launch ====== ====== Launch ======
 Run in console mode Run in console mode
 <code sh> <code sh>
-./cpp_comet+./cppcomet
 </​code>​ </​code>​
 Running in daemon mode Running in daemon mode
Line 42: Line 56:
 </​code>​ </​code>​
  
-===== Add to Startup ​=====+====== ​Configuring nginx as a reverse proxy ====== 
 + 
 +In order to configure the operation of comets on one machine with a web server, or just have the ability to work not only on http but also on https, you need to configure the reverse proxy. 
 + 
 +The following is an example of the nginx configuration for proxy traffic to comet servers with /​comet-server to the comet server running on port 82 and all other traffic to the web server running on port 8080 
 + 
 +<file text default>​ 
 +server { 
 + listen 0.0.0.0:​80; ​   
 + server_name comet-server.com;​
    
-<code sh>cp ./comet.service ​/etc/systemd/​system + location ​
-systemctl daemon-reload + proxy_pass http://127.0.0.1:​8080;​ 
-systemctl enable comet.service</​code>​+ proxy_set_header Host $host; 
 + proxy_set_header X-Real-IP $remote_addr;​ 
 + proxy_set_header X-Forwarded-For $remote_addr;​ 
 + proxy_connect_timeout 120; 
 + proxy_send_timeout 120; 
 + proxy_read_timeout 180; 
 + }
  
-After successes run server ​we can begin create chatIf you get error create issue in [[https://github.com/Levhav/​comet-server/​issues|github repository]].+ keepalive_disable none; 
 + lingering_close always; 
 + send_timeout 3600s; 
 + 
 + location /comet-server ​
 +        proxy_pass http://127.0.0.1:82; 
 +         
 +        proxy_set_header X-Real-IP $remote_addr;​ 
 +        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;​ 
 +        proxy_set_header Host $http_host;​ 
 +        proxy_set_header X-NginX-Proxy true; 
 +         
 +        proxy_http_version 1.1; 
 +        proxy_set_header Upgrade $http_upgrade;​ 
 +        proxy_set_header Connection "​upgrade";​ 
 +         
 +        proxy_redirect off; 
 +        keepalive_timeout 900; 
 +        proxy_read_timeout 900; 
 + }  
 +
 + 
 +# HTTPS server 
 + 
 + 
 +server { 
 + listen 0.0.0.0:​443; ​  
 + server_name comet-server.com;​ 
 + 
 + ssl on; 
 + ssl_certificate ​/etc/letsencrypt/​live/​comet-server.com/fullchain.pem;​ 
 + ssl_certificate_key /​etc/​letsencrypt/​live/​comet-server.com/privkey.pem;​ 
 +  
 + ssl_session_timeout 70m; 
 + 
 + ssl_protocols SSLv3 TLSv1; 
 + ssl_ciphers ALL:​!ADH:​!EXPORT56:​RC4+RSA:​+HIGH:​+MEDIUM:​+LOW:​+SSLv3:​+EXP;​ 
 + ssl_prefer_server_ciphers on; 
 + 
 + keepalive_disable none; 
 + lingering_close always; 
 + send_timeout 3600s; 
 +  
 + location / { 
 + proxy_pass http://​127.0.0.1:​8080;​ 
 + proxy_set_header Host $host; 
 + proxy_set_header X-Real-IP $remote_addr;​ 
 + proxy_set_header X-Forwarded-For $remote_addr;​ 
 + proxy_connect_timeout 120; 
 + proxy_send_timeout 120; 
 + proxy_read_timeout 180; 
 +  
 +
 +  
 + location /​comet-server { 
 +        proxy_pass http://​127.0.0.1:​82;​ 
 +         
 +        proxy_set_header X-Real-IP $remote_addr;​ 
 +        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;​ 
 +        proxy_set_header Host $http_host;​ 
 +        proxy_set_header X-NginX-Proxy true; 
 +         
 +        proxy_http_version 1.1; 
 +        proxy_set_header Upgrade $http_upgrade;​ 
 +        proxy_set_header Connection "​upgrade";​ 
 +         
 +        proxy_redirect off;  
 +        keepalive_timeout 900; 
 +        proxy_read_timeout 900; 
 +
 +
 +</​file>​ 
 + 
 +====== Possible problems after installation ====== 
 +  
 +Pay attention to what values of the port parameter are specified in the sections [wsand [cometqlon these ports the comet server will wait for incoming connections. 
 + 
 +In the comet.ini example in the repository, the port parameter for connections from JavaScrip api is set to 8087. 
 +This means that you need to connect like this: 
 +<code JavaScript>​cometApi.start({user_id:​1,​ user_key:"​userHash",​ node:"​example.ru:​8087"​})</​code>​ 
 + 
 +The port parameter for connections from CometQL is set to 3300 
 +This means that you need to connect like this: 
 +<code PHP>​$link = mysqli_connect("​example.ru",​ "​root",​ "",​ "​CometQL_v1",​ 3300);</​code>​ 
 + 
 +===== Unreadable file comet.ini ===== 
 + 
 +Some text editors add unprintable simbols to the utf8 file. After that, the file may look the same but the comet server will not parse it correctly. You can try using another editor or delete the old file and create a new one with the same text. 
 + 
 +===== Error while assembling in CentOS ===== 
 + 
 +<​code>​ 
 +CMake Error: The following variables are used in this project, but they are set to NOTFOUND. 
 +Please set them or make sure they are set and tested correctly in the CMake files: 
 +MYSQL_INCLUDE_DIR (ADVANCED) 
 +</​code>​ 
 + 
 +Can not find the client'​s mysql header files. You can try installing the mysql-devel package 
 + 
 +<​code>​ 
 +yum install mysql-devel 
 +</​code>​ 
 + 
 +===== Error while assembling in CentOS ===== 
 + 
 +<​code>​ 
 +/​etc/​comet-server/​comet-server/​src/​mystring.cpp:​15:​51:​ fatal error: uuid / uuid.h: No such file or directory exists 
 + #include <​uuid/​uuid.h>​ 
 +</​code>​ 
 + 
 +Can not find the file uuid.h. You can try installing the libuuid libuuid-devel package 
 + 
 +<​code>​ 
 +yum install libuuid libuuid-devel 
 +</​code>​