Skip to content

Commit

Permalink
add guide on how to deploy MailCrab on fly.io
Browse files Browse the repository at this point in the history
1. Add guide on how to signup or login from flyctl cli
2. Remove app name, and region from the fly.toml config. So users can choose any app name and region as they like
3. Remove port 1080 from the fly.toml config because it's unnecessary
4. Add start stop machines to the fly.toml config. So you don’t have to pay for their CPU and RAM when the machine in the stopped state. Note: you'll get three free machines after you create your fly.io account
5. Fix the third step
  • Loading branch information
sahidrahman404 authored and marlonbaeten committed Aug 22, 2023
1 parent 6ca44fe commit c519249
Showing 1 changed file with 125 additions and 0 deletions.
125 changes: 125 additions & 0 deletions flydotio_deployment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
## Deploy MailCrab on fly.io

### 1. Install flyctl

For installation you can follow [this guide](https://fly.io/docs/hands-on/install-flyctl/), or just try the below snippet.

- Linux

```
curl -L https://fly.io/install.sh | sh
```

- MacOs

```
brew install flyctl
```

- Windows

```
pwsh -Command "iwr https://fly.io/install.ps1 -useb | iex"
```

### 2. Login or SignUp to your fly.io account

- If you already have a Fly.io account, you can log in with flyctl by running:

```
fly auth login
```
Your browser will open up with the Fly.io sign-in screen; enter your user name and password to sign in.

- If you haven’t got a Fly.io account, you’ll need to create one by running:

```
fly auth signup
```
This will open your browser on the sign-up page

### 3. Create a folder with fly.toml config

- Create a folder and a fly.toml config file

```
mkdir mail-crab
cd mail-crab
touch fly.toml
```

- Open fly.toml file with your favorite editor and copy the below config to the file

```toml
[build]
image = "marlonb/mailcrab:latest"

[[services]]
protocol = "tcp"
internal_port = 1080
processes = ["app"]
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0

[[services.ports]]
force_https = true
handlers = ["http"]
port = 80

[[services.ports]]
handlers = ["tls", "http"]
port = 443

[services.concurrency]
type = "connections"
hard_limit = 25
soft_limit = 20

[[services]]
protocol = "tcp"
internal_port = 1025
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0

[[services.ports]]
port = 1025

[services.concurrency]
type = "connections"
hard_limit = 25
soft_limit = 20
```

### 4. Deploy Mailcrab

- Run the below command in the folder where your fly.toml config file is located, and follow the steps.

```
fly launch --ha=false
```

- Say no to these options

```
? Would you like to set up a Postgresql database now? No
? Would you like to set up an Upstash Redis database now? No
? Would you like to allocate dedicated ipv4 and ipv6 addresses now? No
```

- Allocate shared ipv4 address

```
fly ips allocate-v4 --shared
```

- Allocate ipv6 address

```
fly ips allocate-v6
```

### That's it!

Your SMTP host is your app fly.io domain and the port is 1025

0 comments on commit c519249

Please sign in to comment.