From 942ec2a062d1545139ec512c4d141af1210addae Mon Sep 17 00:00:00 2001 From: Nik Afiq Date: Mon, 10 Mar 2025 17:09:50 +0900 Subject: [PATCH] First commit --- memo/setting-up-git-server.md | 40 +++++++++++++++++++++++++++++++++++ memo/systemctl-enable.md | 32 ++++++++++++++++++++++++++++ memo/venv-memo.md | 5 +++++ 3 files changed, 77 insertions(+) create mode 100644 memo/setting-up-git-server.md create mode 100644 memo/systemctl-enable.md create mode 100644 memo/venv-memo.md diff --git a/memo/setting-up-git-server.md b/memo/setting-up-git-server.md new file mode 100644 index 0000000..d3fe8ba --- /dev/null +++ b/memo/setting-up-git-server.md @@ -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 + cd + ``` + +3. Initialize bare repository +```bash +git init --bare .git +``` + +4. Set permission (optional) + ```bash + chown -R : ~//.git + ``` + +## Push code from your computer +1. Go to local repository +```bash +cd +``` + +2. Add remote repository +```bash +git remote add origin /~//.git +``` + +3. Push code as main +```bash +git push -u origin main +``` \ No newline at end of file diff --git a/memo/systemctl-enable.md b/memo/systemctl-enable.md new file mode 100644 index 0000000..5bfe06b --- /dev/null +++ b/memo/systemctl-enable.md @@ -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 +``` + diff --git a/memo/venv-memo.md b/memo/venv-memo.md new file mode 100644 index 0000000..0b28cef --- /dev/null +++ b/memo/venv-memo.md @@ -0,0 +1,5 @@ +```bash +python -m venv +source /bin/activate +deactivate +``` \ No newline at end of file