~ReadMe.md
.md
Markdown
(text/x-gfm)
# GitFOSS

## Run it

First step, clone this git repository and cd into it.

### Locally via Node/Yarn

#### Development mode

Make sure your `.env.local` file is correctly setup and includes all the environment
variables present in the example `.env` file. Make sure no value is set to `fake`.

```sh
$ yarn dev
$ yarn typecheck
$ yarn test
```

Also when changing the Prisma schema don't forget to make a migration with:

```sh
$ yarn migrate:dev
```

#### Production-like mode

Make sure your `.env.production` file is correctly setup and includes all the environment
variables present in the example `.env` file. Make sure no value is set to `fake`.

```sh
$ yarn build
$ cp .env.production dist/.env.production
$ DATABASE_URL='postgresql://...from.env.production...' yarn migrate:deploy
$ yarn start
```

### Using Docker

```sh
$ docker run -p 1337:1337 \
  -e COOKIE_NAME='gitfoss_ssid' \
  -e COOKIE_SECRET='gitfoss-cookie-secret' \
  -e DATABASE_URL='postgresql://postgres:change_me_password@gitfoss_db:5432/gitfoss?sslmode=disable&connection_limit=3' \
  -e DEPLOYMENT_DOMAIN='local-app.localhost' \
  -e DEPLOYMENT_SCHEME='http' \
  -e GIT_REPOSITORIES_ROOT='/var/lib/gitfoss/repos' \
  docker.io/library/gitfoss_web:latest;

# Get the container id then run migrations
$ docker exec -it container_id_here yarn migrate:deploy
```

### Using Docker Compose

```sh
$ docker-compose up -d
$ docker-compose exec web yarn migrate:deploy
```