Skip to content

Commit

Permalink
chore: update docs to include development environment setup
Browse files Browse the repository at this point in the history
  • Loading branch information
psanders committed Dec 4, 2023
1 parent 47110df commit 4923e6f
Show file tree
Hide file tree
Showing 8 changed files with 274 additions and 52 deletions.
20 changes: 10 additions & 10 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
# General config
APP_URL=http://localhost:8080
LOGS_LEVEL=info
LOGS_LEVEL=verbose

# Initial store owner credentials
# The server will create a new owner if the email does not exist
# The password will be updated if the email exists
OWNER_EMAIL=admin@localhost.local
OWNER_EMAIL=admin@goodtok.local
OWNER_PASSWORD=changeme

# SMTP config
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_SECURE=true
SMTP_AUTH_USER=postmaster@mail.example.com
SMTP_HOST=localhost
SMTP_PORT=1025
SMTP_SECURE=false
SMTP_AUTH_USER=postmaster@goodtok.local
SMTP_AUTH_PASS=secret
SMTP_SENDER=Goodtok Info <info@mail.example.com>
SMTP_SENDER=Goodtok Info <info@goodtok.local>

# SIP signaling config
DOCKER_HOST_ADDRESS=/* The public IP address of your Docker host */
SIP_DOMAIN=sip.goodtok.io
SIP_SIGNALING_SERVER=ws://sip.goodtok.io:5062
SIP_SIGNALING_SERVER=ws:/* The public IP address of your Docker host */:5062
SIP_DOMAIN=sip.goodtok.local

# Database and encryption config
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
DATABASE_URL=postgresql://postgres:postgres@postgres:5432/goodtok
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/goodtok
CLOAK_ENCRYPTION_KEY=/* Generate a new key with cloack cli or https://cloak.47ng.com/ */
19 changes: 12 additions & 7 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,11 @@ tasks:
APP_URL=$(gp url 8080)
SIP_SIGNALING_SERVER=$(gp url 5062 | sed 's/http/ws/g')
cp .env.example .env
sed -i "s|LOGS_LEVEL=.*|LOGS_LEVEL=verbose|g" .env
sed -i "s|APP_URL=.*|APP_URL=$APP_URL|g" .env
sed -i "s|CLOAK_ENCRYPTION_KEY=.*|CLOAK_ENCRYPTION_KEY=$CLOAK_ENCRYPTION_KEY|g" .env
sed -i "s|SIP_SIGNALING_SERVER=.*|SIP_SIGNALING_SERVER=$SIP_SIGNALING_SERVER|g" .env
sed -i "s|postgresql://postgres:postgres@postgres:5432/goodtok|postgresql://postgres:postgres@localhost:5432/goodtok|g" .env
sed -i "s|DOCKER_HOST_ADDRESS=.*|DOCKER_HOST_ADDRESS=$(gp url 5062 | sed 's|https://||')|g" .env
sed -i "s|SMTP_HOST=.*|SMTP_HOST=localhost|g" .env
sed -i "s|SMTP_PORT=.*|SMTP_PORT=1025|g" .env
sed -i "s|SMTP_SECURE=.*|SMTP_SECURE=false|g" .env
sed -i "s|SMTP_AUTH_USER=.*|SMTP_AUTH_USER=postmaster@localhost.local|g" .env
sed -i "s|SMTP_AUTH_PASS=.*|SMTP_AUTH_PASS=secret|g" .env
sed -i "s|SMTP_SENDER=.*|SMTP_SENDER=Goodtok Info <info@localhost.local>|g" .env
npm uninstall @47ng/cloak
npm install
npm run build
Expand Down Expand Up @@ -99,3 +92,15 @@ ports:
- port: 6789
visibility: public
onOpen: ignore
- port: 1025
visibility: private
onOpen: ignore
- port: 5063
visibility: private
onOpen: ignore
- port: 4222
visibility: private
onOpen: ignore
- port: 5432
visibility: private
onOpen: ignore
19 changes: 1 addition & 18 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
# How to contribute

There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on
top of things.

## Getting Started

* Fork the repository
* Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, we need a test!
* Run the tests. We only take pull requests with passing tests

## Submitting Changes

* Push your changes to your fork
* Submit a pull request

# Additional Resources

