@powerhousedao/academy 2.5.0-dev.4 → 2.5.0-dev.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +237 -0
  2. package/docs/academy/01-GetStarted/00-ExploreDemoPackage.md +19 -15
  3. package/docs/academy/01-GetStarted/01-CreateNewPowerhouseProject.md +39 -40
  4. package/docs/academy/01-GetStarted/02-DefineToDoListDocumentModel.md +22 -7
  5. package/docs/academy/01-GetStarted/03-ImplementOperationReducers.md +9 -4
  6. package/docs/academy/01-GetStarted/04-BuildToDoListEditor.md +146 -422
  7. package/docs/academy/01-GetStarted/_04-BuildToDoListEditor +360 -0
  8. package/docs/academy/01-GetStarted/home.mdx +16 -24
  9. package/docs/academy/01-GetStarted/styles.module.css +31 -0
  10. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/01-Prerequisites.md +0 -18
  11. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/02-StandardDocumentModelWorkflow.md +10 -6
  12. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/03-BuilderTools.md +1 -1
  13. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/01-WhatIsADocumentModel.md +33 -16
  14. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/02-SpecifyTheStateSchema.md +73 -0
  15. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/03-SpecifyDocumentOperations.md +59 -4
  16. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/04-UseTheDocumentModelGenerator.md +32 -12
  17. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/05-ImplementDocumentReducers.md +103 -38
  18. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/06-ImplementDocumentModelTests.md +90 -228
  19. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/07-ExampleToDoListRepository.md +41 -1
  20. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/01-BuildingDocumentEditors.md +342 -67
  21. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/02-ConfiguringDrives.md +5 -3
  22. package/docs/academy/02-MasteryTrack/05-Launch/02-PublishYourProject.md +70 -5
  23. package/docs/academy/02-MasteryTrack/05-Launch/03-SetupEnvironment.md +162 -73
  24. package/docs/academy/02-MasteryTrack/05-Launch/{03-RunOnACloudServer.md → _03-RunOnACloudServer} +8 -5
  25. package/docs/academy/03-ExampleUsecases/Chatroom/02-CreateNewPowerhouseProject.md +10 -9
  26. package/docs/academy/03-ExampleUsecases/Chatroom/03-DefineChatroomDocumentModel.md +3 -4
  27. package/docs/academy/03-ExampleUsecases/Chatroom/05-ImplementChatroomEditor.md +1 -1
  28. package/docs/academy/03-ExampleUsecases/Chatroom/_category_.json +1 -1
  29. package/docs/academy/04-APIReferences/00-PowerhouseCLI.md +13 -49
  30. package/docs/academy/05-Architecture/00-PowerhouseArchitecture.md +3 -0
  31. package/docs/academy/05-Architecture/images/PowerhouseArchitecture.png +0 -0
  32. package/docs/academy/06-ComponentLibrary/00-DocumentEngineering.md +85 -30
  33. package/docs/academy/06-ComponentLibrary/02-CreateCustomScalars.md +382 -0
  34. package/docs/academy/06-ComponentLibrary/03-IntegrateIntoAReactComponent.md +124 -0
  35. package/docs/academy/07-Cookbook.md +252 -4
  36. package/docs/academy/08-Glossary.md +20 -18
  37. package/docs/academy/09-AIResources +131 -0
  38. package/docusaurus.config.ts +4 -0
  39. package/package.json +1 -1
  40. package/sidebars.ts +3 -45
  41. package/src/css/custom.css +23 -1
  42. package/docs/academy/03-ExampleUsecases/Chatroom/01-SetupBuilderEnvironment.md +0 -216
  43. package/docs/academy/06-ComponentLibrary/02-BuildingWithScalars.md +0 -54
  44. package/docs/academy/06-ComponentLibrary/03-Scalar-Components/01-phid-field.mdx +0 -72
  45. package/docs/academy/06-ComponentLibrary/03-Scalar-Components/02-input-field.mdx +0 -0
  46. package/docs/academy/06-ComponentLibrary/04-Complex-Components/01-sidebar.mdx +0 -36
  47. package/docs/academy/06-ComponentLibrary/05-Layout-Components/01-test-toupdate.mdx +0 -61
  48. package/docs/academy/06-ComponentLibrary/06-Fragments/01-test-toupdate.mdx +0 -61
  49. /package/docs/academy/02-MasteryTrack/05-Launch/{02-IntroductionToPackages.md → 01-IntroductionToPackages.md} +0 -0
  50. /package/docs/academy/02-MasteryTrack/05-Launch/{00-IntegrateInAFront-End → _00-IntegrateInAFront-End} +0 -0
  51. /package/docs/academy/02-MasteryTrack/05-Launch/{01-IntroducingFusion → _01-IntroducingFusion} +0 -0
  52. /package/docs/academy/02-MasteryTrack/05-Launch/{04-GraphQLNamespacing → _04-GraphQLNamespacing} +0 -0
  53. /package/docs/academy/02-MasteryTrack/05-Launch/{05-LaunchYourBackend.md → _05-LaunchYourBackend} +0 -0
  54. /package/docs/academy/02-MasteryTrack/05-Launch/{06-LaunchYourFrontend.md → _06-LaunchYourFrontend} +0 -0
  55. /package/docs/academy/04-APIReferences/{01-ReactHooks.md → 01-ReactHooks} +0 -0
  56. /package/docs/academy/04-APIReferences/{02-ReactorAPI.md → 02-ReactorAPI} +0 -0
  57. /package/docs/academy/04-APIReferences/{03-Configuration.md → 03-Configuration} +0 -0
