Links is a component written for alarm merging function. If you don't want to use alarm merging function, there is no need to install this component.

Source code installation

Links is a Python project, and there is no need to compile like a project of Go. However, a Go project is statically compiled. There is no binary dependency after compiling, so it can run in other devices, while some dependency libraries are needed for a Python project.

# We use virtualenv to manage Python environment, and it is necessary to switch to the root account to install yum

# yum install -y python-virtualenv

$ cd /path/to/links/
$ virtualenv ./env

$ ./env/bin/pip install -r pip_requirements.txt

After installing the dependent libraries, we can use the control script to start it, and logs will be located at the var directory. But it is necessary to modify the configuration file into the corresponding configuration before starting. Besides, the monitoring port should be configured in gunicorn.conf.

Deployment instruction

Links is a stateless web project, which can be scaled horizontally, and need at least two computers to ensure the availability. Set up a nginx or lvs loading equipment in the front and apply for a domain name, that's all!

Configuration instruction

The configuration files of Links are located at frame/

# Modify the database configuration, and database schema files are located at the Scripts directory.
DB_HOST = ""
DB_PORT = 3306
DB_USER = "root"
DB_PASS = ""
DB_NAME = "falcon_links"

# SECRET_KEY    Set a complicated random character string串
SECRET_KEY = "4e.5tyg8-u9ioj"
SESSION_COOKIE_NAME = "falcon-links"

# We can copy, and use the configuration in to overwrite the configuration in
#If this is inconvenient, you can just maintain the default configuration, and there is no need to make
    from frame.local_config import *
except Exception, e:
    print "[warning] %s" % e

Process management

We provide a control script to complete normal actions.

./control start    Start a process
./control stop    Stop a process
./control restart    Restart a process
./control status    View the process state
./control tail    Use the method of "tail -f" to view var/app.log


Check whether the log located in the var directory is normal after start.

Then use the browser to visit it, if the home page appears 404, it is normal. The alarm module will use links.

Or we can verify as follows:

curl -d"abc"

The above command will return a random character string, then we can add the string at the end of the links address to visit the new address through a browser. For example, if the returned random character string is dot9kg8b, then use the browser to visit:

Copyright 2015 - 2018 Xiaomi Inc. all right reserved,powered by Gitbook该文件修订时间: 2018-11-20 15:12:29