* [General GitHub documentation](http://help.github.com/)
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
To learn how to contribute to this project, please visit our [documentation](https://goodtok.io/docs/contributing) site.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,26 @@ Then, create a `.env` file with the following content:
```bash
# General config
APP_URL=http://localhost:8080
LOG_LEVEL=info
LOGS_LEVEL=verbose

# Initial store owner credentials
# The server will create a new owner if the email does not exist
# The password will be updated if the email exists
OWNER_EMAIL=admin@localhost.local
OWNER_EMAIL=admin@goodtok.local
OWNER_PASSWORD=changeme

# SMTP config
SMTP_HOST=smtp.example.com
SMTP_AUTH_USER=postmaster@mail.example.com
SMTP_HOST=localhost
SMTP_PORT=1025
SMTP_SECURE=false
SMTP_AUTH_USER=postmaster@goodtok.local
SMTP_AUTH_PASS=secret
SMTP_SENDER=Goodtok Info <info@mail.example.com>
SMTP_SENDER=Goodtok Info <info@goodtok.local>

# SIP signaling config
DOCKER_HOST_ADDRESS=/* The public IP address of your Docker host */
SIP_DOMAIN=sip.goodtok.io
SIP_SIGNALING_SERVER=ws://localhost:5062
SIP_SIGNALING_SERVER=ws:/* The public IP address of your Docker host */:5062
SIP_DOMAIN=sip.goodtok.local

# Database and encryption config
POSTGRES_USER=postgres
Expand Down
92 changes: 92 additions & 0 deletions docs/docs/contributing/development-environment-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Development environment setup

We welcome contributions from the community. This guide will help you get started with your development environment.

## Using Gitpod

The fastest way to get started is using [Gitpod](https://gitpod.io/). With a single click, you can start a fully functional development environment with all the tools you need already pre-installed.

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/fonoster/goodtok)

This will start a workspace with all the dependencies installed and instances of the API Server, Front Office, and Widget running. The workspace should automatically open the Front Office, Widget, and the Mailhog UI. If not, you can open them manually by going to the `Ports` tab and clicking on the `Open Browser` button.

⚠️ **We have an outstanding issue to make calls using this setup**

## Local setup

### Prerequisites

- [Docker](https://docs.docker.com/get-docker/)
- [Docker Compose](https://docs.docker.com/compose/install/)
- [Node.js](https://nodejs.org/en/download/)
- [NPM](https://www.npmjs.com/get-npm)

Once you have the prerequisites installed, you can clone the repository and install the dependencies:

```bash
git clone https://github.com/fonoster/goodtok
cd goodtok
npm install
npm run build
mkdir -p .keys
openssl genpkey -algorithm RSA -out ./.keys/private.key -pkeyopt rsa_keygen_bits:4096
openssl rsa -in ./.keys/private.key -pubout -out ./.keys/public.key
```

### Running the project

To run the project, you need to start the dependencies services, then the backend, and finally the frontend and Widget.

#### Starting the dependencies

```bash
docker-compose -f compose.yaml -f compose.dev.yaml up mailhog nats routr postgres adminer -d
```

The previous command will start the services in the background. If you want to see the logs, you can remove the `-d` flag.

It is important to highlight that any emails sent by the application will be intercepted by Mailhog. You can access the Mailhog UI at [http://localhost:8025](http://localhost:8025).

To stop the services, run:

```bash
docker-compose -f compose.yaml -f compose.dev.yaml down
```

#### Starting the API Server

Before starting the backend you need to initialize the database and create a `.env` file.

First, initialize the database by running the following command:

```bash
npm run db:migrate
```

Then, copy the `.env.example` file to `.env` and update the values accordingly.

You will need to update the `DOCKER_HOST_ADDRESS` and `SIP_SIGNALING_SERVER` variables with the IP address of your Docker host. Similarly, you will need to update the `CLOAK_ENCRYPTION_KEY` variable with a new key from [Cloak](https://cloak.47ng.com/).

Finally, you can start the backend by running:

```bash
npm run start:apiserver
```

#### Starting the Front Office

To start the Front Office, run:

```bash
npm run start:frontoffice
```

#### Starting the Widget

To start the Widget, run:

```bash
npm run start:widget
```

By default we create a Goodtok Workspace and the Widget will connect to it. When you open the Widget, you might see it is `offline`. That means that the Workspace is disabled or you are outside the hours of operations. You can change that by going to the Workspace settings and enabling it.
118 changes: 118 additions & 0 deletions docs/docs/contributing/guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Contributing guide

* [New Contributor Guide](#contributing-guide)
* [Ways to contribute](#ways-to-contribute)
* [Find an issue](#find-an-issue)
* [Ask for help](#ask-for-help)
* [Pull request lifecycle](#pull-request-lifecycle)
* [Development environment setup](#development-environment-setup)
* [Sign your commits](#sign-your-commits)
* [Pull request checklist](#pull-request-checklist)

Welcome! We are glad that you want to contribute to our project! 💖

As you get started, you are in the best position to give us feedback on areas of our project that we need help with including:

* Problems found during setting up a new developer environment
* Gaps in our Quickstart Guide or documentation
* Bugs in our automation scripts

If anything doesn't make sense, or doesn't work when you run it, please open a bug report and let us know!

## Ways to contribute

We welcome many different types of contributions including:

* New features
* Builds, CI/CD
* Bug fixes
* Documentation
* Issue Triage
* Answering questions on Discord/GitHub Discussions
* Web design
* UI/UX
* Communications / Social Media / Blog Posts
* Release management

Not everything happens through a GitHub pull request. Please come to our [meetings](https://discord.gg/4QWgSz4hTC) or [contact us](https://discord.gg/4QWgSz4hTC) and let's discuss how we can work
together.

### Come to meetings

Absolutely everyone is welcome to come to any of our meetings. You never need an invite to join us. In fact, we want you to join us, even if you don’t have anything you feel like you want to contribute. Just being there is enough!

You can find out more about our meetings [here](https://discord.gg/4QWgSz4hTC). You don’t have to turn on your video. The first time you come, introducing yourself is more than enough.

Over time, we hope that you feel comfortable voicing your opinions, giving feedback on others' ideas, and even sharing your own ideas, and experiences.

## Find an issue

We have good first issues for new contributors and help wanted issues suitable for any contributor. [good first issue](https://github.com/fonoster/goodtok/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) has extra information to help you make your first contribution. [help wanted](https://github.com/fonoster/goodtok/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) are issues suitable for someone who isn't a core maintainer and is good to move onto after your first pull request.

Sometimes there won’t be any issues with these labels. That’s ok! There is likely still something for you to work on. If you want to contribute but you don’t know where to start or can't find a suitable issue, you can reach out to us via [Discord](https://discord.gg/4QWgSz4hTC) or [GitHub Discussions](https://github.com/fonoster/goodtok/discussions) and we will help you find something.

Once you see an issue that you'd like to work on, please post a comment saying that you want to work on it. Something like "I want to work on this" is fine.

## Ask for help

The best way to reach us with a question when contributing is to ask on:

* The original github issue
* The [Discord](https://discord.gg/4QWgSz4hTC) community
* Our [GitHub Discussions](https://github.com/fonoster/goodtok/discussions)

## Pull request lifecycle

Before you start, ensure no one else is working on the same issue. If a related pull request exists, consider offering your assistance there. If you don't receive a response within a reasonable timeframe, you can proceed with your own pull request.

After you've submitted your pull request, it enters the review stage. During this time, the project maintainers or contributors will examine your changes. They might request modifications, such as:

- Enhancements in your code
- Additional tests or updates to the documentation
- Changes in your implementation approach
- Dividing your pull request into smaller, more manageable parts

Depending on the project’s roadmap and priorities, you might also be asked to:

- Delay the integration of your pull request to align with future releases
- Close your current pull request and, if needed, open a new one with revised changes

## Development environment setup

See our [Development environment setup](development-environment-setup.md) guide to get started locally or using Gitpod.

## Sign your commits

### DCO

Licensing is important to open source projects. It provides some assurances that the software will continue to be available based under the terms that the author(s) desired. We require that contributors sign off on commits submitted to our project's repositories. The [Developer Certificate of Origin (DCO)](https://probot.github.io/apps/dco/) is a way to certify that you wrote and have the right to contribute the code you are submitting to the project.

You sign-off by adding the following to your commit messages. Your sign-off must match the git user and email associated with the commit.

```text
This is my commit message
Signed-off-by: Your Name <your.name@example.com>
```

Git has a `-s` command line option to do this automatically:

```text
git commit -s -m 'This is my commit message'
```

If you forgot to do this and have not yet pushed your changes to the remote repository, you can amend your commit with the sign-off by running

```text
git commit --amend -s
```

## Pull request checklist

When you submit your pull request, or you push new commits to it, our automated systems will run some checks on your new code. We require that your pull request passes these checks, but we also have more criteria than just that before we can accept and merge it. We recommend that you check the following things locally before you submit your code:

- [ ] Your code builds and passes tests locally
- [ ] Your code passes our automated checks
- [ ] You have signed your commits
- [ ] You have added tests for your code (if applicable)
- [ ] You have updated the documentation (if applicable)
16 changes: 14 additions & 2 deletions docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,19 @@

/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
sidebar: ["welcome"]
sidebar: [
"welcome",
{
type: 'category',
label: 'Contributing',
collapsible: true,
collapsed: true,
items: [
'contributing/guide',
'contributing/development-environment-setup'
],
},
],
};

module.exports = sidebars;
module.exports = sidebars;
Loading

0 comments on commit 4923e6f

Please sign in to comment.