<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://www.logicwiki.co.uk/index.php?action=history&amp;feed=atom&amp;title=Using_bun_on_server</id>
		<title>Using bun on server - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://www.logicwiki.co.uk/index.php?action=history&amp;feed=atom&amp;title=Using_bun_on_server"/>
		<link rel="alternate" type="text/html" href="https://www.logicwiki.co.uk/index.php?title=Using_bun_on_server&amp;action=history"/>
		<updated>2026-06-15T13:48:42Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.2</generator>

	<entry>
		<id>https://www.logicwiki.co.uk/index.php?title=Using_bun_on_server&amp;diff=2522&amp;oldid=prev</id>
		<title>AliIybar at 10:45, 19 December 2025</title>
		<link rel="alternate" type="text/html" href="https://www.logicwiki.co.uk/index.php?title=Using_bun_on_server&amp;diff=2522&amp;oldid=prev"/>
				<updated>2025-12-19T10:45:52Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 10:45, 19 December 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l94&quot; &gt;Line 94:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 94:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sudo chown -R logicmade:logicmade /home/logicmade/bookitfor.me.uk&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sudo chown -R logicmade:logicmade /home/logicmade/bookitfor.me.uk&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; chmod -R 755 /home/logicmade/bookitfor.me.uk&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; chmod -R 755 /home/logicmade/bookitfor.me.uk&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;------------------------&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;See Also [[Bash script which uses sudo]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>AliIybar</name></author>	</entry>

	<entry>
		<id>https://www.logicwiki.co.uk/index.php?title=Using_bun_on_server&amp;diff=2520&amp;oldid=prev</id>
		<title>AliIybar at 09:35, 18 December 2025</title>
		<link rel="alternate" type="text/html" href="https://www.logicwiki.co.uk/index.php?title=Using_bun_on_server&amp;diff=2520&amp;oldid=prev"/>
				<updated>2025-12-18T09:35:21Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 09:35, 18 December 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l84&quot; &gt;Line 84:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 84:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sudo apt update&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sudo apt update&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sudo apt install certbot python3-certbot-nginx -y&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sudo apt install certbot python3-certbot-nginx -y&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=== Issue SSL Certificate ===&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; sudo certbot --nginx -d api.bookitfor.me.uk&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=== Auto-Renew SSL (Important) ===&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Certbot installs a timer automatically. Verify:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; sudo systemctl status certbot.timer&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Test renewal:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; sudo certbot renew --dry-run&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== Final Folder Permissions (Recommended) ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; sudo chown -R logicmade:logicmade /home/logicmade/bookitfor.me.uk&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; chmod -R 755 /home/logicmade/bookitfor.me.uk&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>AliIybar</name></author>	</entry>

	<entry>
		<id>https://www.logicwiki.co.uk/index.php?title=Using_bun_on_server&amp;diff=2519&amp;oldid=prev</id>
		<title>AliIybar: Created page with &quot;Category:Bun Category:Linux Category:Server Category:pm2  == Installation == Install unzip if it's not installed already  sudo apt install unzip Install bun...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.logicwiki.co.uk/index.php?title=Using_bun_on_server&amp;diff=2519&amp;oldid=prev"/>
				<updated>2025-12-17T13:05:19Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&lt;a href=&quot;/index.php?title=Category:Bun&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Category:Bun (page does not exist)&quot;&gt;Category:Bun&lt;/a&gt; &lt;a href=&quot;/index.php?title=Category:Linux&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Category:Linux (page does not exist)&quot;&gt;Category:Linux&lt;/a&gt; &lt;a href=&quot;/index.php?title=Category:Server&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Category:Server (page does not exist)&quot;&gt;Category:Server&lt;/a&gt; &lt;a href=&quot;/index.php?title=Category:Pm2&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Category:Pm2 (page does not exist)&quot;&gt;Category:pm2&lt;/a&gt;  == Installation == Install unzip if it&amp;#039;s not installed already  sudo apt install unzip Install bun...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:Bun]]&lt;br /&gt;
[[Category:Linux]]&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:pm2]]&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Install unzip if it's not installed already&lt;br /&gt;
 sudo apt install unzip&lt;br /&gt;
Install bun &lt;br /&gt;
 curl -fsSL https://bun.com/install | bash&lt;br /&gt;
