~cytrogen/masto-fe

c2390c1d13a79789eb2284621965001cf1e30ec1 — tobi a year ago 6920d0b
[docs] add CONTRIBUTING.md (#36)

Reviewed-on: https://codeberg.org/superseriousbusiness/masto-fe-standalone/pulls/36
Co-authored-by: tobi <tobi.smethurst@protonmail.com>
Co-committed-by: tobi <tobi.smethurst@protonmail.com>
2 files changed, 74 insertions(+), 53 deletions(-)

A CONTRIBUTING.md
M README.md
A CONTRIBUTING.md => CONTRIBUTING.md +66 -0
@@ 0,0 1,66 @@
# Contributing to Masto-FE (🦥 flavour)

[Find an issue](https://codeberg.org/superseriousbusiness/masto-fe-standalone/issues), code it up, all day long you'll have good luck!

## Dependencies

To work on the code decently, you should have Node and Yarn installed. To avoid fuckery, Node Version Manager is **highly recommended**: https://github.com/nvm-sh/nvm.

## Testing Locally

You can fairly easily test builds of Masto-FE locally by using Docker and the GoToSocial testrig.

### Build GoToSocial + launch the GtS testrig

First get the GoToSocial repository cloned somewhere:

```bash
mkdir -p ~/go/src/codeberg.org/superseriousbusiness && \
cd ~/go/src/codeberg.org/superseriousbusiness && \
git clone git@codeberg.org:superseriousbusiness/gotosocial && \
cd ~/go/src/codeberg.org/superseriousbusiness/gotosocial
```

In the GtS repo directory, build GoToSocial with `DEBUG=1` to enable the testrig:

```bash
DEBUG=1 ./scripts/build.sh
```

In the GtS repo directory, launch the GoToSocial testrig using the newly built binary, which will bind to port 8080 on localhost:

```bash
DEBUG=1 GTS_LOG_LEVEL=info ./gotosocial testrig start
```

Leave the testrig running.

### Build Masto-FE + run it locally

Now in a *separate* terminal window, get back to the Masto-FE directory, and do a Docker build (this might take a bit of time):

```bash
docker build -t superseriousbusiness/masto-fe-standalone:latest .
```

Deploy Masto-FE locally on port 3000:

```bash
docker run -it -p 3000:80 superseriousbusiness/masto-fe-standalone:latest
```

Open your browser and go to http://localhost:3000.

In the front page, enter `http://localhost:8080` as your domain/instance. **The `http://` part is important, as without it Masto-FE will expect `https`!**

Log in as email `zork@example.org`, password `password`, or `admin@example.org`, password `password`. You can now try posting stuff, viewing timelines, etc.

If you want to reset the testrig state, just stop it and launch it again. All database + storage state will be cleared when it stops, and repopulated when it launches. You will then need to log out of Masto-FE (🦥 flavour) and log back in again to reauthenticate.

## Linting

Stuff needs to pass linting before it gets squerged:

```bash
yarn && yarn lint:js
```

M README.md => README.md +8 -53
@@ 14,9 14,11 @@ The application doesn't gather or store any information that you give it, includ

## Building

### Not Docker (must have Node + Yarn installed)
### Not Docker

You need Node and Yarn installed for this. To avoid fuckery, Node Version Manager is **highly recommended**: https://github.com/nvm-sh/nvm.

You can build the whole thingy by running:
Once you've installed Node + Yarn, you can build the whole thingy by running:

```bash
yarn && yarn build:production


@@ 30,57 32,6 @@ You can build a docker container for the whole thingy by running (for example):
docker build -t superseriousbusiness/masto-fe-standalone:0.1.0 .
```

## Testing Locally

You can fairly easily test builds of Masto-FE locally by using Docker and the GoToSocial testrig.

### Build GoToSocial + launch the GtS testrig

First get the GoToSocial repository cloned somewhere:

```bash
mkdir -p ~/go/src/codeberg.org/superseriousbusiness && \
cd ~/go/src/codeberg.org/superseriousbusiness && \
git clone git@codeberg.org:superseriousbusiness/gotosocial && \
cd ~/go/src/codeberg.org/superseriousbusiness/gotosocial
```

In the GtS repo directory, build GoToSocial with `DEBUG=1` to enable the testrig:

```bash
DEBUG=1 ./scripts/build.sh
```

In the GtS repo directory, launch the GoToSocial testrig using the newly built binary, which will bind to port 8080 on localhost:

```bash
DEBUG=1 GTS_LOG_LEVEL=info ./gotosocial testrig start
```

Leave the testrig running.

### Build Masto-FE + run it locally

Now in a *separate* terminal window, get back to the Masto-FE directory, and do a Docker build (this might take a bit of time):

```bash
docker build -t superseriousbusiness/masto-fe-standalone:latest .
```

Deploy Masto-FE locally on port 3000:

```bash
docker run -it -p 3000:80 superseriousbusiness/masto-fe-standalone:latest
```

Open your browser and go to http://localhost:3000.

In the front page, enter `http://localhost:8080` as your domain/instance. **The `http://` part is important, as without it Masto-FE will expect `https`!**

Log in as email `zork@example.org`, password `password`, or `admin@example.org`, password `password`. You can now try posting stuff, viewing timelines, etc.

If you want to reset the testrig state, just stop it and launch it again. All database + storage state will be cleared when it stops, and repopulated when it launches. You will then need to log out of Masto-FE (🦥 flavour) and log back in again to reauthenticate.

## Deploying

### Not Docker


@@ 90,3 41,7 @@ Serve all the stuff in `public` behind an nginx or whatever you want! See the in
### Docker (definitely the easiest way)

The Docker container is based on Nginx, and serves over port 3000. Just deploy it and listen on that port, preferably with a reverse proxy at some point (Traefik? Caddy? Another Nginx perhaps?) handling https.

## Testing locally, linting, etc

See [CONTRIBUTING.md](./CONTRIBUTING.md)!