requilence / integram

Integrate Telegram into your workflow – Trello, Gitlab, Bitbucket and other bots
https://integram.org
GNU General Public License v3.0
1.54k stars 151 forks source link

Add ability to configure GitLab URL through environment to use with self-hosted GitLab CE #41

Closed hrsrashid closed 7 years ago

hrsrashid commented 7 years ago

environment variable INTEGRAM_GITLAB_BASE_URL INTEGRAM_GITLAB_BASE_URL=https://gitlab.com

For self-hosted GitLab CE

Example

.
├── docker-compose.yml
├── Dockerfile
├── integram.crt
├── integram.key
├── main.go
└── public.crt

Dockerfile

FROM golang:alpine

RUN apk --no-cache add git ca-certificates openssl

ENV INTEGRAM_PORT 443
ENV INTEGRAM_BASE_URL https://example.org:8093
ENV INTEGRAM_GITLAB_BASE_URL https://example.org

WORKDIR /go/src/app
EXPOSE 443
# using my fork until pull request is merged
RUN go-wrapper download  github.com/requilence/integram; \
    cd /go/src/github.com/requilence/integram; \
    git remote add hrsrashid https://github.com/hrsrashid/integram.git; \
    git pull --rebase hrsrashid master; \
    cd /go/src/app

# cat command is work-around
COPY public.crt /usr/local/share/ca-certificates/code/ 
RUN update-ca-certificates; \
    cat /usr/local/share/ca-certificates/code/public.crt >> /etc/ssl/certs/ca-certificates.crt

COPY . ./
CMD ["go", "run", "main.go"]

docker-compose.yml

version: '2'
services:
    mongo:
        image: mongo
        restart: always
        volumes:
            - data:/data/db
    redis:
        image: redis:alpine
        restart: always
    bot:
        build: .
        restart: always
        environment:
            INTEGRAM_MONGO_URL: mongo
            INTEGRAM_REDIS_URL: redis:6379
        ports:
            - 8093:443

volumes:
    data: {}
tru2dagame commented 7 years ago

@hrsrashid That's awesome.

requilence commented 7 years ago

Hi, sorry for the long answer. Self-hosted gitlab was supported from the initial release. But may be not clear. Here is workflow that used:

hrsrashid commented 7 years ago

Thanks for reply, at least example of how to easily set up Integram in Docker may be useful for someone (had to deal with rejection of self-signed certificate, but solved it by adding certificate to OS's trusted storage, where was another problem that update-ca-certificates didn't work as expected in Alpine, so there workaround using cat).

So, simpler Dockerfile should also work:

FROM golang:alpine

RUN apk --no-cache add git ca-certificates openssl

# should probably be moved to docker-compose.yml
ENV INTEGRAM_PORT 443
ENV INTEGRAM_BASE_URL https://example.org:8093

WORKDIR /go/src/app
EXPOSE 443

RUN go-wrapper download  github.com/requilence/integram

# cat command is work-around
COPY public.crt /usr/local/share/ca-certificates/code/ 
RUN update-ca-certificates; \
    cat /usr/local/share/ca-certificates/code/public.crt >> /etc/ssl/certs/ca-certificates.crt

COPY . ./
CMD ["go", "run", "main.go"]

I guess PR should be closed?

requilence commented 7 years ago

Yes, thank you! I have the docker deploy for production and planning to add it here at Github with the next updates