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

docs: Add guides, update READMEs #9

Merged
merged 28 commits into from
Jun 7, 2019
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e96035e
Changes from old repo
mastercactapus Jun 4, 2019
98d2064
adding screenshot
Jun 4, 2019
e025445
tweak to project description
Jun 4, 2019
7e2fb52
spacing
Jun 4, 2019
7b21f6b
Merge branch 'master' into documentation-updates
mastercactapus Jun 4, 2019
258f34d
Simplify dev setup documentation
mastercactapus Jun 4, 2019
ddac6cc
resetdb: don't err if db doesn't exist
mastercactapus Jun 4, 2019
4793656
Tweaks for clairity
mastercactapus Jun 5, 2019
ae0ca29
Cleanup contributing guidelines a bit
mastercactapus Jun 5, 2019
25afc3b
Update smoketest readme
mastercactapus Jun 5, 2019
e7d68ca
add Dockerfile
mastercactapus Jun 5, 2019
00f1940
fix for regendb getting stuck with empty config
mastercactapus Jun 5, 2019
90e5341
first pass at getting started cleanup
mastercactapus Jun 5, 2019
8c55392
fix formatting
mastercactapus Jun 5, 2019
70eaadf
mailgun description
mastercactapus Jun 5, 2019
6fe5575
add mailgun section
mastercactapus Jun 6, 2019
70a2086
add note about API-only mode
mastercactapus Jun 6, 2019
66a3377
Merge branch 'master' into documentation-updates
mastercactapus Jun 6, 2019
f9a46ff
attempt to start postgres container on failure
mastercactapus Jun 7, 2019
1bbea8e
update README with feedback
mastercactapus Jun 7, 2019
4e27c52
use full name in header
mastercactapus Jun 7, 2019
831553f
shorten getting started intro
mastercactapus Jun 7, 2019
b3873a4
tweaks to postgres getting started info
mastercactapus Jun 7, 2019
09c8f2c
add link to effective Go in CONTRIBUTING.md
mastercactapus Jun 7, 2019
7eec623
add links to more info for tests
mastercactapus Jun 7, 2019
c4e0f89
add go unit test example
mastercactapus Jun 7, 2019
816b0af
update label query in README
mastercactapus Jun 7, 2019
d3bb029
Merge branch 'documentation-updates' of github.com:target/goalert int…
mastercactapus Jun 7, 2019
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
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ We welcome feature requests, bug reports and contributions for code and document

## Reporting Issues

