summaryrefslogtreecommitdiff
path: root/docs/running-gathio/installation.md
blob: cdb3f443801b03297a431f802c997972ad8caebd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# Installation

Gathio can be set up to run on your own server in two ways - as a self-hosted service, or via Docker.

## Self-hosting on Linux or macOS

### Prerequisites

-   [Node.js](https://nodejs.org/en/) v18 or greater
-   [MongoDB](https://www.mongodb.com/docs/manual/administration/install-on-linux/#std-label-install-mdb-community-edition-linux)

### Ubuntu

Let's suppose we're installing on a fresh Ubuntu system.

First, let's get the code:

```
$ cd /srv/
$ sudo git clone https://github.com/lowercasename/gathio/
```

We'll need to install [pnpm](https://pnpm.io/) for this:

```
$ curl -fsSL https://get.pnpm.io/install.sh | sh -
```

pnpm installation instructions for [other systems](https://pnpm.io/installation) are available.

Now, we'll install the dependencies:

```
$ cd gathio
$ pnpm install
$ pnpm build
```

Let's copy the config file in place:

```
$ cp config/config.example.toml config/config.toml
```

We can edit this file if needed, as it contains settings which will need to be adjusted to your local setup to successfully format emails.

```
$ $EDITOR config/config.toml
```

Either way, we'll need to have MongoDB running. Follow the [MongoDB Community Edition Ubuntu instructions](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu), which are probably what you want.

Next, let's create a dedicated user:

```
$ sudo adduser --home /srv/gathio --disabled-login gathio
$ sudo chown -R gathio:gathio /srv/gathio
```

Next, we'll copy the systemd service and reload systemd

```
$ sudo cp gathio.service /etc/systemd/system/
$ sudo systemctl daemon-reload
```

Finally, we can start gathio:

```
$ sudo systemctl start gathio
```

It should now be listening on port 3000:

```
$ sudo netstat -tunap | grep LISTEN
[...]
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      952/sshd
tcp6       0      0 :::3000                 :::*                    LISTEN      5655/node
[...]
```

(this doesn't mean it's only listening on IPv6, because sockets under Linux are
dual-stack by default...)

It is now available on port 3000, and we can continue by setting up a reverse
proxy, which allows us to make it available on another port, or from another
server; and to enable TLS on the connection (see for example [Linode's guide on
the subject](https://www.linode.com/docs/web-servers/nginx/use-nginx-reverse-proxy/#configure-nginx))

## Docker

The easiest way to run Gathio using Docker is by using the provided
`docker-compose` configuration. We provide a Docker image at [GitHub
Container Repository](https://github.com/lowercasename/gathio/pkgs/container/gathio).

Create a directory on your system where you'll keep the Gathio configuration
file and another where Gathio can store user-uploaded event images. Copy the
example config file into the config directory:

```bash
mkdir -p ~/docker/gathio-docker/{config,images}
cp config/config.example.toml ~/docker/gathio-docker/config/config.toml
```

Under the `volumes` section of the `docker-compose.yml` configuration, adjust the
configuration volume to match the folder you created:

```dockerfile
volumes:
    - '/home/username/docker/gathio-docker/config:/app/config'
    - '/home/username/docker/gathio-docker/images:/app/public/events'
```

Adjust any settings in the config file, especially the MongoDB URL, which should
read as follows for the standard Docker Compose config, and the email service if you
want to enable it:

```ini
mongodb_url = "mongodb://mongo:27017/gathio"
mail_service = "nodemailer"
```

You can copy the `docker-compose.yml` file into that same `gathio-docker` directory
you created - you don't need any of the source code. Once you're done, your directory
should look something like this:

```
gathio-docker
├── config
│  └── config.toml
├── docker-compose.yml
└── images
```

Finally, from wherever you've put your `docker-compose.yml` file, start the Docker stack:

```bash
cd gathio-docker
docker-compose up -d
```

Gathio should now be running on `http://localhost:3000`, storing data in a
Docker volume, and storing images on your filesystem.