@@ -1,62 +1,23 @@
1
- # Powerhouse Setup Guide (WIP)
1
+ # Powerhouse Setup Guide
2
2
 
3
3
  ## Introduction
4
- Powerhouse is a powerful platform that helps you manage and deploy your applications efficiently. This guide will walk you through the process of setting up both the Powerhouse CLI and configuring your server machine to run Powerhouse services. Whether you're setting up a development environment or preparing for production deployment, this guide provides all the necessary steps and considerations.
4
+ Powerhouse is a powerful platform that helps you manage and deploy your applications efficiently.
5
+ This guide will walk you through the process of setting up both the Powerhouse CLI and configuring your server machine to run Powerhouse services. Whether you're setting up a development environment or preparing for production deployment, this guide provides all the necessary steps and considerations.
5
6
 
6
7
  ## Prerequisites
7
- Before you begin, ensure you have a Linux-based system (Ubuntu or Debian recommended), sudo privileges, and a stable internet connection. These are essential for the installation and configuration process. The system should have at least 1GB of RAM and 10GB of free disk space for optimal performance. While these are minimum requirements, more resources will provide better performance, especially when running multiple services.
8
+ Before you begin, ensure you have a Linux-based system (Ubuntu or Debian recommended), sudo privileges, and a stable internet connection.
9
+ These are essential for the installation and configuration process.
10
+ The system should have at least 1GB of RAM and 10GB of free disk space for optimal performance.
11
+ While these are minimum requirements, more resources will provide better performance, especially when running multiple services.
8
12
 
9
- ## 1. Setting up a new cloud environment
10
-
11
- The `install` script provides a streamlined way to install the Powerhouse CLI tool and all its necessary dependencies. This script handles the installation of node.js 22, pnpm, Powerhouse CLI itself and the services. It's designed to work across different Linux distributions, though it's optimized for Ubuntu and Debian-based systems. It also prepares your machine for running Powerhouse services. It handles everything from package installation to service configuration, making the setup process straightforward and automated. This script is particularly useful for setting up new servers or reconfiguring existing ones.
12
-
13
-
14
- ### Installation Steps:
15
- 1. Run the setup script:
16
- ```bash
17
- curl -fsSL https://apps.powerhouse.io/install | bash # for macOS, Linux, and WSL
18
- ```
19
-
20
- 2. After installation, source your shell configuration:
21
- ```bash
22
- source ~/.bashrc # or source ~/.zshrc if using zsh
23
- ```
24
-
25
- 3. Verify the installation:
26
- ```bash
27
- ph --version
28
- ```
29
-
30
- 4. You will see ph-cli is not yet installed. But it will get installed automatically in the next step.
31
- If you are a builder that wants to make use of the dev releases use `ph use dev` before going to the next step.
32
- - `ph use dev`: Development version - Use this for testing new features or development work
33
- - `ph use staging`: Staging version - Use this for pre-production testing
34
-
35
- 5. Follow the interactive prompts:
36
-
37
- ### Step 1: Package Installation
38
- During the package installation phase, you'll be prompted to enter package names that you want to install. For example, you might want to install `@powerhousedao/todo-demo-package` or other Powerhouse packages. This step is crucial for adding the specific functionality you need to your Powerhouse installation. You can press Enter to skip this step if you don't need to install any packages immediately, but you can always install packages later using the `ph install` command.
39
-
40
- ### Step 2: Database Configuration
41
- The script offers two options for database configuration.
42
-
43
- **Option 1:** Sets up a local PostgreSQL database, which is ideal for development or small deployments. It automatically creates a database user with a secure random password and configures the database to accept local connections. This option is perfect for getting started quickly or for development environments.
44
-
45
- **Option 2:** Allows you to connect to a remote PostgreSQL database by providing a connection URL in the format `postgres://user:password@host:port/db`. This is recommended for production environments where you might want to use a managed database service or a dedicated database server.
46
-
47
- ### Step 3: SSL Configuration
48
- For SSL configuration, you have two choices.
49
-
50
- **Option 1:** The **Let's Encrypt** option is recommended for production environments. It requires you to provide a base domain (like `powerhouse.xyz`) and optional subdomains for your services. The script will automatically obtain and configure SSL certificates for your domains, ensuring secure communication between your services and clients.
51
-
52
- **Option 2:** The self-signed certificate option is suitable for development or testing environments. It uses your machine's hostname and generates a self-signed certificate, configuring the services with appropriate base paths. While this option is convenient for development, browsers will show security warnings, which is why it's not recommended for production use.
13
+ Also make sure you have your preferred domain registered and created subdomains for your Connect & Switchboard instances.
53
14
 
54
15
  <details>
55
- <summary>Setting up a domain in DigitalOcean</summary>
16
+ <summary>**Setting up a Droplet (Digital Ocean) instance and connecting your domain**</summary>
56
17
 
