Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eb3a1c4

Browse filesBrowse files
committed
feature(deployment) update deploy article
1 parent 51e9d02 commit eb3a1c4
Copy full SHA for eb3a1c4

File tree

Expand file treeCollapse file tree

1 file changed

+105
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+105
-1
lines changed

‎content/tutorials/deploy-nuxt3-github-actions.md

Copy file name to clipboardExpand all lines: content/tutorials/deploy-nuxt3-github-actions.md
+105-1Lines changed: 105 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,112 @@ Automating deployments is pretty much standard these days. Manually typing in de
1414

1515
One option is GitHub Actions. If your project is open source, like **fullstackjack.dev**, it's also cost free.
1616

17-
## Bird's Eye View
17+
## Prerequisites
18+
19+
1. A linux server
20+
2. Ability to login via SSH
21+
3. Install Node LTS
22+
4. Install Nginx
23+
24+
## Server Setup
25+
We'll need to set up a service that can start and stop our Nuxt3 App. We use systemd to do this, because it will
26+
automatically restart the app if it goes down.
27+
28+
```
29+
[Unit]
30+
Description=fullstackjack service
31+
Documentation=https://fullstackjack.dev
32+
After=network.target
33+
34+
35+
[Service]
36+
Restart=always
37+
RestartSec=10
38+
TimeoutSec=300
39+
WorkingDirectory=/var/www/html/live
40+
ExecStart=/usr/bin/bash -c 'node .output/server/index.mjs'
41+
42+
[Install]
43+
WantedBy=multi-user.target
44+
45+
# /etc/systemd/system/fullstackjack.service
46+
```
47+
Create a service in the **/etc/systemd/system directory**. Name it whatever you like, but be consistent in the rest of your
48+
setup. I'll spare you the details for every little part of the service.
49+
50+
The interesting parts are:
51+
**ExecStart=/usr/bin/bash -c 'node .output/server/index.mjs'** which starts our Nuxt3 App.
52+
53+
**Restart=always** ensure systemd will restart the app if it goes down.
54+
55+
Then run **systemctl enable fullstackjack** (keep in mind if you to replace fullstackjack with whatever you named your service)
56+
57+
I'll give you my nginx set up as I have it. But the details are out of the scope of this tutorial.
58+
59+
```
60+
map $sent_http_content_type $expires {
61+
"text/html" epoch;
62+
"text/html; charset=utf-8" epoch;
63+
default off;
64+
}
65+
66+
server {
67+
68+
listen 80;
69+
70+
server_name fullstackjack.dev; # setup your domain here
1871
72+
ssl_certificate /etc/letsencrypt/live/fullstackjack.dev/fullchain.pem;
73+
ssl_certificate_key /etc/letsencrypt/live/fullstackjack.dev/privkey.pem;
74+
75+
76+
gzip on;
77+
gzip_types text/plain application/xml text/css application/javascript;
78+
gzip_min_length 1000;
79+
80+
location / {
81+
expires $expires;
82+
83+
proxy_redirect off;
84+
proxy_set_header Host $host;
85+
proxy_set_header X-Real-IP $remote_addr;
86+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
87+
proxy_set_header X-Forwarded-Proto $scheme;
88+
proxy_read_timeout 1m;
89+
proxy_connect_timeout 1m;
90+
proxy_pass http://127.0.0.1:3000; # set the address of the Node.js instance here
91+
}
92+
93+
listen 443 ssl; # managed by Certbot
94+
ssl_certificate /etc/letsencrypt/live/fullstackjack.dev/fullchain.pem; # managed by Certbot
95+
ssl_certificate_key /etc/letsencrypt/live/fullstackjack.dev/privkey.pem; # managed by Certbot
96+
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
97+
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
98+
99+
}
100+
101+
102+
server {
103+
if ($host = fullstackjack.dev) {
104+
return 301 https://$host$request_uri;
105+
} # managed by Certbot
106+
107+
108+
listen 80;
109+
server_name fullstackjack.dev;
110+
return 404; # managed by Certbot
111+
112+
113+
}
114+
115+
```
116+
117+
If you want SSL, which you most likely will, you can use [certbot]https://certbot.eff.org/instructions?ws=nginx&os=ubuntufocal) for free.
118+
119+
Note: you can do all of this tutorial without setting up SSL.
120+
121+
122+
## Bird's Eye View
19123

20124
![photo of github jobs flow diagram](https://fullstackjack.dev/img/deployment-jobs-overview.png "https://github.com/jurassicjs/nuxt3-fullstack-tutorial/actions")
21125

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.