@powerhousedao/academy 5.0.0-staging.9 → 5.0.1-staging.2
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.
- package/.vscode/settings.json +1 -1
- package/CHANGELOG.md +400 -0
- package/README.md +3 -3
- package/babel.config.js +1 -1
- package/blog/BeyondCommunication-ABlueprintForDevelopment.md +25 -24
- package/blog/TheChallengeOfChange.md +21 -21
- package/docs/academy/01-GetStarted/00-ExploreDemoPackage.mdx +67 -30
- package/docs/academy/01-GetStarted/01-CreateNewPowerhouseProject.md +38 -21
- package/docs/academy/01-GetStarted/02-DefineToDoListDocumentModel.md +24 -19
- package/docs/academy/01-GetStarted/03-ImplementOperationReducers.md +44 -41
- package/docs/academy/01-GetStarted/04-BuildToDoListEditor.md +10 -10
- package/docs/academy/01-GetStarted/05-VetraStudio.md +164 -0
- package/docs/academy/01-GetStarted/06-ReactorMCP.md +58 -0
- package/docs/academy/01-GetStarted/home.mdx +185 -90
- package/docs/academy/01-GetStarted/images/Modules.png +0 -0
- package/docs/academy/01-GetStarted/images/VetraStudioDrive.png +0 -0
- package/docs/academy/01-GetStarted/styles.module.css +5 -5
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/01-Prerequisites.md +46 -18
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/02-StandardDocumentModelWorkflow.md +118 -68
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/03-BuilderTools.md +75 -33
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/_category_.json +6 -6
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/01-WhatIsADocumentModel.md +30 -21
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/02-SpecifyTheStateSchema.md +41 -37
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/03-SpecifyDocumentOperations.md +29 -25
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/04-UseTheDocumentModelGenerator.md +36 -37
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/05-ImplementDocumentReducers.md +128 -109
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/06-ImplementDocumentModelTests.md +95 -86
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/07-ExampleToDoListRepository.md +7 -9
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/_category_.json +6 -6
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/01-BuildingDocumentEditors.md +65 -47
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/02-ConfiguringDrives.md +77 -62
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/03-BuildingADriveExplorer.md +360 -349
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/00-DocumentToolbar.mdx +16 -10
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/01-OperationHistory.md +10 -7
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/02-RevisionHistoryTimeline.md +25 -17
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/_category_.json +6 -6
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/01-RenownAuthenticationFlow.md +14 -7
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/02-Authorization.md +0 -1
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/07-Authorization/_category_.json +5 -5
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/_category_.json +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/01-GraphQLAtPowerhouse.md +45 -33
- package/docs/academy/02-MasteryTrack/04-WorkWithData/02-UsingTheAPI.mdx +61 -18
- package/docs/academy/02-MasteryTrack/04-WorkWithData/03-UsingSubgraphs.md +50 -54
- package/docs/academy/02-MasteryTrack/04-WorkWithData/04-analytics-processor.md +126 -110
- package/docs/academy/02-MasteryTrack/04-WorkWithData/05-RelationalDbProcessor.md +75 -45
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/GraphQL References/QueryingADocumentWithGraphQL.md +23 -21
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/best-practices.md +9 -9
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/index.md +11 -23
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/graphql/integration.md +25 -9
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/intro.md +10 -10
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/benchmarks.md +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/index.md +16 -11
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/memory.md +6 -5
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/schema.md +2 -2
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/typescript/utilities.md +7 -5
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/maker.md +32 -58
- package/docs/academy/02-MasteryTrack/04-WorkWithData/06-Analytics Engine/use-cases/processors.md +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/07-drive-analytics.md +105 -71
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_01-SetupBuilderEnvironment.md +22 -0
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_02-CreateNewPowerhouseProject.md +9 -8
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_03-GenerateAnAnalyticsProcessor.md +28 -32
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_04-UpdateAnalyticsProcessor.md +25 -26
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_ARCHIVE-AnalyticsProcessorTutorial/_category_.json +1 -1
- package/docs/academy/02-MasteryTrack/04-WorkWithData/_category_.json +7 -7
- package/docs/academy/02-MasteryTrack/05-Launch/01-IntroductionToPackages.md +3 -4
- package/docs/academy/02-MasteryTrack/05-Launch/02-PublishYourProject.md +69 -45
- package/docs/academy/02-MasteryTrack/05-Launch/03-SetupEnvironment.md +70 -40
- package/docs/academy/02-MasteryTrack/05-Launch/04-ConfigureEnvironment.md +1 -0
- package/docs/academy/02-MasteryTrack/05-Launch/_category_.json +7 -7
- package/docs/academy/02-MasteryTrack/_category_.json +6 -6
- package/docs/academy/03-ExampleUsecases/Chatroom/02-CreateNewPowerhouseProject.md +5 -3
- package/docs/academy/03-ExampleUsecases/Chatroom/03-DefineChatroomDocumentModel.md +38 -37
- package/docs/academy/03-ExampleUsecases/Chatroom/04-ImplementOperationReducers.md +45 -41
- package/docs/academy/03-ExampleUsecases/Chatroom/05-ImplementChatroomEditor.md +14 -14
- package/docs/academy/03-ExampleUsecases/Chatroom/06-LaunchALocalReactor.md +6 -6
- package/docs/academy/03-ExampleUsecases/Chatroom/_category_.json +1 -1
- package/docs/academy/04-APIReferences/00-PowerhouseCLI.md +104 -43
- package/docs/academy/04-APIReferences/01-ReactHooks.md +177 -129
- package/docs/academy/04-APIReferences/04-RelationalDatabase.md +121 -113
- package/docs/academy/04-APIReferences/05-PHDocumentMigrationGuide.md +48 -41
- package/docs/academy/04-APIReferences/_category_.json +6 -6
- package/docs/academy/05-Architecture/00-PowerhouseArchitecture.md +1 -2
- package/docs/academy/05-Architecture/01-WorkingWithTheReactor.md +11 -8
- package/docs/academy/05-Architecture/05-DocumentModelTheory/_category_.json +1 -1
- package/docs/academy/05-Architecture/_category_.json +6 -6
- package/docs/academy/06-ComponentLibrary/00-DocumentEngineering.md +25 -23
- package/docs/academy/06-ComponentLibrary/02-CreateCustomScalars.md +105 -93
- package/docs/academy/06-ComponentLibrary/03-IntegrateIntoAReactComponent.md +1 -0
- package/docs/academy/06-ComponentLibrary/_category_.json +7 -7
- package/docs/academy/07-Cookbook.md +268 -35
- package/docs/academy/08-Glossary.md +7 -1
- package/docs/bookofpowerhouse/01-Overview.md +2 -2
- package/docs/bookofpowerhouse/02-GeneralFrameworkAndPhilosophy.md +1 -7
- package/docs/bookofpowerhouse/03-PowerhouseSoftwareArchitecture.md +10 -7
- package/docs/bookofpowerhouse/04-DevelopmentApproaches.md +10 -4
- package/docs/bookofpowerhouse/05-SNOsandANewModelForOSSandPublicGoods.md +23 -30
- package/docs/bookofpowerhouse/06-SNOsInActionAndPlatformEconomies.md +0 -7
- package/docusaurus.config.ts +64 -66
- package/package.json +9 -7
- package/scripts/generate-combined-cli-docs.ts +43 -13
- package/sidebars.ts +2 -0
- package/src/components/HomepageFeatures/index.tsx +171 -78
- package/src/components/HomepageFeatures/styles.module.css +1 -2
- package/src/css/custom.css +89 -89
- package/src/pages/_archive-homepage.tsx +17 -16
- package/src/theme/DocCardList/index.tsx +9 -8
- package/static.json +6 -6
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
# Environment setup guide
|
|
2
2
|
|
|
3
3
|
## Introduction
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
Powerhouse is a powerful platform that helps you manage and deploy your applications efficiently.
|
|
5
6
|
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.
|
|
6
7
|
|
|
7
8
|
## Prerequisites
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
|
|
10
|
+
Before you begin, ensure you have a Linux-based system (Ubuntu or Debian recommended), sudo privileges, and a stable internet connection.
|
|
11
|
+
These are essential for the installation and configuration process.
|
|
12
|
+
The system should have at least 1GB of RAM and 10GB of free disk space for optimal performance.
|
|
11
13
|
While these are minimum requirements, more resources will provide better performance, especially when running multiple services.
|
|
12
14
|
|
|
13
15
|
Also make sure you have your preferred domain registered and created subdomains for your Connect & Switchboard instances.
|
|
@@ -68,8 +70,9 @@ It will take a minute or two for your Droplet to be provisioned. Once it's ready
|
|
|
68
70
|
|
|
69
71
|
To log in via SSH:
|
|
70
72
|
|
|
71
|
-
1. Open a terminal (on macOS/Linux) or an SSH client like PuTTY (on Windows). You can also use Digital Ocean's web 'Console'.
|
|
73
|
+
1. Open a terminal (on macOS/Linux) or an SSH client like PuTTY (on Windows). You can also use Digital Ocean's web 'Console'.
|
|
72
74
|
2. Use one of these commands:
|
|
75
|
+
|
|
73
76
|
```bash
|
|
74
77
|
# If using password authentication
|
|
75
78
|
ssh root@YOUR_DROPLET_IP
|
|
@@ -161,6 +164,7 @@ Now your Droplet is running! Now you can continue with the Powerhouse tutorial o
|
|
|
161
164
|
### Verify configuration
|
|
162
165
|
|
|
163
166
|
1. Use DNS lookup tools to verify your records:
|
|
167
|
+
|
|
164
168
|
```bash
|
|
165
169
|
dig +short yourdomain.com
|
|
166
170
|
dig +short www.yourdomain.com
|
|
@@ -181,26 +185,25 @@ This tutorial will guide you through the process of assigning a static IP (Elast
|
|
|
181
185
|
|
|
182
186
|
**Current Date:** May 15, 2024
|
|
183
187
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
188
|
+
- Make sure your region is set to eu-west-1 (Ireland)
|
|
189
|
+
- Name your instance something like `cloud-server` or your project's name
|
|
190
|
+
- Select Ubuntu 24.04 LTS
|
|
191
|
+
- Architecture 64-bit (x86)
|
|
192
|
+
- Scroll down to Instance type and select t2.medium (recommended)
|
|
193
|
+
- 2 vCPUs and 4 GiB of memory are the recommended minimum specs
|
|
194
|
+
- For larger projects or higher load, consider t2.large or t2.xlarge
|
|
195
|
+
- 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.
|
|
196
|
+
- Configure the security group to allow inbound traffic:
|
|
197
|
+
- SSH (Port 22) from your IP address
|
|
198
|
+
- HTTP (Port 80) from anywhere
|
|
199
|
+
- HTTPS (Port 443) from anywhere
|
|
200
|
+
- Custom TCP (Port 8442) for Connect
|
|
201
|
+
- Custom TCP (Port 8441) for Switchboard
|
|
202
|
+
- **Launch the instance**
|
|
203
|
+
|
|
204
|
+
:::warning
|
|
205
|
+
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.
|
|
206
|
+
:::
|
|
204
207
|
|
|
205
208
|
## Part 1: Assigning a static IP to EC2 instance
|
|
206
209
|
|
|
@@ -302,6 +305,7 @@ This tutorial will guide you through the process of assigning a static IP (Elast
|
|
|
302
305
|
### Verify configuration
|
|
303
306
|
|
|
304
307
|
1. Use DNS lookup tools to verify your records:
|
|
308
|
+
|
|
305
309
|
```bash
|
|
306
310
|
dig +short yourdomain.com
|
|
307
311
|
dig +short www.yourdomain.com
|
|
@@ -322,33 +326,38 @@ The `install` script provides a streamlined way to install the Powerhouse CLI to
|
|
|
322
326
|
### Installation
|
|
323
327
|
|
|
324
328
|
1. Run the setup script:
|
|
329
|
+
|
|
325
330
|
```bash
|
|
326
331
|
curl -fsSL https://apps.powerhouse.io/install | bash # for macOS, Linux, and WSL
|
|
327
332
|
```
|
|
328
333
|
|
|
329
334
|
2. After installation, source your shell configuration:
|
|
335
|
+
|
|
330
336
|
```bash
|
|
331
337
|
source ~/.bashrc # or source ~/.zshrc if using zsh
|
|
332
338
|
```
|
|
333
339
|
|
|
334
340
|
3. Verify that the Powerhouse CLI is ready to be installed in the next step:
|
|
341
|
+
|
|
335
342
|
```bash
|
|
336
343
|
ph --version
|
|
337
344
|
```
|
|
345
|
+
|
|
338
346
|
You will see that `ph-cli` is not yet installed. This is expected, as it will be installed by the service setup command.
|
|
339
347
|
|
|
340
|
-
4.
|
|
348
|
+
4. Create a project with `ph-init <projectname>`.
|
|
341
349
|
|
|
342
|
-
5.
|
|
350
|
+
5. After creation, move into the project with `cd <projectname>`.
|
|
343
351
|
|
|
344
|
-
Up next is the configurations of your services.
|
|
352
|
+
Up next is the configurations of your services.
|
|
345
353
|
|
|
346
354
|
### Service configuration
|
|
347
355
|
|
|
348
|
-
Next, run
|
|
356
|
+
Next, run
|
|
357
|
+
|
|
349
358
|
```bash
|
|
350
359
|
ph service setup
|
|
351
|
-
```
|
|
360
|
+
```
|
|
352
361
|
|
|
353
362
|
Follow the interactive prompts. This command installs the Powerhouse services (Connect and Switchboard) and guides you through their configuration.
|
|
354
363
|
|
|
@@ -363,22 +372,29 @@ PM2 is configured to automatically restart services if they crash and to start t
|
|
|
363
372
|
The setup command will prompt you for the following information:
|
|
364
373
|
|
|
365
374
|
#### Package installation
|
|
375
|
+
|
|
366
376
|
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.
|
|
367
377
|
|
|
368
378
|
#### Database configuration
|
|
379
|
+
|
|
369
380
|
The script offers two options for database configuration:
|
|
370
|
-
|
|
371
|
-
|
|
381
|
+
|
|
382
|
+
- **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.
|
|
383
|
+
- **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.
|
|
372
384
|
|
|
373
385
|
#### SSL configuration
|
|
386
|
+
|
|
374
387
|
For SSL configuration, you have two choices:
|
|
375
|
-
|
|
376
|
-
|
|
388
|
+
|
|
389
|
+
- **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.
|
|
390
|
+
- **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.
|
|
377
391
|
|
|
378
392
|
#### Domain setup
|
|
393
|
+
|
|
379
394
|
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.
|
|
380
395
|
|
|
381
396
|
#### Security features
|
|
397
|
+
|
|
382
398
|
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.
|
|
383
399
|
|
|
384
400
|
## 2. Verifying the setup
|
|
@@ -386,47 +402,56 @@ Security is a top priority. The script implements automatic SSL certificate mana
|
|
|
386
402
|
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.
|
|
387
403
|
|
|
388
404
|
1. Check service status of switchboard and connect:
|
|
405
|
+
|
|
389
406
|
```bash
|
|
390
407
|
ph service status
|
|
391
408
|
```
|
|
409
|
+
|
|
392
410
|
You can also use
|
|
393
411
|
|
|
394
412
|
```bash
|
|
395
|
-
ph service start | stop | restart
|
|
413
|
+
ph service start | stop | restart
|
|
396
414
|
```
|
|
415
|
+
|
|
397
416
|
to start | stop | restart switchboard and connect
|
|
398
417
|
|
|
399
418
|
2. View Nginx configuration:
|
|
419
|
+
|
|
400
420
|
```bash
|
|
401
421
|
sudo nginx -t
|
|
402
422
|
```
|
|
403
423
|
|
|
404
424
|
3. Check SSL certificates:
|
|
425
|
+
|
|
405
426
|
```bash
|
|
406
427
|
sudo certbot certificates # if using Let's Encrypt
|
|
407
428
|
```
|
|
408
429
|
|
|
409
430
|
## 3. Accessing the services
|
|
410
431
|
|
|
411
|
-
Once everything is set up, you can access your services through the configured domains.
|
|
432
|
+
Once everything is set up, you can access your services through the configured domains.
|
|
412
433
|
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.
|
|
413
434
|
|
|
414
435
|
### With Let's Encrypt
|
|
436
|
+
|
|
415
437
|
- Connect: `https://connect.yourdomain.com`
|
|
416
438
|
- Switchboard: `https://switchboard.yourdomain.com`
|
|
417
439
|
|
|
418
440
|
### With self-signed certificate
|
|
441
|
+
|
|
419
442
|
- Connect: `https://your-hostname/connect`
|
|
420
443
|
- Switchboard: `https://your-hostname/switchboard`
|
|
421
444
|
|
|
422
445
|
## 4. Troubleshooting
|
|
423
446
|
|
|
424
|
-
When issues arise, there are several common problems you might encounter.
|
|
425
|
-
|
|
426
|
-
-
|
|
447
|
+
When issues arise, there are several common problems you might encounter.
|
|
448
|
+
|
|
449
|
+
- The "`ph`: command not found" error usually means you need to source your shell configuration file.
|
|
450
|
+
- Nginx configuration errors can be investigated through the error logs, and service issues can be diagnosed using PM2 logs.
|
|
427
451
|
- 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.
|
|
428
452
|
|
|
429
453
|
### Common issues
|
|
454
|
+
|
|
430
455
|
1. **"`ph`: command not found"**
|
|
431
456
|
- Run `source ~/.bashrc` or restart your terminal
|
|
432
457
|
- Verify that the `PNPM_HOME` environment variable is set correctly
|
|
@@ -452,16 +477,19 @@ When issues arise, there are several common problems you might encounter.
|
|
|
452
477
|
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.
|
|
453
478
|
|
|
454
479
|
### Updating services
|
|
480
|
+
|
|
455
481
|
```bash
|
|
456
482
|
ph update <package-name>
|
|
457
483
|
```
|
|
458
484
|
|
|
459
485
|
### Restarting services
|
|
486
|
+
|
|
460
487
|
```bash
|
|
461
488
|
ph service restart
|
|
462
489
|
```
|
|
463
490
|
|
|
464
491
|
### Checking service status and logs
|
|
492
|
+
|
|
465
493
|
```bash
|
|
466
494
|
ph service status
|
|
467
495
|
```
|
|
@@ -475,11 +503,13 @@ Maintaining security is an ongoing process. It's essential to keep your database
|
|
|
475
503
|
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.
|
|
476
504
|
|
|
477
505
|
### Database backup
|
|
506
|
+
|
|
478
507
|
```bash
|
|
479
508
|
pg_dump -U powerhouse -d powerhouse > backup.sql
|
|
480
509
|
```
|
|
481
510
|
|
|
482
511
|
### Configuration backup
|
|
512
|
+
|
|
483
513
|
```bash
|
|
484
514
|
sudo tar -czf powerhouse-config.tar.gz /etc/powerhouse/
|
|
485
515
|
```
|
|
@@ -501,4 +531,4 @@ If you encounter issues or need assistance, there are several resources availabl
|
|
|
501
531
|
1. **Documentation**: Check the official Powerhouse documentation for detailed information.
|
|
502
532
|
2. **Community**: Join the Powerhouse community forums or chat channels.
|
|
503
533
|
3. **Support**: Contact Powerhouse support for professional assistance.
|
|
504
|
-
4. **GitHub**: Report issues or contribute to the project on GitHub.
|
|
534
|
+
4. **GitHub**: Report issues or contribute to the project on GitHub.
|
|
@@ -100,6 +100,7 @@ PH_CONNECT_CLI_VERSION=""
|
|
|
100
100
|
APP_VERSION=""
|
|
101
101
|
SENTRY_RELEASE=""
|
|
102
102
|
```
|
|
103
|
+
|
|
103
104
|
You can find the most up-to-date list of variables in the source repository: [https://github.com/powerhouse-inc/powerhouse/blob/main/apps/connect/.env](https://github.com/powerhouse-inc/powerhouse/blob/main/apps/connect/.env)
|
|
104
105
|
|
|
105
106
|
## Using a configuration file
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
"label": "Launch",
|
|
3
|
+
"position": 6,
|
|
4
|
+
"link": {
|
|
5
|
+
"type": "generated-index",
|
|
6
|
+
"description": "Package & publish your project. Launch your backend and frontend."
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
"label": "Mastery track",
|
|
3
|
+
"link": {
|
|
4
|
+
"type": "generated-index",
|
|
5
|
+
"description": "A set of tutorials that support the creation of more complex Powerhouse documents, drive apps and packages."
|
|
6
|
+
}
|
|
7
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Create New Powerhouse Project
|
|
2
2
|
|
|
3
|
-
:::tip
|
|
3
|
+
:::tip **Prerequisites**
|
|
4
|
+
|
|
4
5
|
- Powerhouse CLI installed: `pnpm install -g ph-cmd`
|
|
5
6
|
- node.js 22 and pnpm installed
|
|
6
7
|
- Visual Studio Code (or your preferred IDE)
|
|
@@ -16,6 +17,7 @@ This command will create a new project in the current directory. You can run the
|
|
|
16
17
|
mkdir ph-projects
|
|
17
18
|
cd ph-projects
|
|
18
19
|
```
|
|
20
|
+
|
|
19
21
|
This essentially opens that folder and places you in it.
|
|
20
22
|
|
|
21
23
|
Once you've navigated to the directory where you want to create the new project and in your terminal, run the following command:
|
|
@@ -24,13 +26,13 @@ Once you've navigated to the directory where you want to create the new project
|
|
|
24
26
|
ph init
|
|
25
27
|
```
|
|
26
28
|
|
|
27
|
-
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.
|
|
29
|
+
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.
|
|
28
30
|
|
|
29
31
|
```bash
|
|
30
32
|
you@yourmachine:~/Powerhouse$ ph init
|
|
31
33
|
|
|
32
34
|
? What is the project name? ‣ ChatRoom
|
|
33
|
-
```
|
|
35
|
+
```
|
|
34
36
|
|
|
35
37
|
Once the project is created, you will see the following output:
|
|
36
38
|
|
|
@@ -18,34 +18,34 @@ This schema contains the data structure of the document model and the basic oper
|
|
|
18
18
|
```graphql
|
|
19
19
|
# Defines a GraphQL type for the state of the chatroom document
|
|
20
20
|
type ChatRoomState {
|
|
21
|
-
id: OID!
|
|
22
|
-
name: String!
|
|
23
|
-
description: String
|
|
24
|
-
createdAt: DateTime!
|
|
25
|
-
createdBy: ID!
|
|
26
|
-
messages: [Message!]!
|
|
21
|
+
id: OID! # Unique identifier for the chat-room
|
|
22
|
+
name: String! # Name of the chat-room
|
|
23
|
+
description: String # Optional description of the chat-room
|
|
24
|
+
createdAt: DateTime! # Timestamp of when the chat-room was created
|
|
25
|
+
createdBy: ID! # Agent ID of the user who created the chat-room
|
|
26
|
+
messages: [Message!]! # List of messages in the chat-room
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
# Defines a GraphQL type for the state of a message
|
|
30
30
|
type Message {
|
|
31
|
-
id: OID!
|
|
32
|
-
sender: Sender!
|
|
33
|
-
content: String
|
|
34
|
-
sentAt: DateTime!
|
|
35
|
-
reactions: [Reaction!]
|
|
31
|
+
id: OID! # Unique identifier for the message
|
|
32
|
+
sender: Sender! # Agent details of the message sender
|
|
33
|
+
content: String # Message content
|
|
34
|
+
sentAt: DateTime! # Timestamp of when the message was sent
|
|
35
|
+
reactions: [Reaction!] # Reactions to the message
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
# Defines a GraphQL type for the state of a sender
|
|
39
39
|
type Sender {
|
|
40
|
-
id: ID!
|
|
40
|
+
id: ID! # Unique identifier for the sender
|
|
41
41
|
name: String
|
|
42
|
-
avatarUrl: URL
|
|
42
|
+
avatarUrl: URL # Allows us to pull the ENS and/or nft of the persons profile
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
# Defines a GraphQL type for the state of a reaction to a message
|
|
46
46
|
type Reaction {
|
|
47
|
-
type: ReactionType!
|
|
48
|
-
reactedBy: [ID!]!
|
|
47
|
+
type: ReactionType! # Type of reaction (one of the predefined emoji)
|
|
48
|
+
reactedBy: [ID!]! # Agent ID of the user who reacted
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
# Defines the various predefined emojis to react to a message
|
|
@@ -64,22 +64,22 @@ enum ReactionType {
|
|
|
64
64
|
# add_message
|
|
65
65
|
|
|
66
66
|
input AddMessageInput {
|
|
67
|
-
messageId: OID!
|
|
68
|
-
sender: Sender!
|
|
69
|
-
content: String!
|
|
67
|
+
messageId: OID! # ID of the message that is being added
|
|
68
|
+
sender: Sender! # ID of the user sending the message
|
|
69
|
+
content: String! # Content of the message
|
|
70
70
|
sentAt: DateTime!
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
input AddEmojiReactionInput {
|
|
74
|
-
messageId: OID!
|
|
75
|
-
reactedBy: ID!
|
|
76
|
-
type: ReactionType!
|
|
74
|
+
messageId: OID! # ID of the message to which the reaction is being added
|
|
75
|
+
reactedBy: ID! # ID of the user adding the reaction
|
|
76
|
+
type: ReactionType! # Type of the reaction (emoji)
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
input RemoveEmojiReactionInput {
|
|
80
|
-
messageId: OID!
|
|
81
|
-
senderId: ID!
|
|
82
|
-
type: ReactionType!
|
|
80
|
+
messageId: OID! # ID of the message to which the reaction is being removed
|
|
81
|
+
senderId: ID! # ID of the user that is removing the reaction
|
|
82
|
+
type: ReactionType! # Type of the reaction (emoji)
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
input EditChatNameInput {
|
|
@@ -93,18 +93,19 @@ input EditChatDescriptionInput {
|
|
|
93
93
|
|
|
94
94
|
## Define the document model
|
|
95
95
|
|
|
96
|
-
To be able to define the document model, you need to open the Chatroom document model editor in Connect.
|
|
96
|
+
To be able to define the document model, you need to open the Chatroom document model editor in Connect.
|
|
97
97
|
|
|
98
98
|
The steps below show you how to do this:
|
|
99
99
|
|
|
100
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.
|
|
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.
|
|
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.
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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.
|
|
104
|
+
|
|
105
|
+

|
|
106
|
+
|
|
107
|
+
3. In the code editor, you can see the SDL for the document model. Replace the existing SDL with the SDL defined in the [State Schema](#state-schema) section above. Only copy and paste the types, leaving the inputs for the next step. You can however already press 'Sync with schema' button to set the initial state of your document model based on your Schema Definition Language. Verify that your Global State Initial Value looks like this.
|
|
106
108
|
|
|
107
|
-
3. In the code editor, you can see the SDL for the document model. Replace the existing SDL with the SDL defined in the [State Schema](#state-schema) section above. Only copy and paste the types, leaving the inputs for the next step. You can however already press 'Sync with schema' button to set the initial state of your document model based on your Schema Definition Language. Verify that your Global State Initial Value looks like this.
|
|
108
109
|
```graphql
|
|
109
110
|
{
|
|
110
111
|
"id": "",
|
|
@@ -121,17 +122,17 @@ The steps below show you how to do this:
|
|
|
121
122
|
6. Inside the **'Add operation'** field, type **'ADD_MESSAGE'** and press enter. A small editor will appear under with an empty input type that you have to fill. Copy the first input type from the [Operations Schema](#operations-schema) section and paste it in the editor. The editor should look like this:
|
|
122
123
|
|
|
123
124
|
```graphql
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
125
|
+
input AddMessageInput {
|
|
126
|
+
messageId: OID! # ID of the message that is being added
|
|
127
|
+
sender: Sender! # ID of the user sending the message
|
|
128
|
+
content: String! # Content of the message
|
|
129
|
+
sentAt: DateTime!
|
|
130
|
+
}
|
|
130
131
|
```
|
|
131
132
|
|
|
132
133
|
7. Repeat step 6 for the other input operations based on the [Operations Schema](#operations-schema). If you noticed, you only need to add the name `(ADD_EMOJI_REACTION, EDIT_CHAT_NAME, etc)` of the operation without the `input` suffix. Then it will be generated once you press enter.
|
|
133
134
|
8. Let's just add a couple more reducer exceptions to the `ADD_MESSAGE` operation which we'll be using later to avoid empty messages or messages exceeding a maximum lenght. Add `MessageContentCannotBeEmpty` and `MessageContentExceedsTheMaximumLenght` to the reducer exceptions of `ADD_MESSAGE`
|
|
134
|
-
|
|
135
|
+
9. Once you have added all the input operations, click on the `Export` button, at the top right of the editor, to save the document model on your local machine. Ideally you already save your file in the root of your powerhouse project on your machine.
|
|
135
136
|
|
|
136
137
|
Check the screenshot below to verify the complete implementation:
|
|
137
138
|
|