57
18
  This tutorial will guide you through the process of creating a new virtual private server (called a "Droplet") on DigitalOcean and then pointing your custom domain name to it. This will allow users to access your server using a memorable URL like `www.yourdomain.com`.
58
19
 
59
- **Current Date:** May 15, 2025
20
+ **Current Date:** May 15, 2024
60
21
 
61
22
  ## Part 1: Setting Up Your DigitalOcean Droplet
62
23
 
@@ -156,6 +117,18 @@ Now your Droplet is running! Now you can continue with the Powerhouse tutorial o
156
117
  - **WILL DIRECT TO:** Your Droplet's IP
157
118
  - **TTL:** 3600
158
119
 
120
+ - **Connect Subdomain (A Record):**
121
+ - **TYPE:** A
122
+ - **HOSTNAME:** connect
123
+ - **WILL DIRECT TO:** Your Droplet's IP
124
+ - **TTL:** 3600
125
+
126
+ - **Switchboard Subdomain (A Record):**
127
+ - **TYPE:** A
128
+ - **HOSTNAME:** switchboard
129
+ - **WILL DIRECT TO:** Your Droplet's IP
130
+ - **TTL:** 3600
131
+
159
132
  #### Option B: Using Your Existing Nameservers (NS locked)
160
133
 
161
134
  1. **Just Create DNS Records at Your Registrar:**
@@ -171,6 +144,18 @@ Now your Droplet is running! Now you can continue with the Powerhouse tutorial o
171
144
  - **VALUE:** Your Droplet's IP
172
145
  - **TTL:** 3600
173
146
 
147
+ - **Connect Subdomain (A Record):**
148
+ - **TYPE:** A
149
+ - **HOSTNAME:** connect
150
+ - **VALUE:** Your Droplet's IP
151
+ - **TTL:** 3600
152
+
153
+ - **Switchboard Subdomain (A Record):**
154
+ - **TYPE:** A
155
+ - **HOSTNAME:** switchboard
156
+ - **VALUE:** Your Droplet's IP
157
+ - **TTL:** 3600
158
+
174
159
  **Note:** DNS changes may take up to 48 hours to propagate globally.
175
160
 
176
161
  ### Verify Configuration
@@ -179,20 +164,43 @@ Now your Droplet is running! Now you can continue with the Powerhouse tutorial o
179
164
  ```bash
180
165
  dig +short yourdomain.com
181
166
  dig +short www.yourdomain.com
167
+ dig +short connect.yourdomain.com
168
+ dig +short switchboard.yourdomain.com
182
169
  ```
183
170
 
184
- 2. Both should return your Droplet's IP address
171
+ 2. All should return your Droplet's IP address
185
172
 
186
173
  **Congratulations!** You have successfully set up your DigitalOcean Droplet and configured your domain. Your server is now ready to host your Powerhouse services.
187
174
 
188
175
  </details>
189
176
 
190
177
  <details>
191
- <summary>Setting up a domain with AWS EC2</summary>
178
+ <summary> **Setting up an EC2 instance and connecting your domain** </summary>
192
179
 
193
180
  This tutorial will guide you through the process of assigning a static IP (Elastic IP) to your EC2 instance and configuring your domain to point to it.
194
181
 
195
- **Current Date:** May 15, 2025
182
+ **Current Date:** May 15, 2024
183
+
184
+ - Make sure your region is set to eu-west-1 (Ireland)
185
+ - Name your instance something like `cloud-server` or your project's name
186
+ - Select Ubuntu 24.04 LTS
187
+ - Architecture 64-bit (x86)
188
+ - Scroll down to Instance type and select t2.medium (recommended)
189
+ - 2 vCPUs and 4 GiB of memory are the recommended minimum specs
190
+ - For larger projects or higher load, consider t2.large or t2.xlarge
191
+ - Create a new key pair and save it in a secure location from which you can connect to your instance with the SSH client later.
192
+ - Configure the security group to allow inbound traffic:
193
+ - SSH (Port 22) from your IP address
194
+ - HTTP (Port 80) from anywhere
195
+ - HTTPS (Port 443) from anywhere
196
+ - Custom TCP (Port 8442) for Connect
197
+ - Custom TCP (Port 8441) for Switchboard
198
+ - **Launch the instance**
199
+
200
+ :::warning
201
+ Make sure to keep your key pair file (.pem) secure and never share it. Without it, you won't be able to access your instance. Also, consider setting up AWS IAM roles and policies for better security management.
202
+ :::
203
+
196
204
 
197
205
  ## Part 1: Assigning a Static IP to EC2 Instance
198
206
 
