Skip to content

Commit c13de1f

Browse files
committed
doc: systemd service file
1 parent 54659ea commit c13de1f

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,87 @@ pip install uwsgi gevent
8181

8282
### Systemd service file for running taipy
8383

84+
For easily managing the start/stop of the taipy server, we define a service
85+
file. We actually define two service files `taxplorer.uwsgi.service` for the
86+
production site and `taxplorer-dev.uwsgi.service` for the development website.
8487

88+
**File /etc/systemd/system/taxplorer.uwsgi.service**
89+
90+
```
91+
[Unit]
92+
Description=D4G Taxplorer website for CbCR visualization
93+
After=syslog.target
94+
95+
[Service]
96+
ExecStart=/opt/d4g/12_taxobservatory_dataviz/.venv/bin/uwsgi --http 127.0.0.1:5000 --gevent 1000 --http-websockets --module app.main:web_app --logto /opt/d4g/12_taxobservatory_dataviz/taxplorer.log
97+
WorkingDirectory=/opt/d4g/12_taxobservatory_dataviz/
98+
Restart=always
99+
KillSignal=SIGQUIT
100+
Type=notify
101+
StandardError=syslog
102+
NotifyAccess=all
103+
User=d4gtaxobs
104+
105+
[Install]
106+
WantedBy=multi-user.target
107+
```
108+
109+
**File /etc/systemd/system/taxplorer-dev.uwsgi.service**
110+
111+
```
112+
[Unit]
113+
Description=D4G Taxplorer website for CbCR visualization
114+
After=syslog.target
115+
116+
[Service]
117+
ExecStart=/opt/d4g/12_taxobservatory_dataviz_dev/.venv/bin/uwsgi --http 127.0.0.1:5001 --gevent 1000 --http-websockets --module app.main:web_app --logto /opt/d4g/12_taxobservatory_dataviz/taxplorer.log
118+
WorkingDirectory=/opt/d4g/12_taxobservatory_dataviz_dev/
119+
Restart=always
120+
KillSignal=SIGQUIT
121+
Type=notify
122+
StandardError=syslog
123+
NotifyAccess=all
124+
User=d4gtaxobs
125+
126+
[Install]
127+
WantedBy=multi-user.target
128+
```
129+
130+
Once these service files are defined, we enable and start them :
131+
132+
```
133+
sudo systemctl enable taxplorer.uwsgi.service
134+
sudo service taxplorer.uwsgi start
135+
136+
sudo systemctl enable taxplorer-dev.uwsgi.service
137+
sudo service taxplorer-dev.uwsgi start
138+
```
139+
140+
Now, you should have your servers up and running. To ensure this is the case,
141+
you must be able to contact the machine with your browser at
142+
`http://localhost:5000` and `http://localhost:5001`. The `localhost` here refers
143+
to the server name. To access it from a remote machine, you can add a ssh tunnel
144+
before connecting with your browser :
145+
146+
```
147+
ssh -L 5000:localhost:5000 YOUR_LOGIN@THE_IP_OF_THE_MACHINE
148+
```
149+
150+
If accessing the taipy server from your browser fails, you have an issue. To
151+
debug the issue, you can:
152+
- check the logs of the service : `sudo service taxplorer.uwsgi status` and in
153+
the log file `tail /opt/d4g/12_taxobservatory_dataviz/taxplorer.log`
154+
- stop the service and run the `uwsgi` command manually :
155+
156+
```
157+
# For debugging issues
158+
sudo service taxplorer.uwsgi stop
159+
cd /opt/d4g/12_taxobservatory_dataviz/
160+
/opt/d4g/12_taxobservatory_dataviz/.venv/bin/uwsgi --http 127.0.0.1:5000 --gevent 1000 --http-websockets --module app.main:web_app --logto /opt/d4g/12_taxobservatory_dataviz/taxplorer.log
161+
162+
```
163+
164+
And pay particular attention to python errors.
85165

86166
### Nginx setup
87167

0 commit comments

Comments
 (0)