home-router / xray

Ansible role to deploy Xray.
GNU General Public License v3.0
5 stars 3 forks source link

xray.service daemon does not start #1

Open vldanch opened 1 year ago

vldanch commented 1 year ago

I would like a more detailed description of the work of this ansible role.

Good afternoon, I cloned your role and am trying to implement it on my infrastructure due to the fact that users all over Russia complain about a massive failure in the OpenVPN and WireGuard VPN protocols, I am looking for an alternative and trying to understand how to solve this problem, I am studying how your ansible works role.

Errors occur during deployment when starting the daemon: How can i solve this daemon problem?

root@xray01-server:~# systemctl status xray.service
× xray.service - Xray Service
     Loaded: loaded (/etc/systemd/system/xray.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Thu 2023-08-24 08:47:37 UTC; 2min 54s ago
       Docs: https://github.com/xtls
    Process: 1773 ExecStart=/usr/local/bin/xray run -config /usr/local/etc/xray/config.json (code=exited, status=23)
   Main PID: 1773 (code=exited, status=23)
        CPU: 17ms

Aug 24 08:47:37 xray01-server systemd[1]: Started Xray Service.
Aug 24 08:47:37 xray01-server systemd[1]: xray.service: Main process exited, code=exited, status=23/n/a
Aug 24 08:47:37 xray01-server systemd[1]: xray.service: Failed with result 'exit-code'.
Aug 24 08:47:37 xray01-server xray[1773]: Xray 1.8.3 (Xray, Penetrates Everything.) Custom (go1.20.5 linux/amd64)
Aug 24 08:47:37 xray01-server xray[1773]: A unified platform for anti-censorship.
Aug 24 08:47:37 xray01-server xray[1773]: Failed to start: main: failed to load config files: [/usr/local/etc/xray/config.json] > infra/conf/serial: failed to decode config: /usr/local/etc/xray/config.json > infra/conf/serial: failed to read config file at line 38 char 5 > invalid character ']' after object key:value pair

inventory:

[xray_server:children]
xray-servers

[xray-servers]
xray01-server ansible_host=local_vm_address ansible_port=22

playbook:

---
# playbook for installation xray roles

- name: Run install xray server roles
  hosts: xray_server
  remote_user: user
  become: True
  gather_facts: True

  roles:
    - role: roles/ansible-role-xray
      vars:
        xray_version: v1.8.3
        xray_local_address: local_vm_address
      tags: xray
cyfdecyf commented 1 year ago

Just updated this role to use version v1.7.5 which is the latest stable version.

The error message shows there are syntax error in config file. I suggest copy main/default.yaml to group_vars directory because you need to make lot's of changes according to your settings.

xray-core's config is not trivial. It takes some time to understand but will worth your effort. It works quite well and provides complete solution for what I need. Please consult the official document while changing the settings in main/default.yaml.

I can provide some help, but my reply maybe slow.

vldanch commented 1 year ago

@cyfdecyf I got a stable working version v1.7.5, the playbook worked fine, now there is an error related to UUID I understand it needs to be generated?

root@xray01-server:~# systemctl status xray.service
× xray.service - Xray Service
     Loaded: loaded (/etc/systemd/system/xray.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Thu 2023-08-31 11:50:43 MSK; 3min 33s ago
       Docs: https://github.com/xtls
    Process: 2218 ExecStart=/usr/local/bin/xray run -config /usr/local/etc/xray/config.json (code=exited, status=23)
   Main PID: 2218 (code=exited, status=23)
        CPU: 643ms

Aug 31 11:50:42 xray01-server systemd[1]: Started Xray Service.
Aug 31 11:50:42 xray01-server xray[2218]: Xray 1.7.5 (Xray, Penetrates Everything.) Custom (go1.20 linux/amd64)
Aug 31 11:50:42 xray01-server xray[2218]: A unified platform for anti-censorship.
Aug 31 11:50:42 xray01-server xray[2218]: 2023/08/31 11:50:42 [Info] infra/conf/serial: Reading config: /usr/local/etc/xray/config.js>
Aug 31 11:50:43 xray01-server xray[2218]: Failed to start: main: failed to load config files: [/usr/local/etc/xray/config.json] > invalid UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx
Aug 31 11:50:43 xray01-server systemd[1]: xray.service: Main process exited, code=exited, status=23/n/a
Aug 31 11:50:43 xray01-server systemd[1]: xray.service: Failed with result 'exit-code'.
cyfdecyf commented 1 year ago

Yes, uuid should be generated. Using an online version 4 uuid generator is fine.

To ease debugging configuration errros, cd to /usr/local/etc/xray and then run xray. It will read config.json under the current directory by defau.t