@@ -247,6 +255,18 @@ This tutorial will guide you through the process of assigning a static IP (Elast
247
255
  - **VALUE:** Your Elastic IP
248
256
  - **TTL:** 3600
249
257
 
258
+ - **Connect Subdomain (A Record):**
259
+ - **TYPE:** A
260
+ - **HOSTNAME:** connect
261
+ - **VALUE:** Your Elastic IP
262
+ - **TTL:** 3600
263
+
264
+ - **Switchboard Subdomain (A Record):**
265
+ - **TYPE:** A
266
+ - **HOSTNAME:** switchboard
267
+ - **VALUE:** Your Elastic IP
268
+ - **TTL:** 3600
269
+
250
270
  ### Option B: Using Your Existing Nameservers
251
271
 
252
272
  1. **Create DNS Records at Your Registrar:**
@@ -262,6 +282,18 @@ This tutorial will guide you through the process of assigning a static IP (Elast
262
282
  - **VALUE:** Your Elastic IP
263
283
  - **TTL:** 3600
264
284
 
285
+ - **Connect Subdomain (A Record):**
286
+ - **TYPE:** A
287
+ - **HOSTNAME:** connect
288
+ - **VALUE:** Your Elastic IP
289
+ - **TTL:** 3600
290
+
291
+ - **Switchboard Subdomain (A Record):**
292
+ - **TYPE:** A
293
+ - **HOSTNAME:** switchboard
294
+ - **VALUE:** Your Elastic IP
295
+ - **TTL:** 3600
296
+
265
297
  1. **Set Up DNS First:**
266
298
  - Create A records for all subdomains before running the setup script
267
299
  - Point them to your EC2 instance's public IP address
@@ -273,27 +305,83 @@ This tutorial will guide you through the process of assigning a static IP (Elast
273
305
  ```bash
274
306
  dig +short yourdomain.com
275
307
  dig +short www.yourdomain.com
308
+ dig +short connect.yourdomain.com
309
+ dig +short switchboard.yourdomain.com
276
310
  ```
277
311
 
278
- 2. Both should return your Elastic IP address
312
+ 2. All should return your Elastic IP address
279
313
 
280
314
  **Congratulations!** You have successfully set up your EC2 instance with a static IP and configured your domain. Your server is now ready to host your Powerhouse services.
281
315
 
282
316
  </details>
283
317
 
284
- ### Step 4: Service Configuration
318
+ ## 1. Setting up a new cloud environment
319
+
320
+ The `install` script provides a streamlined way to install the Powerhouse CLI tool and all its necessary dependencies. This script handles the installation of Node.js 22, pnpm, and the Powerhouse CLI itself. It's designed to work across different Linux distributions, though it's optimized for Ubuntu and Debian-based systems. It also prepares your machine for running Powerhouse services. It handles everything from package installation to service configuration, making the setup process straightforward and automated. This script is particularly useful for setting up new servers or reconfiguring existing ones.
321
+
322
+ ### Installation
323
+
324
+ 1. Run the setup script:
325
+ ```bash
326
+ curl -fsSL https://apps.powerhouse.io/install | bash # for macOS, Linux, and WSL
327
+ ```
328
+
329
+ 2. After installation, source your shell configuration:
330
+ ```bash
331
+ source ~/.bashrc # or source ~/.zshrc if using zsh
332
+ ```
333
+
334
+ 3. Verify that the Powerhouse CLI is ready to be installed in the next step:
335
+ ```bash
336
+ ph --version
337
+ ```
338
+ You will see that `ph-cli` is not yet installed. This is expected, as it will be installed by the service setup command.
339
+
340
+ 4. Create a project with `ph-init <projectname>`.
341
+
342
+ 5. After creation, move into the project with `cd <projectname>`.
343
+
344
+ Up next is the configurations of your services.
345
+
346
+ ### Service Configuration
347
+
348
+ Next, run `ph service setup` and follow the interactive prompts. This command installs the Powerhouse services (Connect and Switchboard) and guides you through their configuration.
349
+
350
+ :::info
351
+ **What does `ph service setup` do?**
352
+ The script takes care of all the necessary service configuration automatically.
353
+ It installs and configures **Nginx** as a reverse proxy, sets up SSL certificates, and configures the proxy settings for optimal performance.
354
+ It also installs **PM2** for process management and starts your services with the appropriate configuration based on your SSL choice.
355
+ The Nginx configuration includes optimizations for **WebSocket connections**, static file serving, and security headers.
356
+ PM2 is configured to automatically restart services if they crash and to start them on system boot.
357
+ :::
358
+
359
+ The setup command will prompt you for the following information:
360
+
361
+ #### Package Installation
362
+ During this phase, you can enter package names that you want to install. For example, you might want to `ph install @powerhousedao/todo-demo-package` or other Powerhouse packages. This step is crucial for adding the specific functionality you need. You can also press Enter to skip this step and install packages later using the `ph install` command.
363
+
364
+ #### Database Configuration
365
+ The script offers two options for database configuration:
366
+ * **Option 1: Local Database** Sets up a local PostgreSQL database, which is ideal for development or small deployments. It automatically creates a database user with a secure random password and configures the database to accept local connections. This option is perfect for getting started quickly.
367
+ * **Option 2: Remote Database** Allows you to connect to a remote PostgreSQL database by providing a connection URL in the format `postgres://user:password@host:port/db`. This is recommended for production environments.
285
368
 
286
- The script takes care of all the necessary service configuration automatically. It installs and configures **Nginx** as a reverse proxy, sets up SSL certificates, and configures the proxy settings for optimal performance. It also installs **PM2** for process management and starts your services with the appropriate configuration based on your SSL choice. The Nginx configuration includes optimizations for **WebSocket connections**, static file serving, and security headers. PM2 is configured to automatically restart services if they crash and to start them on system boot.
369
+ #### SSL Configuration
370
+ For SSL configuration, you have two choices:
371
+ * **Option 1: Let's Encrypt (Recommended for Production)** This option requires you to provide a base domain (e.g., `powerhouse.xyz`) and subdomains for your services. The script will automatically obtain and configure SSL certificates for your domains.
372
+ * **Option 2: Self-signed Certificate** This is suitable for development or testing. It uses your machine's hostname and generates a self-signed certificate. Browsers will show security warnings with this option.
287
373
 
288
- ### Step 5: Security Features
289
- Security is a top priority in the setup process. The script implements automatic SSL certificate management, generates secure database passwords, and configures security headers in Nginx. It also sets up proper proxy settings to support WebSocket connections securely. The security headers include protection against common web vulnerabilities, and the SSL configuration uses modern cipher suites and protocols. The script also ensures that sensitive files and directories have appropriate permissions.
374
+ #### Domain Setup
375
+ You will be asked to enter your `connect` and `switchboard` subdomains to complete the setup. If you need more information, revisit the cloud provider setup sections at the beginning of this guide.
290
376
 
377
+ #### Security Features
378
+ Security is a top priority. The script implements automatic SSL certificate management, generates secure database passwords, and configures security headers in Nginx, and sets up proper proxy settings to support WebSocket connections securely.
291
379
 
292
- ## 3. Verifying the Setup
380
+ ## 2. Verifying the Setup
293
381
 
294
382
  After the installation is complete, it's important to verify that everything is working correctly. You can check the status of your services using PM2, verify the Nginx configuration, and ensure your SSL certificates are properly installed. This step is crucial for identifying any potential issues before they affect your users.
295
383
 
296
- 1. Check service status of switchboard & connect:
384
+ 1. Check service status of switchboard and connect:
297
385
  ```bash
298
386
  ph service status
299
387
  ```
@@ -302,7 +390,7 @@ You can also use
302
390
  ```bash
303
391
  ph service start | stop | restart
304
392
  ```
305
- - to start | stop | restart switchboard and connect
393
+ to start | stop | restart switchboard and connect
306
394
 
307
395
  2. View Nginx configuration:
308
396
  ```bash
@@ -314,9 +402,10 @@ sudo nginx -t
314
402
  sudo certbot certificates # if using Let's Encrypt
315
403
  ```
316
404
 
317
- ## 4. Accessing Services
405
+ ## 3. Accessing the Services
318
406
 
319
- Once everything is set up, you can access your services through the configured domains. If you chose Let's Encrypt, your services will be available at their respective subdomains. With a self-signed certificate, you'll access the services through your machine's hostname with the appropriate base paths. The services are configured to use HTTPS by default, ensuring secure communication.
407
+ Once everything is set up, you can access your services through the configured domains.
408
+ If you chose Let's Encrypt, your services will be available at their respective subdomains. With a self-signed certificate, you'll access the services through your machine's hostname with the appropriate base paths. The services are configured to use HTTPS by default, ensuring secure communication.
320
409
 
321
410
  ### With Let's Encrypt:
322
411
  - Connect: `https://connect.yourdomain.com`
@@ -326,18 +415,18 @@ Once everything is set up, you can access your services through the configured d
326
415
  - Connect: `https://your-hostname/connect`
327
416
  - Switchboard: `https://your-hostname/switchboard`
328
417
 
329
- ## 5. Troubleshooting
418
+ ## 4. Troubleshooting
330
419
 
331
420
  When issues arise, there are several common problems you might encounter.
332
- - The "ph: command not found" error usually means you need to source your shell configuration file.
421
+ - The "`ph`: command not found" error usually means you need to source your shell configuration file.
333
422
  - Nginx configuration errors can be investigated through the error logs, and service issues can be diagnosed using PM2 logs.
334
423
  - SSL certificate problems often relate to DNS settings or certificate paths. Understanding these common issues and their solutions will help you maintain a stable Powerhouse installation.
335
424
 
336
425
  ### Common Issues:
337
- 1. **"ph: command not found"**
426
+ 1. **"`ph`: command not found"**
338
427
  - Run `source ~/.bashrc` or restart your terminal
339
- - Verify that the PNPM_HOME environment variable is set correctly
340
- - Check if the ph binary exists in the PNPM_HOME directory
428
+ - Verify that the `PNPM_HOME` environment variable is set correctly
429
+ - Check if the `ph` binary exists in the `PNPM_HOME` directory
341
430
 
342
431
  2. **Nginx configuration errors**
343
432
  - Check logs: `sudo tail -f /var/log/nginx/error.log`
@@ -354,7 +443,7 @@ When issues arise, there are several common problems you might encounter.
354
443
  - Check certificate paths in Nginx config
355
444
  - Ensure that the certificate files are readable by Nginx
356
445
 
357
- ## 6. Maintenance
446
+ ## 5. Maintenance
358
447
 
359
448
  Regular maintenance is crucial for keeping your Powerhouse installation running smoothly. You can update services using the Powerhouse CLI, restart services through PM2, and monitor logs to ensure everything is functioning correctly. Regular maintenance helps prevent issues and ensures that your services are running with the latest security patches and features.
360
449
 
@@ -368,16 +457,16 @@ ph update <package-name>
368
457
  ph service restart
369
458
  ```
370
459
 
371
- ### Viewing Logs:
460
+ ### Checking Service Status and Logs:
372
461
  ```bash
373
462
  ph service status
374
463
  ```
375
464
 
376
- ## 7. Security Notes
465
+ ## 6. Security Notes
377
466
 
378
467
  Maintaining security is an ongoing process. It's essential to keep your database credentials secure and regularly update your SSL certificates. Regular monitoring of system logs helps identify potential security issues, and keeping your system and packages updated ensures you have the latest security patches. Consider implementing additional security measures such as firewall rules, intrusion detection systems, and regular security audits.
379
468
 
380
- ## 8. Backup
469
+ ## 7. Backup
381
470
 
382
471
  Regular backups are crucial for data safety. The database can be backed up using pg_dump, and your configuration files can be archived using tar. These backups should be stored securely and tested regularly to ensure they can be restored if needed. Consider implementing an automated backup schedule and storing backups in multiple locations for redundancy.
383
472
 
@@ -391,7 +480,7 @@ pg_dump -U powerhouse -d powerhouse > backup.sql
391
480
  sudo tar -czf powerhouse-config.tar.gz /etc/powerhouse/
392
481
  ```
393
482
 
394
- ## 9. Best Practices
483
+ ## 8. Best Practices
395
484
 
396
485
  To get the most out of your Powerhouse installation, follow these best practices:
397
486
 
@@ -401,7 +490,7 @@ To get the most out of your Powerhouse installation, follow these best practices
401
490
  4. **Testing**: Test your backup and restore procedures regularly.
402
491
  5. **Security**: Regularly review and update your security measures.
403
492
 
404
- ## 10. Getting Help
493
+ ## 9. Getting Help
405
494
 
406
495
  If you encounter issues or need assistance, there are several resources available:
407
496
 
@@ -17,7 +17,8 @@ Let's have a look at how to set up Connect & Switchboard apps on a cloud server.
17
17
  Ask your IT provider to get access to the AWS environment to set up a server.
18
18
  Launch a new server instance for Connect and Switchboard with the specific specs that fit your project.
19
19
 
20
- The steps to create an EC2 instance:
20
+ <details>
21
+ <summary> **The steps to create an EC2 instance** </summary>
21
22
  - Make sure your region is set to eu-west-1 (Ireland)
22
23
  - Name your instance something like `cloud-server` or your project's name
23
24
  - Select Ubuntu 24.04 LTS
@@ -34,13 +35,15 @@ The steps to create an EC2 instance:
34
35
  - Custom TCP (Port 8441) for Switchboard
35
36
  - **Launch the instance**
36
37
 
38
+ :::warning
39
+ Make sure to keep your key pair file (.pem) secure and never share it. Without it, you won't be able to access your instance. Also, consider setting up AWS IAM roles and policies for better security management.
40
+ :::
41
+
42
+ </details>
43
+
37
44
  Now click on your instance ID, which will open a new window with the instance details. Hit the 'Connect' button to get the connection details.
38
45
  Within the instance details, you'll find the public IP address of your server instance. We'll use this to connect to our server instance later.
39
46
 
40
- :::warning
41
- Make sure to keep your key pair file (.pem) secure and never share it. Without it, you won't be able to access your instance. Also, consider setting up AWS IAM roles and policies for better security management.
42
- :::
43
-
44
47
  ### 1.2. Setting up your SSH connection
45
48
 
46
49
  Once you've generated your key pairs and added them to the designated folder, you can set up the SSH connections to start the process.
@@ -1,20 +1,21 @@
1
1
  # Create New Powerhouse Project
2
2
 
3
- ## Create New Powerhouse Document Model Library Project
3
+ :::tip **Prerequisites**
4
+ - Powerhouse CLI installed: `pnpm install -g ph-cmd`
5
+ - node.js 22 and pnpm installed
6
+ - Visual Studio Code (or your preferred IDE)
7
+ - Terminal/Command Prompt access
8
+
9
+ If you need help with installing the prerequisites you can visit our page [prerequisites](/academy/MasteryTrack/BuilderEnvironment/Prerequisites)
10
+ :::
4
11
 
5
12
  To create a new Powerhouse Document Model Library project, you can use the `ph init` command in your terminal. This command will create a new project in the current directory.
13
+ This command will create a new project in the current directory. You can run the command in the terminal window of your OS or you open the newly installed VSCode and run the command in the terminal window of VSCode.Make sure the terminal reflects the directory where you want to create the new project.
6
14
 
7
- :::info
8
- This command will create a new project in the current directory.
9
- You can run the command in the terminal window of your OS or you open the newly installed VSCode and run the command in the terminal window of VSCode.
10
- You will need VSCode later in the tutorial once you have generated the document model.
11
- Make sure the terminal reflects the directory where you want to create the new project.
12
- To open a directory in a terminal, you use the cd command to change your current directory. The cd command takes an argument, usually the name of the folder you want to move to, so the full command is
13
15
  ```bash
14
16
  cd your-directory
15
17
  ```
16
18
  This essentially opens that folder and places you in it.
17
- :::
18
19
 
19
20
  Once you've navigated to the directory where you want to create the new project and in your terminal, run the following command:
20
21
 
@@ -22,7 +23,7 @@ Once you've navigated to the directory where you want to create the new project
22
23
  ph init
23
24
  ```
24
25
 
25
- In the terminal, you will be asked to enter the project name. Fill in the project name and press enter. Make sure to use the name `ChatRoom` as the project name with capital letter R so all of our tutorial code works.
26
+ In the terminal, you will be asked to enter the project name. Fill in the project name and press enter. Make sure to pay attention to the capitalization of our name `ChatRoom` as it will influence your code generation.
26
27
 
27
28
  ```bash
28
29
  you@yourmachine:~/Powerhouse$ ph init
@@ -9,9 +9,8 @@ Before you start, make sure you have the Connect application running.
9
9
 
10
10
  We use GraphQL Schema Definition Language (SDL) to define the document model schema. Below, you can see the SDL for the `ChatRoom` document model.
11
11
 
12
- :::info
13
- This schema contains the data structure of the document model and the basic operations that can be performed on the document model.
14
- Document models in Powerhouse leverage event sourcing principles, where every state transition is represented by an operation. GraphQL input types describe operations, ensuring that user intents are captured effectively. These operations detail the parameters needed for state transitions The use of GraphQL aligns these transitions with explicit, validated, and reproducible commands, supporting CQRS (Command Query Responsibility Segregation) patterns.
12
+ :::info **The State Schema**
13
+ This schema contains the data structure of the document model and the basic operations that can be performed on the document model. For more in depth information please visit [State Schema](/academy/MasteryTrack/DocumentModelCreation/SpecifyTheStateSchema)
15
14
  :::
16
15
 
17
16
  ## State Schema (See next steps)
@@ -101,7 +100,7 @@ The steps below show you how to do this:
101
100
  1. In the Connect application, click on the `ChatRoom` document model you've created in the previous step, to open the document model editor.
102
101
  2. You'll be welcomed with a form to fill, this is metadata about the document model, fill in the details in the fields.
103
102
 
104
- In the `Document Type` field, type `powerhouse/chatroom`. This defines the new type of document that will be created with this document model.
103
+ In the `Document Type` field, type `powerhouse/chat-room`. This defines the new type of document that will be created with this document model.
105
104
 
106
105
  ![Chatroom Document Model Form Metadata](image-2.png)
107
106
 
@@ -191,4 +191,4 @@ Below GIF shows the `Chatroom` editor in action.
191
191
 
192
192
  ![Chatroom Editor](./images/ChatRoomTest.gif)
193
193
 
194
- If you managed to follow this tutorial until this point, you have successfully implemented the `ChatRoom` document model with its reducer operations and editor. In the next chapter we'll be showing you how to simulate a synchronisation between two nodes or users making use of the chatroom by starting up a local reactor.
194
+ If you managed to follow this tutorial until this point, you have successfully implemented the `ChatRoom` document model with its reducer operations and editor.
@@ -3,6 +3,6 @@
3
3
  "position": 2,
4
4
  "link": {
5
5
  "type": "generated-index",
6
- "description": "Get started with the Chatroom tutorial! Jump into creating a new Powerhouse project if you have NodeJs, VSCode, and Git installed. Whe are going to create a new document model that represents a chat. So you as a user can post messages into that chat room, react to the messages. This chatroom will be synchronized between different connect instances. Let's explore the potential of the tools available in the powerhouse toolkit"
6
+ "description": "Get started with the Chatroom tutoria: Jump into creating a new Powerhouse project if you have NodeJs, VSCode, and Git installed. Whe are going to create a new document model that represents a chat. So you as a user can post messages into that chat room, react to the messages. This chatroom will be synchronized between different connect instances. Let's explore the potential of the tools available in the powerhouse toolkit"
7
7
  }
8
8
  }
@@ -2,20 +2,19 @@
2
2
 
3
3
  ### Installing the Powerhouse CLI
4
4
  :::tip
5
- The **Powerhouse CLI tool** is the only essential tool to install on this page. Install it with the command below.
5
+ The **Powerhouse CLI tool** is the only essential tool to install on this page. Install it with the command below.
6
+
6
7
  You can find all of the commands on this page, similar to what would displayed when using ph --help or ph *command* --help.
7
- Use the table of content or the search function to find what you are looking for.
8
- The Powerhouse CLI (`ph-cmd`) is a command-line interface tool that provides essential commands for managing Powerhouse projects. You can get access to the Powerhouse ecosystem tools by installing them globally using:
8
+ Use the table of content or the search function to find what you are looking for.
9
+
10
+ The Powerhouse CLI (`ph-cmd`) is a command-line interface tool that provides essential commands for managing Powerhouse projects. You can get access to the Powerhouse ecosystem tools by installing them globally.
9
11
 
10
12
  ```bash
11
13
  pnpm install -g ph-cmd
12
14
  ```
13
15
  :::
14
16
 
15
- <!-- AUTO-GENERATED-CLI-COMMANDS-START -->
16
-
17
- ## ph-cmd Commands
18
- - [Init](#init)
17
+ <!-- AUTO-GENERATED-CLI-COMMANDS-START -->\n<!-- This content is automatically generated. Do not edit directly. -->\n### ph-cmd Commands\n\n- [Init](#init)
19
18
  - [Setup Globals](#setup-globals)
20
19
  - [Update](#update)
21
20
  - [Use](#use)
@@ -229,6 +228,7 @@ Command Overview:
229
228
  The Connect build command creates a connect build with the project's local and external packages included.
230
229
 
231
230
  Options:
231
+ --base <path> The base path for the app. Default is "/".
232
232
  --project-root <path> The root directory of the project. Default is "process.cwd()".
233
233
  --assets-dir-name <name> The name of the assets directory. Default is "${DEFAULT_ASSETS_DIR_NAME}".
234
234
  --external-packages-file-name <name> The name of the external packages file. Default is "${DEFAULT_EXTERNAL_PACKAGES_FILE_NAME}".
@@ -244,6 +244,7 @@ Command Overview:
244
244
  NOTE: You must run \`ph connect build\` first.
245
245
 
246
246
  Options:
247
+ --base <path> The base path for the app. Default is "/".
247
248
  --project-root <path> The root directory of the project. Default is "process.cwd()".
248
249
  --port <port> The port to run the server on. Default is 4173.
249
250
  --open Open the browser. Default is true.
@@ -571,13 +572,11 @@ Arguments:
571
572
  - all: Act on all services (default)
572
573
 
573
574
  Examples:
574
- $ ph service # List all services (same as 'ph service list all')
575
- $ ph service start switchboard # Start the Switchboard service
576
- $ ph service stop connect # Stop the Connect service
577
- $ ph service start all # Start all services
575
+ $ ph service setup # Setup services
576
+ $ ph service start # Start the services
577
+ $ ph service stop # Stop the services
578
578
  $ ph service status # Check status of all services
579
- $ ph service startup # Configure services to start on system boot
580
- $ ph service unstartup # Remove services from system startup
579
+
581
580
 
582
581
  Notes:
583
582
  - Services are managed using PM2, a process manager for Node.js applications
@@ -702,39 +701,4 @@ Notes:
702
701
 
703
702
  ---
704
703
 
705
- *This document was automatically generated from the help text in the codebase.*\n<!-- AUTO-GENERATED-CLI-COMMANDS-END -->
706
-
707
- <details>
708
- <summary> How to make use of different branches? </summary>
709
-
710
- When installing or using the Powerhouse CLI commands you are able to make use of the dev & staging branches. These branches contain more experimental features then the latest stable release the PH CLI uses by default. They can be used to get access to a bugfix or features under development.
711
-
712
- | Command | Description |
713
- |---------|-------------|
714
- | **pnpm install -g ph-cmd** | Install latest stable version |
715
- | **pnpm install -g ph-cmd@dev** | Install development version |
716
- | **pnpm install -g ph-cmd@staging** | Install staging version |
717
- | **ph init** | Use latest stable version of the boilerplate |
718
- | **ph init --dev** | Use development version of the boilerplate |
719
- | **ph init --staging** | Use staging version of the boilerplate |
720
- | **ph use** | Switch all dependencies to latest production versions |
721
- | **ph use dev** | Switch all dependencies to development versions |
722
- | **ph use prod** | Switch all dependencies to production versions |
723
-
724
- Please be aware that these versions can contain bugs and experimental features that aren't fully tested.
725
- </details>
726
-
727
-
728
- the ph connect command now uses three subcommands:
729
-
730
- studio (default) — runs connect studio. since this is the default argument, running ph connect still has the same behavior as before,
731
-
732
- build — bundles the project's local and external model/editor code and injects the js/css into the already-built connect bundle for deployment,
733
-
734
- preview — runs the vite preview server with the output of build for testing purposes,
735
-
736
- running ph connect --help now lists the sub-commands. Running ph connect studio --help now shows the help for the studio command, likewise for the other new commands.
737
-
738
- This approach avoids redundant build/compilation which is great for minimizing server resource use. The only compilation that runs is the esbuild of the project code (does not need tsc as that is handled separately) and then tailwind for the local project styles. The whole thing takes less than a second, albeit on my macbook.
739
-
740
- This should just work with the current boilerplate since these are just new arguments to the existing ph-cli connect command.
704
+ *This document was automatically generated from the help text in the codebase.*\n<!-- AUTO-GENERATED-CLI-COMMANDS-END -->
@@ -12,6 +12,9 @@ These five applications are:
12
12
 
13
13
  Each application is designed to be modular yet complementary, ensuring smooth data flows, structured collaboration, and scalable automation. The functionality of the four host apps offers an integrated experience for running decentralized operations.
14
14
 
15
+ ![Powerhouse Host Apps Interaction](./images/PowerhouseArchitecture.png)
16
+
17
+
15
18
  ## How the Five Applications Work Together
16
19
 
17
20
  The Powerhouse ecosystem functions as a decentralized operating system, where each of the four core applications works in synergy to ensure seamless collaboration, structured data management, and automated workflows. Each application has a distinct purpose, yet their interconnectivity is what makes the system powerful.