Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bootstrap_gunicorn.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
current_dir = path.dirname(path.abspath(__file__))
TIMEOUT = 120 # In seconds

# Arguments to start gunicorn
args = [
"gunicorn", "-w", "4", "--daemon", "--pid", "gunicorn.pid", "-b", "unix:sampleplatform.sock", "-m", "007",
"-g", "www-data", "-u", "www-data", f"--chdir={current_dir}", "--log-level", "debug", "--timeout", f"{TIMEOUT}",
"gunicorn", "-w", "4", "-b", "unix:sampleplatform.sock", "-m", "007",
"-g", "www-data", "-u", "www-data", f"--chdir={current_dir}", "--log-level", "debug",
"--timeout", f"{TIMEOUT}",
"--access-logfile", f"{current_dir}/logs/access.log", "--capture-output",
"--log-file", f"{current_dir}/logs/error.log", "run:app"
]

subprocess.Popen(args)
subprocess.run(args)
10 changes: 6 additions & 4 deletions install/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,12 @@ chown -R www-data:www-data "${root_dir}" "${sample_repository}"
echo "* Creating startup script"

{
cp "${dir}/platform" /etc/init.d/platform
sed -i "s#BASE_DIR#${root_dir}#g" /etc/init.d/platform
chmod 755 /etc/init.d/platform
update-rc.d platform defaults
rm -f /etc/init.d/platform
update-rc.d platform remove || true
cp "${dir}/platform.service" /etc/systemd/system/platform.service
sed -i "s#/var/www/sample-platform#${root_dir}#g" /etc/systemd/system/platform.service
systemctl daemon-reload
systemctl enable platform.service
} >> "$install_log" 2>&1
echo "* Creating RClone config file"

Expand Down
2 changes: 1 addition & 1 deletion install/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ sudo python3 bootstrap_gunicorn.py
1. Firstly check the Platform Installation log file in the install folder. Check for any errors, which may have been caused during platform installation on your system, and then try to resolve them accordingly.
2. Next check for nginx status by `service nginx status` command, if it is not active, check nginx error log file, possibly in `/var/log/nginx/error.log` file.
3. Next check for platform status by `service platform status` command, if it is not `active(running)` then check for platform logs in the `logs` directory of your project.
4. In case of any gunicorn error try manually running `/etc/init.d/platform start` command and recheck the platform status.
4. In case of any gunicorn error try manually running `sudo systemctl start platform.service` command and recheck the platform status.

### Setting Up The Bucket

Expand Down
27 changes: 0 additions & 27 deletions install/platform

This file was deleted.

19 changes: 19 additions & 0 deletions install/platform.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[Unit]
Description=CCExtractor Sample Platform (gunicorn)
After=network.target mysql.service
Wants=mysql.service

[Service]
Type=simple
User=www-data
Group=www-data
WorkingDirectory=/var/www/sample-platform
ExecStart=/usr/bin/gunicorn -w 4 -b unix:/var/www/sample-platform/sampleplatform.sock -m 007 --timeout 120 --log-level debug --access-logfile /var/www/sample-platform/logs/access.log --capture-output --log-file /var/www/sample-platform/logs/error.log run:app
ExecReload=/bin/kill -s HUP $MAINPID
Restart=on-failure
RestartSec=5
KillMode=control-group
TimeoutStopSec=30

[Install]
WantedBy=multi-user.target
Loading