Reporting bugs can be done in the GitHub [issue tracker](https://github.com/target/goalert/issues). Please search for a possible pre-existing issue first to help prevent duplicates.
Reporting bugs can be done in the GitHub [issue tracker](https://github.com/target/goalert/issues). Please search for existing issues first to help prevent duplicates.

Please include the version (`goalert version`) with new bug reports.

## Code Contribution

GoAlert is already used in production environments, so any new changes/features/functionality must (where possible):
GoAlert is already used in production environments, so any new changes/features/functionality must, where possible:

- Not alter existing behavior without an explicit config change
- Co-exist with older versions without disruption
Expand All @@ -24,7 +24,7 @@ As an example, things like DB changes/migrations should preserve behavior across

Patches are welcome, but we ask that any significant change start as an [issue](https://github.com/target/goalert/issues/new) in the tracker, prefereably before work is started.

Be sure to run `make check` before opening a PR to catch common errors.
Be sure to run `make check` and tests before opening a PR to catch common errors.
mastercactapus marked this conversation as resolved.
Show resolved Hide resolved

### UI Change Guidelines

Expand All @@ -36,4 +36,4 @@ Be sure to run `make check` before opening a PR to catch common errors.

- Use unit tests as a tool to validate complex logic
mastercactapus marked this conversation as resolved.
Show resolved Hide resolved
- New functionality should have a behavioral smoketest at a minimum. For [example](./smoketest/simplenotification_test.go). Documentation on our smoketest framework can be found [here](./smoketest/README.md).
- New Go code should pass `golint`, exported functions/methods should be commented, etc..
- Go code should follow best practices, exported functions/methods should be commented, etc..
mastercactapus marked this conversation as resolved.
Show resolved Hide resolved
55 changes: 20 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,37 @@
# GoAlert

GoAlert is an on-call alerting platform written in Go.
GoAlert provides on-call scheduling, automated escalation, and notifications via SMS and voice to automatically engage the right person, the right way, and at the right time.
m17ch marked this conversation as resolved.
Show resolved Hide resolved

## All-In-One (demo) Container
![image](https://user-images.githubusercontent.com/23565500/58896528-c1cdb100-86bb-11e9-96f1-a57198ece062.png)
mastercactapus marked this conversation as resolved.
Show resolved Hide resolved

The quickest way to explore GoAlert is by using the GoAlert [all-in-one container](https://hub.docker.com/r/goalert/all-in-one).
m17ch marked this conversation as resolved.
Show resolved Hide resolved
## Installation

- Ensure you have Docker Desktop installed ([Mac](https://docs.docker.com/docker-for-mac/release-notes/) / [Windows](https://docs.docker.com/docker-for-windows/release-notes/))
- `docker run -it --rm --name goalert-demo -p 8081:8081 goalert/all-in-one`
GoAlert is distributed as a single binary with release notes available from the [GitHub Releases](https://github.com/target/goalert/releases) page.

Using a web browser, navigate to `http://localhost:8081` and log in with user `admin` and password `admin123`.
See our [Getting Started Guide](./docs/getting-started.md) for running GoAlert in a production environment.

## Development
### Quick Start

Ensure you have docker, Go, node (and yarn), and make installed.
```bash
docker run -it --rm -p 8081:8081 goalert/all-in-one
```

- If you do not have Postgres installed/configured, first run `make postgres`, GoAlert is built and tested against Postgres 11.
- For the first start, run `make regendb` to migrate and add test data into the DB. This includes an admin user `admin/admin123`.
- To start GoAlert in development mode run `make start`.
- To build the GoAlert binary run `make bin/goalert BUNDLE=1`.
GoAlert will be running at [127.0.0.1:8081](http://127.0.0.1:8081). You can login with `admin/admin123`.
m17ch marked this conversation as resolved.
Show resolved Hide resolved

### Automated Browser Tests
## Contributing

To run automated browser tests, you can start Cypress in one of the following modes:
If you'd like to contribute to GoAlert, please see our [Contributing Guidelines](./CONTRIBUTING.md) and the [Development Setup Guide](./docs/development-setup.md).

- `make cy-wide` Widescreen format, in dev mode.
- `make cy-mobile` Mobile format, in dev mode.
- `make cy-wide-prod` Widescreen format, production build.
- `make cy-mobile-prod` Mobile format, production build.
Please also see our [Code of Conduct](./CODE_OF_CONDUCT.md).

### Running Smoketests
## Contact Us

A suite of functional/behavioral tests are maintained for the backend code. These test various APIs and behaviors
of the GoAlert server component.
If you need help or have a question, visit the [#GoAlert](https://gophers.slack.com/messages/CJQGZPYLV/) channel on [Gophers Slack](https://gophers.slack.com/) (use the [invite app](https://invite.slack.golangbridge.org/) for access).
m17ch marked this conversation as resolved.
Show resolved Hide resolved

Run the full suite with `make smoketest`.
- Vote on existing [Feature Requests](https://github.com/target/goalert/issues?q=is%3Aopen+label%3Afeature-request+sort%3Areactions-%2B1-desc) or submit [a new one](https://github.com/target/goalert/issues/new)
mastercactapus marked this conversation as resolved.
Show resolved Hide resolved
- File a [bug report](https://github.com/target/goalert/issues)
- Report security issues to security@goalert.me

### Running Unit Tests
## License

All unit tests can be run with `make test`.

UI Unit tests are found under the directory of the file being tested, with the same file name, appended with `.test.js`. They can be run independently with `make jest`. Watch mode can be enabled with `make jest JEST_ARGS=--watch`.

### Setup Postgres

By default, the development code expects a postgres server configured on port `5432`, with the user and DB `goalert`.

Alternatively, you can run `make postgres` to configure one in a docker container.

- You can reset the dev database with `make resetdb`
- You can reset and generate random data with `make regendb`, this includes generating an admin user `admin/admin123`
GoAlert is licensed under the [Apache License, Version 2.0](./LICENSE.md).
4 changes: 4 additions & 0 deletions devtools/ci/dockerfiles/goalert/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM alpine
RUN apk --no-cache add tzdata ca-certificates
COPY goalert /usr/bin/
CMD ["/usr/bin/goalert"]
2 changes: 1 addition & 1 deletion devtools/resetdb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ func recreateDB() error {
}
defer db.Close()

_, err = db.Exec("drop database goalert")
_, err = db.Exec("drop database if exists goalert")
if err != nil {
return err
}
Expand Down
50 changes: 50 additions & 0 deletions docs/development-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
## Development Setup

This guide assumes you have the commands `docker`, `go`, `node`, `yarn`, and `make` installed/available.

## Postgres
m17ch marked this conversation as resolved.
Show resolved Hide resolved

GoAlert is built and tested against Postgres 11. 9.6 should still work as of this writing, but is not recomended as future versions may begin using newer features.
mastercactapus marked this conversation as resolved.
Show resolved Hide resolved

The easiest way to setup Postgres for development is to run `make postgres`.
This will start a docker container with the correct configuration for the dev environment.

### Manual Configuration

If you already have Postgres running locally you can create the `goalert` role.

```sql
CREATE ROLE goalert WITH LOGIN SUPERUSER;
```

Currently the dev user must be a superuser to enable `pgcrypto` with `CREATE EXTENSION`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still must be done manually, correct?
Edit: I see you called this out explicitly in the Getting Started guide 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the CREATE ROLE bit is required, everything else will happen on startup


#### Toolchain Requirements

- For the first start, run `make regendb` to migrate and add test data into the DB. This includes adding an admin user `admin/admin123`.
- To start GoAlert in development mode run `make start`.
- To build the GoAlert binary run `make bin/goalert BUNDLE=1`.

### Automated Browser Tests
mastercactapus marked this conversation as resolved.
Show resolved Hide resolved

To run automated browser tests, you can start Cypress in one of the following modes:

- `make cy-wide` Widescreen format, in dev mode.
- `make cy-mobile` Mobile format, in dev mode.
- `make cy-wide-prod` Widescreen format, production build.
- `make cy-mobile-prod` Mobile format, production build.

The Cypress UI should start automatically.

### Running Smoketests

A suite of functional/behavioral tests are maintained for the backend code. These test various APIs and behaviors
of the GoAlert server component.

Run the full suite with `make smoketest`.

### Running Unit Tests

All unit tests can be run with `make test`.

UI Unit tests are found under the directory of the file being tested, with the same file name, appended with `.test.js`. They can be run independently of the Go unit tests with `make jest`. Watch mode can be enabled with `make jest JEST_ARGS=--watch`.
Loading