Skip to content

Commit 34dd863

Browse files
author
Kirill Rodin
committed
add dockerfile
1 parent bbbb563 commit 34dd863

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+208
-152
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

Dockerfile

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM golang:1.12.4-alpine3.9 AS builder
2+
3+
RUN apk add --update --no-cache make bash git openssh-client build-base musl-dev curl wget
4+
5+
ADD . /src/app
6+
7+
WORKDIR /src/app
8+
9+
RUN mkdir ./bin && \
10+
go build -o ./bin/postmanq -a cmd/postmanq.go && \
11+
go build -o ./bin/pmq-grep -a cmd/pmq-grep.go && \
12+
go build -o ./bin/pmq-publish -a cmd/pmq-publish.go && \
13+
go build -o ./bin/pmq-report -a cmd/pmq-report.go
14+
15+
FROM alpine:3.9
16+
17+
COPY --from=builder /usr/local/go/lib/time/zoneinfo.zip /usr/local/go/lib/time/zoneinfo.zip
18+
COPY --from=builder /src/app/bin/postmanq /bin/postmanq
19+
COPY --from=builder /src/app/bin/pmq-grep /bin/pmq-grep
20+
COPY --from=builder /src/app/bin/pmq-publish /bin/pmq-publish
21+
COPY --from=builder /src/app/bin/pmq-report /bin/pmq-report
22+
23+
24+
ENTRYPOINT ["postmanq"]
25+
CMD ["-f", "/etc/postmaq.yaml"]

README.md

+25-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#PostmanQ
1+
# PostmanQ
22

33
PostmanQ - это высокопроизводительный почтовый сервер(MTA).
44
На сервере под управлением Ubuntu 12.04 с 8-ми ядерным процессором и 32ГБ оперативной памяти
@@ -8,7 +8,7 @@ PostmanQ рассылает более 300 писем в секунду.
88

99
PostmanQ разбирает одну или несколько очередей одного или нескольких AMQP-серверов с письмами и отправляет письма по SMTP сторонним почтовым сервисам.
1010

11-
##Возможности
11+
## Возможности
1212

