-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstallation.qmd
More file actions
916 lines (628 loc) · 25 KB
/
installation.qmd
File metadata and controls
916 lines (628 loc) · 25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
# Installation Guide
STAPLE is available as a hosted service at https://app.staplescience.com, which is the simplest way to get started. You can also go to https://app.staplescience.com if your internet provider blocks `.science` addresses.
This guide is for individuals or organizations who would like to host their own instance of STAPLE. Running your own version gives you full control over your data, configuration, and integration with your existing infrastructure.
## Assumptions
This guide assumes you meet the following prerequisites:
- You are working on a Linux server. We use Ubuntu 20.04 in this guide, but the steps should be consistent for most Linux distributions.
- You have shell/terminal access to the server.
- You have worked with the command line before.
- You have `sudo` privileges to install packages and manage services.
- You understand what hidden files are (and how to view them).
- You have a basic understanding of SQL and databases (familiarity with PostgreSQL is not required).
- You know what Apache and/or Nginx servers are and how to edit their configuration files.
- You can imagine yourself using git (even if you’re new to it).
## Local Development or Hosting
You can also run STAPLE locally on your own computer, with a few limitations.
- If you are using a Linux system, you can follow the same instructions described in this guide from Blitz/JS Installation through Starting the App – Production.
- On Windows, you can run STAPLE as well, but you’ll need to use a shell environment (such as PowerShell, Git Bash, or WSL2) to follow the same command-line instructions.
- On macOS, the setup is nearly identical to Linux, and you can use the standard Terminal application to run the commands.
When running locally, you will be the only user able to enter data. The application is not hosted on the web, so others will not be able to connect.
Despite this limitation, you will still have access to the full functionality of project management and metadata entry/output. This makes local installation useful for:
- Testing the system before deploying to a server
- Exploring functionality on your own
- Managing personal projects without a shared server
## Installation Steps
### Web Server Installation
STAPLE requires a web server to handle requests. You can choose between **Apache** or **Nginx**:
- **Apache** – [Installation Instructions](https://ubuntu.com/tutorials/install-and-configure-apache)
- **Nginx** – [Installation Instructions](https://ubuntu.com/tutorials/install-and-configure-nginx)
> ⚠️ Important: Only install one. Apache and Nginx don’t play nicely together if they’re both running on the same server.
We recommend using **Nginx**, and our production server is configured with Nginx. This step is only required for people who want to host the software online. You do not need it for local development or use.
### Blitz/JS Installation
STAPLE is built with **Blitz.js**, which runs on Node.js. To install the required tools:
- Install Node.js and npm
- Follow the official installation instructions: [Node.js Downloads](https://nodejs.org/en/download)
- Required versions:
- **Node.js**: v18+
- **npm**: v9+
- Verify installation with:
```
node -v
npm -v
```
- (Optional) Yarn: You may use Yarn if you prefer, but this guide assumes **npm**.
- Install Blitz.js
- Run:
```
npm install -g blitz
```
- Verify installation (version **v2+** required):
```
blitz -v
```
> ℹ️ Note: Depending on your server setup, you may need to prepend commands with `sudo`.
### Clone the Repository
Next, you’ll need to copy the STAPLE source code onto your server.
- Install Git (if not already installed):
```
sudo apt-get update
sudo apt-get install git
```
- Navigate to your web directory (commonly `/var/www/html/` or `/var/www/`):
- *Note*: you can use any folder on your computer if you are not hosting the software online or want to do local development.
```
cd /var/www/html/
```
- Clone the repository:
- Follow the [GitHub guide](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) on cloning repositories.
- Or simply run:
```
git clone https://github.com/STAPLE-verse/STAPLE.git
```
- This will create a new folder named STAPLE containing all the files you need.
- Move into the project folder:
```
cd STAPLE
```
### Database Installation
STAPLE requires a PostgreSQL database.
- Install PostgreSQL
- Ensure that you have a local PostgreSQL service running.
- Follow this guide for installation: [Postgres Setup Instructions](https://www.prisma.io/dataguide/postgresql/setting-up-a-local-postgresql-database).
- During installation:
- Write down the superuser credentials (important on non-Linux systems).
- Other databases may work, but you would need to modify the STAPLE codebase to support them.
- Create Databases
- Open a terminal and run:
```
# Switch into PostgreSQL as the postgres superuser
sudo -u postgres psql
# Create databases for STAPLE
CREATE DATABASE staple;
CREATE DATABASE staple_test;
```
- Create a User
- It’s best not to use the default postgres user for STAPLE. Instead, create a new user:
- Replace username and password with your desired values (keep the quotes).
```
CREATE USER username WITH PASSWORD 'password';
ALTER ROLE username CREATEDB;
```
- Check Databases
- Inside the PostgreSQL prompt, you can verify:
```
\l -- lists databases
\c staple -- connect to the STAPLE database
\dn -- lists schemas
```
- You should see something like the following using those commands:
```
postgres=# \c staple
You are now connected to database "staple" as user "postgres".
staple=#
```
```
staple=# \dn
List of schemas
Name | Owner
--------+--------
public | staple
(1 row)
staple=#
```
```
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-------------+----------+----------+-------------+-------------+---------------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
staple | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres +
| | | | | postgres=CTc/postgres +
| | | | | staple=CTc/postgres +
| | | | | staple_admin=CTc/postgres
staple_test | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(5 rows)
```
- Grant Privileges
- Finally, grant permissions for your new user to manage the staple schema:
```
GRANT ALL ON SCHEMA public TO username;
```
- Exit PostgreSQL using `\q`
### Connect Database to STAPLE App
- Now we’ll connect the PostgreSQL database you created to the STAPLE application.
- Navigate to your STAPLE project folder
```
cd /var/www/html/STAPLE
ls -al
```
- You should see a file named `.env` along with other project files.
- You may need to enable hidden files to see .env files.
- Example:
```
erin@staple:/var/www/html/STAPLE$ ls -al
total 764
drwxr-xr-x 13 root root 4096 Oct 24 06:17 .
drwxr-xr-x 6 root root 4096 Oct 24 05:02 ..
drwxr-xr-x 3 root root 4096 Oct 24 04:27 db
-rw-r--r-- 1 root root 175 Oct 24 04:27 .editorconfig
-rw-r--r-- 1 root root 494 Oct 24 06:17 .env
```
- Create a local environment file
- Copy the .env file and rename it to .env.local:
```
cp .env .env.local
```
```
- Open it for editing:
```
```
nano .env.local
```
- Add required environment variables
- At minimum, your .env.local file needs these:
```
# This env file should NOT be checked into source control
# Use this file for local overrides
# Replace username:password with your Postgres user and password
DATABASE_URL=postgresql://username:password@localhost:5432/staple
# Generate a random session key
SESSION_SECRET_KEY=your_generated_session_key
# Where the app will live
APP_ORIGIN="http://localhost:3000/"
```
- To generate a SESSION_SECRET_KEY:
- Copy the output and paste it in place of your_generated_session_key.
```
openssl rand -hex 16
```
- Set up a test environment
- Copy .env.test to .env.test.local:
```
cp .env.test .env.test.local
```
- Edit it to point to your test database:
```
DATABASE_URL=postgresql://username:password@localhost:5432/staple_test
```
### Configure Email
STAPLE requires an email provider to send system emails (e.g., password resets, project invitations). You can use other options here, but we've configured three of them in our current code.
#### Secret Keys
- You must configure at least one of the following options:
- Gmail (App Passwords)
- Create a Gmail App Password: Google Guide
- Add to .env.local:
```
EMAIL_PASS="your_app_password"
```
- Amazon SES
- Set up Amazon Simple Email Service (SES): Amazon SES Docs
- Add to .env.local:
```
ACCESS_KEY="amazonACCESS"
SECRET_ACCESS_KEY="amazonSECRET"
```
- Resend
- Get an API key from Resend.
- Add to .env.local:
```
RESEND_API_KEY="resendAPI"
```
#### Edit the Mailer Configuration
In addition to adding one of the above environment variables, you’ll need to edit the mailer configuration file so STAPLE knows which provider to use.
- Open the mailer configuration file:
```
nano integrations/mailer.js
```
- Delete non-used mailers: there are three chunks of code in this file - one for each type of email. You should delete the types you are not using to ensure the app runs. You can also insert your own mail options in this section.
- Edit the forgot password mailer:
```
nano mailers/forgotPasswordMailer.ts
```
- Change these sections to the mailer you want to use:
```
// import { Mailer } from "integrations/mailer"
import { createForgotPasswordMsg } from "integrations/emails"
// import { Amazon } from "integrations/mailer"
import { ResendMsg } from "integrations/mailer"
```
```
//send the email
await ResendMsg(createForgotPasswordMsg(to, resetUrl))
// await Amazon(createForgotPasswordMsg(to, resetUrl)) # or amazon
// await Mailer(createForgotPasswordMsg(to, resetUrl)) # or gmail
```
- Edit the emails.tsx file if you want to customize the emails that are sent with your own email address and logos.
```
nano integrations/emails.tsx
```
### Install STAPLE Requirements
- Make sure you are in the STAPLE main folder before running these commands.
- Use the following (not the `#` line, these are notes) to install packages, tailwind, and daisyui.
```
# Install all project dependencies
npm install
# Install Tailwind CSS
blitz install tailwind
# Install DaisyUI
npm i -D daisyui@latest
```
- Set up the database schema:
```
# Generate Prisma client
blitz prisma generate
# Run migrations to create database structure
blitz prisma migrate dev
```
### Setting Up the STAPLE Viewer Worker
The Viewer Worker is a background process that supports the Build Summary Viewer in STAPLE. It listens for Redis messages and processes summary-building tasks asynchronously.
- Run the Viewer Worker (manual test)
<!-- -->
- Before setting it up as a service, you can test the worker manually to confirm it runs correctly:
```
sudo npm run run-viewer-worker
```
- This command should start the background process and display console logs from the viewer worker.
<!-- -->
- Install and enable Redis: The viewer worker relies on Redis for managing background jobs and caching.
```
sudo apt update
sudo apt install redis-server
sudo systemctl enable redis-server
sudo systemctl start redis-server
```
- To confirm Redis is running:
```
sudo systemctl status redis-server
```
- Create the Viewer Worker service: next, create a systemd service so the viewer worker runs automatically on startup.
- Create a new service file:
```
sudo nano /etc/systemd/system/viewer-worker.service
```
- Add the following configuration (update the Node.js path if necessary):
```
[Unit]
Description=STAPLE Viewer Worker
After=network.target
[Service]
WorkingDirectory=/var/www/html/STAPLE
ExecStart=/home/ubuntu/.nvm/versions/node/v20.17.0/bin/node /var/www/html/STAPLE/src/summary/utils/viewerWorker.js
Restart=on-failure
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.target
```
> **Note:** If your Node.js binary is installed globally (for example at /usr/bin/node), you can replace the ExecStart line with:
```
ExecStart=/usr/bin/node /var/www/html/STAPLE/src/summary/utils/viewerWorker.js
```
- Enable and start the service
```
sudo systemctl daemon-reload
sudo systemctl enable viewer-worker
sudo systemctl start viewer-worker
```
- Check the service status:
```
sudo systemctl status viewer-worker
```
- Viewing logs: To monitor the viewer worker’s activity:
```
sudo journalctl -u viewer-worker -f
```
- This will stream logs from the worker in real time, which is useful for debugging summary build issues.
- Restarting the service: After making changes to STAPLE’s summary logic or viewerWorker.js, restart the service:
```
sudo systemctl restart viewer-worker
```
### Starting the App - Local Testing
- Open a terminal window and navigate to the STAPLE folder you cloned:
```
cd /var/www/html/STAPLE
```
- Start the development server:
```
blitz dev
```
- Once the server is running, open your browser and go to: http://localhost:3000 (or whatever address is shown in your terminal output).
### Starting the App - Production
- Open a terminal window and navigate to the STAPLE folder you cloned:
```
cd /var/www/html/STAPLE
```
- Build the application:
```
blitz build
```
> ⚠️ Note: If the build process produces errors, you’ll need to fix these before you can continue. Common issues include missing dependencies or mismatched Prisma client versions. Check the terminal output for details. We do not update our dev or main branches without fixing these, but it may be that your edits for your server caused hiccups.
- Once the build completes successfully, start the app in production mode:
```
blitz start
```
### Keeping the App Going
When running in production, you’ll want STAPLE to automatically restart after crashes or reboots. The recommended way to do this on Linux is by creating a systemd service.
- Create a service file
- Navigate to the systemd directory and create a new file (we’ll call it `blitz.service`):
```
cd /etc/systemd/system/
sudo nano blitz.service
```
- Example service file:
- Replace `WorkingDirectory` with the path to your STAPLE installation.
- You can also set specific users or production modes for security.
```
[Unit]
Description=Starts the Blitz service.
After=network.target
[Service]
Type=simple
WorkingDirectory=/var/www/html/STAPLE
ExecStart=/usr/local/bin/blitz start
Restart=always
[Install]
WantedBy=default.target
```
- Enable and control the service
- Once your file is saved, you can manage it with:
```
# Start the service
sudo systemctl start blitz
# Check status (press "q" to quit)
sudo systemctl status blitz
# Restart the service
sudo systemctl restart blitz
# Stop the service
sudo systemctl stop blitz
# Enable service on boot
sudo systemctl enable blitz
# Disable service
sudo systemctl disable blitz
# Reset if failed
sudo systemctl reset-failed blitz
```
- Tutorial reference
- If you’re new to systemd services, see this helpful guide: [Service Installation Instructions](https://www.digitalocean.com/community/tutorials/how-to-configure-a-linux-service-to-start-automatically-after-a-crash-or-reboot-part-1-practical-examples)
### Setting Up the Proxy (Nginx)
Now that STAPLE is running as a background service, you’ll want to expose it through your web domain with Nginx.
- Navigate to your Nginx configuration folder
```
cd /etc/nginx/sites-enabled
```
- Create a new site config file
- Name it after your site, e.g.:
```
sudo nano app.staplescience.com
```
- Add the server configuration
- Replace app.staplescience.com with your domain and update the log path if needed:
```
server {
listen 80;
server_name app.staplescience.com;
error_log /var/www/html/YOURFOLDER/logs/web-server.log;
location / {
proxy_pass http://localhost:3000/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
```
> ⚠️ Important: Make sure the server_name matches your domain name, and the proxy_pass points to the port where Blitz is running (localhost:3000 by default).
- Test your config:
```
sudo nginx -t
```
- If you see syntax is ok and test is successful, reload Nginx:
```
sudo systemctl reload nginx
```
### Enable HTTPS
- Use Let’s Encrypt to add SSL by changing the location of your app in the following:
```
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d app.staplescience.com
```
- This will automatically configure HTTPS and renew your certificate.
- See [Installation Instructions](https://certbot.eff.org/).
### Install pgAdmin (Optional)
pgAdmin provides a graphical interface for managing your PostgreSQL database. Follow these steps to install and configure pgAdmin on your server.
- Update your system:
```
sudo apt update
```
- Add the pgAdmin repository: Import the public key and add the pgAdmin APT repository:
```
curl -fsS https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/packages-pgadmin-org.gpg
```
```
sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
```
- Install pgAdmin:
```
sudo apt install pgadmin4
```
- Run the setup webscript:
```
sudo /usr/pgadmin4/bin/setup-web.sh
```
- When prompted, enter the following credentials:
- Email: your email
- Password: your password
- Note: these do not have to match any other accounts or the database.
- Adjusting Ports (if using Nginx): If your server is already running Nginx (which typically listens on port 80), you’ll need to change Apache’s default port to avoid conflicts.
- Edit Apache’s port configuration:
```
sudo nano /etc/apache2/ports.conf
```
- Change Listen 80 to something else:
```
Listen 80
```
```
Listen 81
```
- Update the default virtual host:
```
sudo nano /etc/apache2/sites-available/000-default.conf
```
- Change this port to the one you picked earlier:
```
<VirtualHost *:80>
```
```
<VirtualHost *:81>
```
- Restart Apache:
```
sudo systemctl restart apache2
```
- Verify the port is open:
```
sudo ss -tulnp | grep :81
```
#### **Accessing pgAdmin**
- Once Apache is running, open pgAdmin in your browser:
```
http://192.168.50.25:81/pgadmin4
```
- Log in using the email and password you configured earlier.
#### **Verifying PostgreSQL Connectivity**
- Ensure that PostgreSQL is configured to accept connections:
```
sudo -u postgres psql -c "SHOW listen_addresses;"
```
The output should show:
```
*
```
- If not, update your PostgreSQL configuration (/etc/postgresql/\<version\>/main/postgresql.conf) and restart the PostgreSQL service.

#### **Connecting to Your Database**
- In pgAdmin, click Add New Server.

- Under the General tab, enter a name (e.g., STAPLE).

- Under the **Connection** tab, provide:
- Host name/address: localhost
- Username: staple username set up earlier
- Password: password set up earlier
- Click Save.
- Once connected, you can navigate to:

- **STAPLE → Schemas → Public → Tables → User**
- Right-click on the **User** table to view or query data.

### Updating STAPLE
To keep your STAPLE installation up to date with the latest features and fixes, follow these steps:
- Navigate to your STAPLE directory: Open a terminal and change into the folder where you originally cloned the STAPLE repository:
```
cd /path/to/staple
```
- Pull the latest changes: Update your local copy of the repository by pulling the newest code from the main branch:
```
git pull origin main
```
- Reinstall dependencies: Ensure all required Node modules are up to date:
```
npm install
```
- Run database migrations: Apply any new schema changes to your database:
```
blitz prisma migrate dev
```
- Rebuild the project: Rebuild STAPLE to compile updated files:
```
blitz build
```
- Restart the STAPLE service: Finally, restart the Blitz service so the new version takes effect:
```
sudo systemctl restart blitz.service
```
> **Tip:** You can check that STAPLE is running correctly after the update by visiting your instance’s URL or reviewing the logs:
```
sudo journalctl -u blitz.service -f
```
#### Database Migration
Every so often, we update features that require a manual migration of the database - for example, when we created Milestones, we had to copy over the data from the old naming system into the new. These types of changes are not handled by `blitz prisma migrate dev`.
- You can create a 'super user' by having a person with their user.role == ADMIN rather than user. This role adds a link on the main home side bar:
{width="217"}
- You will then be able to run migrations within the app:

- We always add these buttons when applying this type of change to ensure it will not break the online database.
## Common Issues & Fixes
### Prisma / Database Errors
- Error: Error: P1000: Authentication failed against database server
- Fix: Double-check your DATABASE_URL in .env.local. Make sure the username/password match the Postgres user you created.
- Error: Error: P3014: The underlying table does not exist
- Fix: Run migrations again:
```
blitz prisma migrate dev
```
- Permission denied when running migrations
- Fix: Ensure the Postgres user has privileges:
```
ALTER ROLE your_username CREATEDB;
GRANT ALL ON SCHEMA public TO your_username;
```
### Build Errors
- Error: blitz build fails with missing dependencies
- Fix: Run npm install again to ensure all dependencies are installed.
- Prisma client mismatch
- Fix: Run:
```
blitz prisma generate
```
### Email Issues
- No emails are being sent
- Fix: Check that you kept only one mailer provider in mailer.ts.
- Ensure the correct environment variables (EMAIL_PASS, ACCESS_KEY, SECRET_ACCESS_KEY, or RESEND_API_KEY) are set in .env.local.
- For Amazon SES, make sure your MAIL_FROM address is verified.
- For Gmail, use an App Password, not your regular password.
### Nginx / Proxy Issues
- Nginx won’t start
- Fix: Run `sudo nginx -t` to test configuration. Correct any syntax errors before restarting.
- Site loads, but app doesn’t respond
- Fix: Make sure blitz is running (check with `sudo systemctl status blitz`).
- Check that the `proxy_pass` in your Nginx config matches the Blitz port (localhost:3000 by default).
- SSL certificate not working
- Fix: Ensure port 80/443 are open on your firewall.
- Re-run certbot:
```
sudo certbot --nginx -d yourdomain.com
```
### Service Issues
- Blitz doesn’t restart after reboot
- Fix: Make sure the service is enabled:
```
sudo systemctl enable blitz
```
- Service crashes with permission errors
- Fix: Ensure the User in `blitz.service` has read/write access to the STAPLE folder.
### General Tips
- After editing .env.local, .env.test.local, or blitz.service, restart the app:
```
sudo systemctl restart blitz
```
- Check logs:
```
journalctl -u blitz -f
```
Get help: contact [staple.helpdesk at gmail.com](mailto:staple.helpdesk@gmail.com).