Skip to content

Commit

Permalink
examples
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-goode committed Sep 4, 2023
1 parent c6a14ef commit b642238
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 13 deletions.
12 changes: 6 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
*.db
.direnv
.envrc
config.toml
drasl
node_modules
public/bundle.js
/.direnv
/.envrc
/config.toml
/drasl
/node_modules
/public/bundle.js
14 changes: 7 additions & 7 deletions doc/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

These instructions are written assuming you're running Linux, but the Docker setup process should be about the same on macOS or Windows.

Drasl is an HTTP server that listens on port 25585. You'll want to put it behind a reverse proxy for HTTPS.
Drasl is an HTTP server that listens on port 25585 (customize with the `ListenAddress` option). You'll want to put it behind a reverse proxy for HTTPS.

### Docker

On most systems, Docker is the easiest way to host Drasl:

1. In any directory, clone the repository (you can delete it later if you want):
1. In any working directory, clone the repository (you can delete it later if you want):

```git clone https://github.com/unmojang/drasl.git```

2. Copy the `docker` example to wherever you want to store Drasl's data:
2. Copy the `docker` example to wherever you want to store Drasl's data. I like `/srv/drasl`:


```sudo cp -RTi ./drasl/example/docker /srv/drasl```

3. `cd /srv/drasl`
4. Fill out `config/config.toml` according to one of the examples in [doc/recipes.md](doc/recipes.md).
4. Fill out `config/config.toml` according to one of the examples in [doc/recipes.md](recipes.md).
5. `docker compose up -d`
6. Set up an reverse proxy (using e.g. [Caddy](https://caddyserver.com/) or nginx) from your base URL (e.g. `https://drasl.example.com`) to `http://localhost:25585`.

Expand All @@ -43,8 +43,8 @@ If you don't already have a web server to use as a reverse proxy, you can use th

3. `cd /srv/drasl`
4. Fill out `Caddyfile`
5. Fill out `config/config.toml` according to one of the examples in [doc/recipes.md](doc/recipes.md).
6. `docker-compose up -d`
5. Fill out `config/config.toml` according to one of the examples in [doc/recipes.md](recipes.md).
6. `docker compose up -d`

Note: when Drasl updates, you will have to manually pull the most recent version:

Expand Down Expand Up @@ -111,7 +111,7 @@ This is a more declarative version of the Docker setup from above.
```sudo cp -RTi ./drasl/example/docker /srv/drasl```

3. `cd /srv/drasl`
4. Fill out `config/config.toml` according to one of the examples in [doc/recipes.md](doc/recipes.md).
4. Fill out `config/config.toml` according to one of the examples in [doc/recipes.md](recipes.md).

5. Add the following to your `/etc/nixos/configuration.nix` and then `sudo nixos-rebuild switch`:

Expand Down
7 changes: 7 additions & 0 deletions example/docker-caddy/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Should be the same as `Domain` in Drasl's config.toml
drasl.example.com

# Email address to use for obtaining TLS certificates
tls mail@example.com

reverse_proxy :25585
Empty file.
Empty file.
15 changes: 15 additions & 0 deletions example/docker-caddy/config/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Drasl default config file

# Example: drasl.example.com
Domain = ""

# Example: https://drasl.example.com
BaseURL = ""

# List of usernames who automatically become admins of the Drasl instance
DefaultAdmins = [""]

[RegistrationNewPlayer]
Allow = true
AllowChoosingUUID = true
RequireInvite = true
Empty file.
19 changes: 19 additions & 0 deletions example/docker-caddy/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: '3'

services:
caddy:
image: caddy
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- ./caddy/data:/data
- ./caddy/config:/config
drasl:
image: unmojang/drasl
ports:
- "127.0.0.1:25585:25585"
volumes:
- ./config:/etc/drasl
- ./data:/var/lib/drasl
15 changes: 15 additions & 0 deletions example/docker/config/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Drasl default config file

# Example: drasl.example.com
Domain = ""

# Example: https://drasl.example.com
BaseURL = ""

# List of usernames who automatically become admins of the Drasl instance
DefaultAdmins = [""]

[RegistrationNewPlayer]
Allow = true
AllowChoosingUUID = true
RequireInvite = true
Empty file added example/docker/data/.gitkeep
Empty file.
10 changes: 10 additions & 0 deletions example/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3'

services:
drasl:
image: unmojang/drasl
ports:
- "127.0.0.1:25585:25585"
volumes:
- ./config:/etc/drasl
- ./data:/var/lib/drasl
12 changes: 12 additions & 0 deletions example/drasl.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=Drasl
After=network-online.target

[Service]
DynamicUser=true
ExecStart=/usr/bin/drasl
StateDirectory=drasl
Restart=always

[Install]
WantedBy=multi-user.target

0 comments on commit b642238

Please sign in to comment.