Skip to content

Commit

Permalink
Added super admin guide (medplum#1554)
Browse files Browse the repository at this point in the history
  • Loading branch information
codyebberson authored Feb 18, 2023
1 parent 32a758a commit d9ce20c
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 17 deletions.
21 changes: 21 additions & 0 deletions packages/docs/docs/self-hosting/install-on-aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,24 @@ or
```bash
APP_BUCKET=app.example.com ./scripts/deploy-app.sh
```

## Upgrade the server

If using a custom Docker image, first build and deploy your image:

```bash
# Build and push using normal Docker commands
docker build . -t "$DOCKER_REPOSITORY:$TAG"
docker push "$DOCKER_REPOSITORY:$TAG"
```

To deploy the latest version to your AWS Fargate cluster, use the AWS CLI:

```bash
# Update the Medplum Fargate service
aws ecs update-service \
--region "$AWS_REGION" \
--cluster "$ECS_CLUSTER" \
--service "$ECS_SERVICE" \
--force-new-deployment
```
37 changes: 27 additions & 10 deletions packages/docs/docs/self-hosting/install-on-ubuntu.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,13 @@ Create a "medplum" database:
```PLpgSQL
CREATE DATABASE medplum;
GRANT ALL PRIVILEGES ON DATABASE medplum TO medplum;
\c medplum;
CREATE EXTENSION "uuid-ossp";
```

Create a "medplum_test" database:

```PLpgSQL
CREATE DATABASE medplum_test;
GRANT ALL PRIVILEGES ON DATABASE medplum_test TO medplum;
\c medplum_test;
CREATE EXTENSION "uuid-ossp";
```

Exit psql
Expand Down Expand Up @@ -84,10 +80,12 @@ Restart redis
sudo systemctl restart redis-server
```

Add the Node.js v16.x Ubuntu repository:
## Install Node.js

Add the Node.js v18.x Ubuntu repository:

```bash
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
```

Install NodeJS
Expand All @@ -96,20 +94,39 @@ Install NodeJS
sudo apt-get install nodejs
```

## Install Medplum
## Build Medplum

Clone the Medplum repository

```bash
git clone https://github.com/medplum/medplum.git
cd medplum
```

Run the build script
Install dependencies

```bash
cd medplum && ./scripts/build.sh
npm ci
```

(This will take a while. It downloads all dependencies, performs a full build, and runs all tests.)
Build the server and necessary dependencies

```bash
npm run build -- --filter=@medplum/server
```

## Run Medplum server

Update the server config at packages/server/medplum.config.json with your configuration

Run in development mode (from the `packages/server` directory):

```bash
npm run dev
```

Run in production mode (from the project root directory):

```bash
node packages/server/dist/index.js
```
56 changes: 56 additions & 0 deletions packages/docs/docs/self-hosting/super-admin-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
sidebar_position: 6
---

# Super Admin Guide

When self-hosting a Medplum server, you will have access to a "Super Admin" project. When you sign in as a member of the "Super Admin" project, you will have access to very powerful super admin privileges.

:::danger

Super admin features can cause unrepairable damage. Proceed with caution. With great power comes great responsibility!

:::

## Protected Resources

Medplum uses custom FHIR resource types to manage user accounts and project administration. While these are not official FHIR resources, Medplum uses the same FHIR semantics: the same RESTful operations, same search capabilities, `StructureDefinition` resources, `SearchParameter` resources, etc.

The most important custom resource types are:

- `User` - represents a user account capabale of logging into the system
- `Project` - represents a project which contains other resources
- `ProjectMembership` - link between a `User` and a `Project` which also defines `AccessPolicy` and `UserConfiguration`
- `Login` - an authentication event and session state

## Server Maintenance

From time to time, you may need to perform system level maintenance. The Medplum app has a special "Super Admin" page to make it easier to perform these tasks. You can find the "Super Admin" page at `/admin/super`.

:::note

In the future, we hope that most of this maintenance will be 100% automatic and behind the scenes. For now, it is important that you understand this maintenance for system health.

:::

### Rebuild Resources

In the "Super Admin" page, there are buttons and sections for:

- Rebuild Structure Definitions
- Rebuild Search Paramters
- Rebuild Value Sets

From time to time, Medplum will make changes to custom resources. The server runtime uses `StructureDefinition` and `SearchParameter` files directly from disk. However, the client requests `StructureDefinition` resources to dynamically generate client-side UI elements such as search filters, the "Details" page, and the "Edit" page. If a Medplum changes these resources, you may need to rebuild the index before you see the changes in the client.

### Reindex Resources

From time to time, Medplum makes changes to the underlying search indexing logic. This usually happens when adding support for new FHIR search capabilities. Resource indexes are updated automatically on every `create` or `update` operation. Use the "Reindex Resources" button to reindex existing resources.

### Purge Resources

Some system generated resources can accumulate and lead to degraded performance. Use the "Purge Resources" form to permanently delete resources from the database. Note that this operation is a true `DELETE`, and not the normal "soft delete", so this is permanent. Medplum recommends backing up all data, or synchronizing data to a data warehouse before using this feature.

### Force Set Password

User accounts are global, and can be members of multiple projects. Therefore, normal project administrators do not have access to "Set Password" functionality. Use the "Force Set Password" button to forcefully override a user's password.
4 changes: 0 additions & 4 deletions packages/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,13 @@ Create a "medplum" database:
```PLpgSQL
CREATE DATABASE medplum;
GRANT ALL PRIVILEGES ON DATABASE medplum TO medplum;
\c medplum;
CREATE EXTENSION "uuid-ossp";
```

Create a "medplum_test" database:

```PLpgSQL
CREATE DATABASE medplum_test;
GRANT ALL PRIVILEGES ON DATABASE medplum_test TO medplum;
\c medplum_test;
CREATE EXTENSION "uuid-ossp";
```

## Dev server:
Expand Down
3 changes: 0 additions & 3 deletions postgres/init_test.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
CREATE DATABASE medplum_test;
GRANT ALL PRIVILEGES ON DATABASE medplum_test TO medplum;
\c medplum_test;
CREATE EXTENSION "uuid-ossp";
\c medplum;

0 comments on commit d9ce20c

Please sign in to comment.