Skip to content

Commit

Permalink
changes made #2737
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajveerchoubisa committed Dec 10, 2024
1 parent 354b373 commit fdb6199
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
32 changes: 24 additions & 8 deletions examples/linux/systemd/systemd-talawa-api.service
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,44 @@
Description=Talawa API Service
After=network.target

Documentation=https://github.com/talawa-api/
After=postgresql.service redis.service
Requires=postgresql.service
Wants=redis.service

[Service]
User=talawa
Group=talawa

Environment=CODEROOT=/home/talawa/talawa-api
Environment=TALAWA_API_CONFIGDIR=/etc/talawa
Environment=VIRTUAL_ENV=$CODEROOT/venv/bin
Environment=PATH=$VIRTUAL_ENV:$PATH
Environment=START=--start "STOP=--stop --force" "RESTART=--restart --force"
EnvironmentFile=/etc/examples/linux/systemd/talawa-api.env

# Command to start Talawa API
ExecStart=/bin/bash -c '${VIRTUAL_ENV}/python3 ${CODEROOT}/main.py $START'

# Command to stop Talawa API
ExecStop=/bin/bash -c '${VIRTUAL_ENV}/python3 ${CODEROOT}/main.py $STOP'

# Command to restart Talawa API
ExecReload=/bin/bash -c '${VIRTUAL_ENV}/python3 ${CODEROOT}/main.py $RESTART'
ExecStart=${VIRTUAL_ENV}/python3 ${CODEROOT}/main.py ${START}
ExecStop=${VIRTUAL_ENV}/python3 ${CODEROOT}/main.py ${STOP}
ExecReload=${VIRTUAL_ENV}/python3 ${CODEROOT}/main.py ${RESTART}

RemainAfterExit=yes
GuessMainPID=yes
Type=forking
RuntimeDirectory=talawa

# Restart policy
Restart=always
RestartSec=3

# Security settings
NoNewPrivileges=yes
PrivateTmp=yes
ProtectSystem=full
ProtectHome=read-only

# Resource limits
LimitNOFILE=65535
LimitNPROC=4096

[Install]
WantedBy=multi-user.target
7 changes: 7 additions & 0 deletions examples/linux/systemd/talawa-api.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CODEROOT=/home/talawa/talawa-api
TALAWA_API_CONFIGDIR=/etc/talawa
VIRTUAL_ENV=${CODEROOT}/venv/bin
PATH=${VIRTUAL_ENV}:${PATH}
START=--start
STOP=--stop --force
RESTART=--restart --force

0 comments on commit fdb6199

Please sign in to comment.