First commit

This commit is contained in:
Nik Afiq 2025-03-10 17:09:50 +09:00
commit 942ec2a062
3 changed files with 77 additions and 0 deletions

View File

@ -0,0 +1,40 @@
# Create git server from scratch
## Create bare git on server
1. Install git on server
```bash
sudo apt update
sudo apt install git
```
2. Create directory for git
```bash
mkdir <directory_name>
cd <directory_name>
```
3. Initialize bare repository
```bash
git init --bare <project>.git
```
4. Set permission (optional)
```bash
chown -R <user>:<group> ~/<directory_name>/<project>.git
```
## Push code from your computer
1. Go to local repository
```bash
cd <repository>
```
2. Add remote repository
```bash
git remote add origin <server_credential>/~/<directory_name>/<project>.git
```
3. Push code as main
```bash
git push -u origin main
```

32
memo/systemctl-enable.md Normal file
View File

@ -0,0 +1,32 @@
# Create a Systemd Service File
1. Create a Service File:
- Create a new service file to manage page_host.py:
```bash
sudo nano /etc/systemd/system/page_host.service
```
2. Add the following configuration to manage the script:
```bash
[Unit]
Description=Python page_host Service
After=network.target
[Service]
WorkingDirectory=/home/git/deployed-repo # Directory containing page_host.py
ExecStart=/usr/bin/python3 /home/git/deployed-repo/page_host.py
Restart=always
[Install]
WantedBy=multi-user.target
```
3. Enable the service to start at boot:
```bash
sudo systemctl enable page_host
```
Start the service:
```bash
sudo systemctl start page_host
```

5
memo/venv-memo.md Normal file
View File

@ -0,0 +1,5 @@
```bash
python -m venv <env-name>
source <env-name>/bin/activate
deactivate
```