Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build docs #69

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 53 additions & 8 deletions docs/Building.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ and running the server.
For development or other running configurations, refer to
[Notes On Development] and [Running Docker Image].

## Prerequisites

You will need the following installed on your system/server:

* Git
* NodeJS

## Build Instructions

The application is a [NodeJS]/[ExpressJS]/[TypeScript] application so the
Expand All @@ -18,7 +25,7 @@ npm run build

## Running

For testing and simple opertion, you can run Iamus in the build directory.
For testing and simple operation, you can run Iamus in the build directory.
Say you want to build and run Iamus in the directory IBASE. The steps are:

```sh
Expand All @@ -40,7 +47,7 @@ Refer to [Running Docker Image] for instructions.

For connecting domain-servers to the Iamus metaverse-server,
you must point any domain-servers (Vircadia) at this
metaverse server. This is accomplished by setting the `HIFI_METAVERSE_URL`:
metaverse server. This is accomplished by setting the `HIFI_METAVERSE_URL` environment variable:

```sh
export HIFI_METAVERSE_URL=http://HOSTADDRESS:9400
Expand Down Expand Up @@ -71,7 +78,7 @@ current package and build version. The format of the file is:
}
```

`version-tag` combines the NPM package version, the date of build, and
`version-tag` combines the NPM package version, the date of the build, and
the GIT commit version and is used to tag the Docker image.

The version information is also read and added to the configuration
Expand All @@ -81,15 +88,15 @@ data structure (for use by the application) and added to the
## Configuration

The server parameters are all specified in `config.ts`. These default
values are overlayed with environment variables and then overlayed with
values are overlaid with environment variables and then overlaid with
the contents of a configuration file.

The environment variables are:

- IAMUS_LOGLEVEL: logging level. One of 'error', 'info', 'warn', 'debug'. Default 'info'.
- IAMUS_LISTEN_HOST: host to listen for requests on. Default '0.0.0.0'.
- IAMUS_LISTEN_PORT: port to listen for requests on. Default 9400.
- IAMUS_EXTERNAL_HOSTNAME: hostname to report as referencing back to this server. This is mostly used by ActivityPub for links to users. Default 'localhost'. This value MUST be set for proper metavserse-server operation.
- IAMUS_EXTERNAL_HOSTNAME: hostname to report as referencing back to this server. This is mostly used by ActivityPub for links to users. Default 'localhost'. This value MUST be set for proper metaverse-server operation.
- IAMUS_CONFIG_FILE: filename or URL of a JSON formatted configuration file that over-rides the values. Default "./iamus.json".

The configuration file, if it exists, is read and its values overlay
Expand Down Expand Up @@ -139,6 +146,8 @@ All the configuration parameter default values are defined in `src/config.ts`.

## Setup MongoDB

### Install on Linux

Install MongoDb following the instructions at https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/ :

```sh
Expand All @@ -165,8 +174,8 @@ use admin
db.createUser({user:"cadiauser", pwd: "LONGPASSWORD3", roles: [{ role: "readWrite", db: "domainstore" }]})
```

Where, if course, "LONGPASSWORD*" is a collection of random letter and numbers.
This creates account "adminer" for DB administration, "backuper" for doing backups
Where, of course, "LONGPASSWORD*" is a collection of random letter and numbers to use as a password.
This creates an account "adminer" for DB administration, "backuper" for doing backups
and "cadiauser" to be the database user for the domain-server.
The database is "domainstore".

Expand All @@ -179,6 +188,42 @@ security:

then do `sudo systemctl restart mongod`.

### Install on Windows

Install MongoDb following the instructions at https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/ :

```sh
"C:\Program Files\MongoDB\Server\4.4\bin\mongo.exe"
db.disableFreeMonitoring()
```

Turn on authentication and create some users for our instance:

```sh
"C:\Program Files\MongoDB\Server\4.4\bin\mongo.exe"
use admin
db.createUser({user:"adminer", pwd: "LONGPASSWORD1", roles: [ "root" ]})
use admin
db.createUser({user:"backuper", pwd: "LONGPASSWORD2", roles: [ "backup" ]})
use admin
db.createUser({user:"cadiauser", pwd: "LONGPASSWORD3", roles: [{ role: "readWrite", db: "domainstore" }]})
```

Where, of course, "LONGPASSWORD*" is a collection of random letter and numbers to use as a password.
This creates an account "adminer" for DB administration, "backuper" for doing backups
and "cadiauser" to be the database user for the domain-server.
The database is "domainstore".

After doing the above creation steps, edit `<install directory>\bin\mongod.cfg` and add:

```
security:
authorization: enabled
```

In Windows PowerShell, restart the service by running
`Restart-Service MongoDB -force`.

## Logging

My default, Iamus logs to a file named `iamus.log` in the directory `./logs`.
Expand All @@ -194,7 +239,7 @@ These parameters can be changed with the config file.
| debug.log-max-size-megabytes | 100 | the maximum size of the individual log files |
| debug.log-max-files | 10 | number of old log files to keep |
| debug.log-compress | false | if to compress old versions of the log files |
| debug.log-to-console | false | whether to additionlly log to the console |
| debug.log-to-console | false | whether to additionally log to the console |

When running with Docker, one often changes the logging directory to point
into a mounted volume for easy reference.
Expand Down
8 changes: 4 additions & 4 deletions docs/Design.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ the database. This two step process is done with:
This sample takes the authorization of the requestor, the account being changed, the external
name of the field being set, and the value being set.
The extra parameters passing the AccountEntity that goes with the authorization token (this is
optional but saves a database lookup if supplied) and a VKeyedCollection that has the
optional but saves a database lookup if supplied) and a VKeyedCollection that has the
database information that needs to be updated for this set operation.
Ths update information is then passed
This update information is then passed .

This system of field getting and setting is implmented with field definitions
This system of field getting and setting is implemented with field definitions
that are attached to the entity definition.
Each field in an Entity has a `FieldDefn` definition that gives its internal
and external name and the routines to use to validate and update the field.
Expand Down Expand Up @@ -108,7 +108,7 @@ The functions `getter` and `setter` are the operations that get and set the fiel
Of course, the setter presumes the set value has passed the validation. These function definitions
accept and return type "any" so the callers need to know what they want/expect.

## Other Implimentation Nodes
## Other Implementation Nodes

BEWARE! All "entity" classes are really just Objects that are read out
of the database. Even though they are defined as classes, when read from the
Expand Down
2 changes: 1 addition & 1 deletion docs/TestSetup.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Iamus Test Setup
# Iamus Test Setup (outdated)

**TL:DR version**: a test metaverse using the latest
Iamus and Vircadia
Expand Down
2 changes: 1 addition & 1 deletion src/routes/users/username.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const procGetUserProfile: RequestHandler = async (req: Request, resp: Response,
const dashboardURL = Config.metaverse["dashboard-url"];
const metaverseURL = encodeURIComponent(Config.metaverse["metaverse-server-url"]);
const username = encodeURIComponent(req.vUsername);
const redirectionURL = `${dashboardURL}?metaverse=${metaverseURL}&page=user/profile&user=${username}`;
const redirectionURL = `${dashboardURL}?metaverse=${metaverseURL}&page=profile/${username}`;
resp.statusCode = HTTPStatusCode.Found;
resp.setHeader('Location', redirectionURL),
resp.setHeader('content-type', 'text/html');
Expand Down