1313
1. PostmanQ может работать с несколькими AMQP-серверами и очередями каждого из серверов.
1414
2. PostmanQ умеет работать через TLS соединение.
@@ -19,7 +19,7 @@ PostmanQ разбирает одну или несколько очередей
1919
7. PostmanQ попробует отослать письмо попозже, если возникла сетевая ошибка, письмо попало в [серый список](http://ru.wikipedia.org/wiki/%D0%A1%D0%B5%D1%80%D1%8B%D0%B9_%D1%81%D0%BF%D0%B8%D1%81%D0%BE%D0%BA) или количество отправленных писем почтовому сервису уже максимально.
2020
8. PostmanQ положит в отдельную очередь письма, которые не удалось отправить из-за 5ХХ ошибки
2121

22-
##Как это работает?
22+
## Как это работает?
2323

2424
1. Нам потребуется AMQP-сервер, например [RabbitMQ](https://www.rabbitmq.com), и [go](http://golang.org/) для компиляции PostmanQ.
2525
2. Выполняем предварительную подготовку и установку PostmanQ. Инструкции описаны ниже.
@@ -41,7 +41,7 @@ PostmanQ разбирает одну или несколько очередей
4141
11. Если произошла сетевая ошибка, то письмо перекладывается в одну из очередей для повторной отправки.
4242
12. Если произошла 5ХХ ошибка, то письмо перекладывается в очередь с проблемными письмами, повторная отправка не производится.
4343

44-
##Предварительная подготовка
44+
## Предварительная подготовка
4545

4646
Чтобы наши письма отправлялись безопасно и доходили до адресатов, не попадая в спам, нам необходимо создать сертификат, публичный и закрытый ключ для каждого домена.
4747

@@ -95,15 +95,15 @@ Selector-ом может быть любым словом на латинице.
9595

9696
Теперь наши письма не будут попадать в спам, и все готово для установки PostmanQ.
9797

98-
##Установка
98+
## Установка
9999

100100
Сначала уcтанавливаем [go](http://golang.org/doc/install). Затем устанавливаем PostmanQ:
101101

102102
cd /some/path && mkdir postmanq && cd postmanq/
103103
export GOPATH=/some/path/postmanq/
104104
export GOBIN=/some/path/postmanq/bin/
105-
go get -d github.com/actionpay/postmanq/cmd
106-
cd src/github.com/actionpay/postmanq
105+
go get -d github.com/Halfi/postmanq/cmd
106+
cd src/github.com/Halfi/postmanq
107107
git checkout v.3.1
108108
go install cmd/postmanq.go
109109
go install cmd/pmq-grep.go
@@ -116,27 +116,39 @@ Selector-ом может быть любым словом на латинице.
116116

117117
Затем берем из репозитория config.yaml и пишем свой файл с настройками. Все настройки подробно описаны в самом config.yaml.
118118

119-
##Использование
119+
## Использование
120120

121121
sudo rabbitmq-server -detached
122122
postmanq -f /path/to/config.yaml
123123

124-
##Утилиты
124+
## Утилиты
125125

126126
Для PostmanQ создано несколько утилит, призванных облегчить работу с логами и очередями рассылок - pmq-grep, pmq-publish, pmq-report.
127127
Вызов каждой из утилит без аргументов покажет ее использование.
128128

129-
###pmq-grep
129+
### pmq-grep
130130

131131
Если PostmanQ пишет логи в файл, то с помощью pmq-grep можно вытащить из лога все записи по определенному email получателя.
132132

133-
###pmq-publish
133+
### pmq-publish
134134

135135
Если вы что то не прописали в DNS, или операционная система не может открыть столько соединений, сколько необходимо для PostmanQ, то велика вероятность,
136136
что письма не будут отправляться, и PostmanQ будет складывать письма в очередь для ошибок или в одну из очередей для повторной отправки.
137137
После устранения проблемы, возможно, понадобится срочно разослать неотправленные письма. Как раз для этого и существует pmq-publish.
138138
С помощью pmq-publish можно переложить письма, например, из очереди для ошибок в очередь для отправки, отфильтровав письма по коду ошибки, полученной от почтового сервиса.
139139

140-
###pmq-report
140+
### pmq-report
141141

142-
С помощью pmq-report можно посмотреть - по какой причине письмо попало в очередь для ошибок.
142+
С помощью pmq-report можно посмотреть - по какой причине письмо попало в очередь для ошибок.
143+
144+
## Docker Качаем конфиг:
145+
```bash
146+
curl -o /path/to/config.yaml https://raw.githubusercontent.com/Halfi/postmanq/v.3.2-rc/config.yaml
147+
```
148+
Настраиваем доступы к AMQP-серверу.
149+
150+
И запускаем, прокинув конфиг:
151+
152+
```bash
153+
docker run -v `/path/to/config.yaml`:`/etc/postmaq.yaml` -d --restart unless-stopped --name postmanq halfi/postmanq:latest
154+
```

analyser/detail.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package analyser
22

33
import (
44
"fmt"
5-
"github.com/actionpay/postmanq/common"
5+
"github.com/Halfi/postmanq/common"
66
"regexp"
77
"strings"
88
)

analyser/service.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"bufio"
55
"flag"
66
"fmt"
7-
"github.com/actionpay/postmanq/common"
7+
"github.com/Halfi/postmanq/common"
88
"os"
99
"strconv"
1010
"strings"

application/abstract.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package application
22

33
import (
4-
"github.com/actionpay/postmanq/common"
5-
"github.com/actionpay/postmanq/logger"
4+
"github.com/Halfi/postmanq/common"
5+
"github.com/Halfi/postmanq/logger"
66
"io/ioutil"
77
"time"
88
)

application/grep.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package application
22

33
import (
4-
"github.com/actionpay/postmanq/common"
5-
"github.com/actionpay/postmanq/grep"
4+
"github.com/Halfi/postmanq/common"
5+
"github.com/Halfi/postmanq/grep"
66
)
77

88
// приложение, ищущее логи по адресату или получателю

application/post.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package application
22

33
import (
4-
"github.com/actionpay/postmanq/common"
5-
"github.com/actionpay/postmanq/connector"
6-
"github.com/actionpay/postmanq/consumer"
7-
"github.com/actionpay/postmanq/guardian"
8-
"github.com/actionpay/postmanq/limiter"
9-
"github.com/actionpay/postmanq/logger"
10-
"github.com/actionpay/postmanq/mailer"
11-
"github.com/actionpay/postmanq/recipient"
4+
"github.com/Halfi/postmanq/common"
5+
"github.com/Halfi/postmanq/connector"
6+
"github.com/Halfi/postmanq/consumer"
7+
"github.com/Halfi/postmanq/guardian"
8+
"github.com/Halfi/postmanq/limiter"
9+
"github.com/Halfi/postmanq/logger"
10+
"github.com/Halfi/postmanq/mailer"
11+
"github.com/Halfi/postmanq/recipient"
1212
yaml "gopkg.in/yaml.v2"
1313
"runtime"
1414
)

application/publish.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package application
22

33
import (
4-
"github.com/actionpay/postmanq/common"
5-
"github.com/actionpay/postmanq/consumer"
4+
"github.com/Halfi/postmanq/common"
5+
"github.com/Halfi/postmanq/consumer"
66
)
77

88
// приложение, перекладывающее письма из очереди в очередь

application/report.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package application
22

33
import (
4-
"github.com/actionpay/postmanq/analyser"
5-
"github.com/actionpay/postmanq/common"
6-
"github.com/actionpay/postmanq/consumer"
4+
"github.com/Halfi/postmanq/analyser"
5+
"github.com/Halfi/postmanq/common"
6+
"github.com/Halfi/postmanq/consumer"
77
)
88

99
// приложение, анализирующее неотправленные сообщения

cmd/pmq-grep.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package main
33
import (
44
"flag"
55
"fmt"
6-
"github.com/actionpay/postmanq/application"
7-
"github.com/actionpay/postmanq/common"
6+
"github.com/Halfi/postmanq/application"
7+
"github.com/Halfi/postmanq/common"
88
)
99

1010
func main() {

cmd/pmq-publish.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package main
33
import (
44
"flag"
55
"fmt"
6-
"github.com/actionpay/postmanq/application"
7-
"github.com/actionpay/postmanq/common"
6+
"github.com/Halfi/postmanq/application"
7+
"github.com/Halfi/postmanq/common"
88
)
99

1010
func main() {

cmd/pmq-report.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package main
33
import (
44
"flag"
55
"fmt"
6-
"github.com/actionpay/postmanq/application"
7-
"github.com/actionpay/postmanq/common"
6+
"github.com/Halfi/postmanq/application"
7+
"github.com/Halfi/postmanq/common"
88
)
99

1010
func main() {

cmd/postmanq.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package main
33
import (
44
"flag"
55
"fmt"
6-
"github.com/actionpay/postmanq/application"
7-
"github.com/actionpay/postmanq/common"
6+
"github.com/Halfi/postmanq/application"
7+
"github.com/Halfi/postmanq/common"
88
)
99

1010
func main() {

connector/connector.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package connector
33
import (
44
"errors"
55
"fmt"
6-
"github.com/actionpay/postmanq/common"
7-
"github.com/actionpay/postmanq/logger"
6+
"github.com/Halfi/postmanq/common"
7+
"github.com/Halfi/postmanq/logger"
88
"net"
99
"net/smtp"
1010
"time"

connector/preparer.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package connector
33
import (
44
"errors"
55
"fmt"
6-
"github.com/actionpay/postmanq/common"
7-
"github.com/actionpay/postmanq/logger"
6+
"github.com/Halfi/postmanq/common"
7+
"github.com/Halfi/postmanq/logger"
88
"time"
99
)
1010

connector/seeker.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package connector
22

33
import (
4-
"github.com/actionpay/postmanq/logger"
4+
"github.com/Halfi/postmanq/logger"
55
"net"
66
"strings"
77
"sync"

connector/server.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package connector
22

33
import (
4-
"github.com/actionpay/postmanq/common"
4+
"github.com/Halfi/postmanq/common"
55
"net"
66
)
77

connector/service.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"crypto/tls"
55
"crypto/x509"
66
"encoding/pem"
7-
"github.com/actionpay/postmanq/common"
8-
"github.com/actionpay/postmanq/logger"
7+
"github.com/Halfi/postmanq/common"
8+
"github.com/Halfi/postmanq/logger"
99
yaml "gopkg.in/yaml.v2"
1010
"io/ioutil"
1111
"net"

0 commit comments

Comments
 (0)