-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Update installation instructions and scripts for Security Cam …
…service
- Loading branch information
1 parent
ec71d84
commit 29806df
Showing
4 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Installation | ||
1. Clone the Repository | ||
|
||
```bash | ||
sudo git clone https://github.com/infinitel8p/Security-Cam.git /opt/security-cam | ||
``` | ||
|
||
|
||
2. Create the Service File | ||
```bash | ||
sudo nano /etc/systemd/system/security-cam.service | ||
``` | ||
|
||
Add the following to the file: | ||
|
||
```shell | ||
[Unit] | ||
Description=Security Cam Flask and Node.js Servers | ||
After=network.target | ||
[Service] | ||
Type=simple | ||
User=root | ||
WorkingDirectory=/opt/security-cam | ||
ExecStart=/bin/bash -c ' | ||
git pull && | ||
chmod +x /opt/security-cam/install_requirements.sh && | ||
cd /opt/security-cam/server && npm install && | ||
cd /opt/security-cam/client && | ||
bash /opt/security-cam/install_requirements.sh && | ||
chmod +x /opt/security-cam/start.sh && | ||
/opt/security-cam/start.sh | ||
' | ||
Restart=on-failure | ||
[Install] | ||
WantedBy=multi-user.target | ||
``` | ||
|
||
3. Reload the systemd manager configuration: `sudo systemctl daemon-reload` | ||
|
||
4. Enable the service to start on boot: `sudo systemctl enable security-cam.service` | ||
|
||
5. Start the service: `sudo systemctl start security-cam.service` | ||
|
||
6. Check the status of the service: `sudo systemctl status security-cam.service` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
# Update package list | ||
sudo apt-get update | ||
|
||
# Install system dependencies | ||
sudo apt-get install -y python3 python3-pip nodejs npm | ||
|
||
# Path to the requirements.txt file | ||
REQUIREMENTS_FILE="/opt/security-cam/requirements.txt" | ||
|
||
# Loop through each line in requirements.txt | ||
while IFS= read -r package | ||
do | ||
# Extract the package name before any version specifier (e.g., flask==2.0 -> flask) | ||
package_name=$(echo "$package" | cut -d '=' -f 1) | ||
|
||
# Install the package using apt-get if available, otherwise fallback to pip | ||
if apt-cache search --names-only "^python3-$package_name$" | grep -q "^python3-$package_name"; then | ||
sudo apt-get install -y python3-$package_name | ||
else | ||
sudo pip3 install "$package" --break-system-packages | ||
fi | ||
done < "$REQUIREMENTS_FILE" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
# Start the Node.js server | ||
cd /opt/security-cam/server || exit | ||
npm run dev & | ||
|
||
# Start the Flask server | ||
cd /opt/security-cam/client || exit | ||
python3 main.py & |