Code Monkey home page Code Monkey logo

Comments (3)

Morethanevil avatar Morethanevil commented on May 20, 2024 2

Okay now it is running with systemd. Did not think about systemd :D I needed to modify your scripts and now it runs just fine. For quick testing a "-d" would still be great :)
Please add one of the solutions to the docs.

Here are my steps:

  1. Create start.sh in the zoraxy folder with:

nano start.sh

Put in those lines

#!/bin/bash
./zoraxy -port=:8000
  1. make executable with

chmod +x start.sh

  1. Now create systemd-service with

sudo nano /etc/systemd/system/zoraxy.service

Put in following lines:

[Unit]
Description=Zoraxy Reverse Proxy Server
After=network-online.target #waits for network to be online
Wants=network-online.target

[Service]
Type=simple

User=root   #no sudo required in start.sh
Group=root
WorkingDirectory=/zoraxy/src/    #folder where zoraxy is
ExecStart=/bin/bash /zoraxy/src/start.sh     #absolute path for start.sh

[Install]
WantedBy=multi-user.target
  1. Start and enable autostart with:

sudo systemctl enable --now zoraxy.service

Now status and logs can be displayed with:

sudo systemctl status zoraxy

Logs-files would still be great, but thanks for the help with autostart
A sidenote for LXC-Users: After login as root the working directory is not /zoraxy/src but /root/zoraxy/src
(/root/ is the home of root user) Tested with LXC Ubuntu 22.04

from zoraxy.

TheTaran avatar TheTaran commented on May 20, 2024 1

Thanks for that grate tool! ๐Ÿ‘๐Ÿป

A little fix. :)

Description=Zoraxy Reverse Proxy Server
#waits for network to be online
After=network-online.target
Wants=network-online.target

[Service]
Type=simple

#no sudo required in start.sh
User=root   
Group=root

#folder where zoraxy is
WorkingDirectory=/zoraxy/src/    
#absolute path for start.sh
ExecStart=/bin/bash /zoraxy/src/start.sh     

[Install]
WantedBy=multi-user.target

from zoraxy.

tobychui avatar tobychui commented on May 20, 2024

"-d" argument seems like an interesting idea. However, adding this might bring some issue with Windows compatibility.
For my linux setups, I am using systemd for this purpose. Here is how I did it.

First, you would like to create a start.sh file next to your zoraxy binary. Assuming your binary file is located at /home/user/zoraxy/src/zoraxy

cd /home/user/zoraxy/src/zoraxy
nano start.sh

Put the following lines into start.sh, save and exit

#!/bin/bash
sudo ./zoraxy

Then assign the correct permission to the start script

sudo chmod 775 ./start.sh 

Next, you can add it to systemd service with the following commands

cd /etc/systemd/system/
sudo systemctl enable systemd-networkd.service systemd-networkd-wait-online.service
sudo nano zoraxy.service

In the service file, fill in the following info

[Unit]
Description=Zoraxy Reverse Proxy Server
After=systemd-networkd-wait-online.service
Wants=systemd-networkd-wait-online.service

[Service]
Type=simple
ExecStartPre=/bin/sleep 10
WorkingDirectory=/home/user/zoraxy/src/
ExecStart=/bin/bash /home/user/zoraxy/src/start.sh

Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

Lastly, enable and start the systemd service

sudo systemctl enable zoraxy
sudo systemctl start zoraxy

Then it should be running as a valid daemon which will start following your server (or container) startup. As I am no expert in LXC, I can only provide you answer under normal Linux (Debian) based installation. If you have issues using systemd in your container, I guess you might need to seek help from the developer who provided the container / docker configs.

from zoraxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.