Add Bun to your PATH (it may already been added. just run (source ~/.bashrc) first&lt;br /&gt;
  echo $SHELL&lt;br /&gt;
it gives us what type of shell we use and open your shell configuration file with an editor&lt;br /&gt;
&lt;br /&gt;
* For bash: ~/.bashrc&lt;br /&gt;
* For zsh: ~/.zshrc&lt;br /&gt;
* For fish: ~/.config/fish/config.fish&lt;br /&gt;
&lt;br /&gt;
Add the Bun directory to PATH&lt;br /&gt;
&lt;br /&gt;
Add this line to your configuration file:&lt;br /&gt;
 export BUN_INSTALL=&amp;quot;$HOME/.bun&amp;quot;&lt;br /&gt;
 export PATH=&amp;quot;$BUN_INSTALL/bin:$PATH&amp;quot;&lt;br /&gt;
run based on your shell&lt;br /&gt;
 source ~/.bashrc&lt;br /&gt;
&lt;br /&gt;
== Test it Manually ==&lt;br /&gt;
In CI/CD I create and encrypt .env file by using  &lt;br /&gt;
 bunx dotenvx encrypt&lt;br /&gt;
I placed .env and .env.keys under a project folder and save '''index.js''' in '''dist''' folder. &lt;br /&gt;
&lt;br /&gt;
In the project folder run the application by &lt;br /&gt;
  bun dist/index.js&lt;br /&gt;
== Run the API as a Background Service (PM2 – Recommended) ==&lt;br /&gt;
Install / upgrade pm2 by running &lt;br /&gt;
 npm install -g pm2&lt;br /&gt;
Start your Bun API&lt;br /&gt;
 pm2 start &amp;quot;bun dist/index.js&amp;quot; --name logic_logger_api&lt;br /&gt;
Save PM2 startup config&lt;br /&gt;
 pm2 save&lt;br /&gt;
 pm2 startup&lt;br /&gt;
IMPORTANT : READ THE MESSAGES IT MAY ASK YOU TO SETUP START UP SCRIPT LIKE &lt;br /&gt;
 sudo env PATH=$PATH:/home/logicmade/.nvm/versions/node/v22.15.0/bin /home/logicmade/.nvm/versions/node/v22.15.0/lib/node_modules/pm2/bin/pm2 startup systemd -u logicmade --hp /home/logicmade&lt;br /&gt;
== Check status ==&lt;br /&gt;
 pm2 status&lt;br /&gt;
 pm2 logs logic_logger_api&lt;br /&gt;
== Confirm API Is Listening Locally ==&lt;br /&gt;
 curl http://localhost:3020/test&lt;br /&gt;
== Create NGINX Server Block ==&lt;br /&gt;
Create config file&lt;br /&gt;
 sudo nano /etc/nginx/sites-available/logic_logger&lt;br /&gt;
Paste &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
    listen 80;&lt;br /&gt;
    server_name api.bookitfor.me.uk;&lt;br /&gt;
&lt;br /&gt;
    location / {&lt;br /&gt;
        proxy_pass http://localhost:3000;&lt;br /&gt;
        proxy_http_version 1.1;&lt;br /&gt;
&lt;br /&gt;
        proxy_set_header Upgrade $http_upgrade;&lt;br /&gt;
        proxy_set_header Connection 'upgrade';&lt;br /&gt;
        proxy_set_header Host $host;&lt;br /&gt;
&lt;br /&gt;
        proxy_set_header X-Real-IP $remote_addr;&lt;br /&gt;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;&lt;br /&gt;
        proxy_set_header X-Forwarded-Proto $scheme;&lt;br /&gt;
&lt;br /&gt;
        proxy_cache_bypass $http_upgrade;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
== Enable the Site ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo ln -s /etc/nginx/sites-available/logic_logger /etc/nginx/sites-enabled/&lt;br /&gt;
sudo nginx -t&lt;br /&gt;
sudo systemctl reload nginx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Open Firewall (If Enabled) ==&lt;br /&gt;
 sudo ufw allow 'Nginx Full'&lt;br /&gt;
 sudo ufw reload&lt;br /&gt;
== Install HTTPS (Let’s Encrypt) ==&lt;br /&gt;
=== Install Certbot ===&lt;br /&gt;
 sudo apt update&lt;br /&gt;
 sudo apt install certbot python3-certbot-nginx -y&lt;/div&gt;</summary>
		<author><name>AliIybar</name></author>	</entry>

	</feed>