Selaa lähdekoodia

Merge in files from docker repository.

This will allow easier building on docker hub and let us automatically
publish tags for each release.

Fixes oragono/oragono-docker#20
tags/v2.0.0-rc1
Chris Smith 4 vuotta sitten
vanhempi
commit
68a8f4b698
Allekirjoittanut: Chris Smith <chris@chameth.com> GPG Key ID: 3A2D4BBDC4A3C9A9
5 muutettua tiedostoa jossa 217 lisäystä ja 2 poistoa
  1. 4
    2
      README.md
  2. 55
    0
      distrib/docker/Dockerfile
  3. 109
    0
      distrib/docker/README.md
  4. 20
    0
      distrib/docker/docker-compose.yml
  5. 29
    0
      distrib/docker/run.sh

+ 4
- 2
README.md Näytä tiedosto

@@ -56,9 +56,11 @@ Some platforms/distros also have Oragono packages maintained for them:
56 56
 
57 57
 * Arch Linux [AUR](https://aur.archlinux.org/packages/oragono/) - Maintained by [Sean Enck (@enckse)](https://github.com/enckse).
58 58
 
59
-### Using Docker (BETA)
59
+### Using Docker
60 60
 
61
-A Dockerfile and docker-compose recipe are available in the [oragono-docker](https://github.com/oragono/oragono-docker) repository.
61
+A Dockerfile and example docker-compose recipe are available in the `distrib/docker` directory. Oragono is automatically published
62
+to Docker Hub at [oragono/oragono](https://hub.docker.com/r/oragono/oragono). For more information, see the distrib/docker
63
+[README file](https://github.com/oragono/oragono/blob/master/distrib/docker/README.md).
62 64
 
63 65
 ### From Source
64 66
 

+ 55
- 0
distrib/docker/Dockerfile Näytä tiedosto

@@ -0,0 +1,55 @@
1
+## build Oragono
2
+FROM golang:rc-alpine AS build-env
3
+
4
+RUN apk add --no-cache git make curl
5
+
6
+# copy oragono
7
+RUN mkdir -p /go/src/github.com/oragono/oragono
8
+WORKDIR /go/src/github.com/oragono/oragono
9
+ADD . /go/src/github.com/oragono/oragono/
10
+
11
+# make sure submodules are up-to-date
12
+RUN git submodule update --init
13
+
14
+# compile
15
+RUN make
16
+
17
+
18
+
19
+## run Oragono
20
+FROM alpine:3.9
21
+
22
+# metadata
23
+LABEL maintainer="daniel@danieloaks.net"
24
+LABEL description="Oragono is a modern, experimental IRC server written in Go"
25
+
26
+# install latest updates and configure alpine
27
+RUN apk update
28
+RUN apk upgrade
29
+RUN mkdir /lib/modules
30
+
31
+# standard ports listened on
32
+EXPOSE 6667/tcp 6697/tcp
33
+
34
+# oragono itself
35
+RUN mkdir -p /ircd-bin
36
+COPY --from=build-env /go/bin/oragono /ircd-bin
37
+COPY --from=build-env /go/src/github.com/oragono/oragono/languages /ircd-bin/languages/
38
+COPY --from=build-env /go/src/github.com/oragono/oragono/oragono.yaml /ircd-bin/oragono.yaml
39
+COPY distrib/docker/run.sh /ircd-bin/run.sh
40
+RUN chmod +x /ircd-bin/run.sh
41
+
42
+# running volume holding config file, db, certs
43
+VOLUME /ircd
44
+WORKDIR /ircd
45
+
46
+# default motd
47
+COPY --from=build-env /go/src/github.com/oragono/oragono/oragono.motd /ircd/oragono.motd
48
+
49
+# launch
50
+ENTRYPOINT ["/ircd-bin/run.sh"]
51
+
52
+# # uncomment to debug
53
+# RUN apk add --no-cache bash
54
+# RUN apk add --no-cache vim
55
+# CMD /bin/bash

+ 109
- 0
distrib/docker/README.md Näytä tiedosto

@@ -0,0 +1,109 @@
1
+# Oragono Docker
2
+
3
+This folder holds Oragono's Dockerfile and related materials. Oragono
4
+is published iautomatically to Docker Hub at
5
+[oragono/oragano](https://hub.docker.com/r/oragono/oragono).
6
+
7
+The `latest` tag tracks the `stable` branch of Oragono, which contains
8
+the latest stable release. The `dev` tag tracks the master branch, which
9
+may by unstable and is not recommended for production.
10
+
11
+You can see other tags [on Docker Hub](https://hub.docker.com/r/oragono/oragono/tags)
12
+if you wish to run a specific version of Oragono.
13
+
14
+## Quick start
15
+
16
+The Oragono docker image is designed to work out of the box - it comes with a
17
+usable default config and will automatically generate self-signed TLS
18
+certificates. To get a working ircd, all you need to do is run the image and
19
+expose the ports:
20
+
21
+```shell
22
+docker run --name oragono -d -P oragono/oragono:tag
23
+```
24
+
25
+This will start Oragono and listen on ports 6667 (plain text) and 6697 (TLS).
26
+The first time Oragono runs it will create a config file with a randomised
27
+oper password. This is output to stdout, and you can view it with the docker
28
+logs command:
29
+
30
+```shell
31
+# Assuming your container is named `oragono`; use `docker container ls` to
32
+# find the name if you're not sure.
33
+docker logs oragono
34
+```
35
+
36
+You should see a line similar to:
37
+
38
+```
39
+Oper username:password is dan:cnn2tm9TP3GeI4vLaEMS
40
+```
41
+
42
+## Persisting data
43
+
44
+Oragono has a persistent data store, used to keep account details, channel
45
+registrations, and so on. To persist this data across restarts, you can mount
46
+a volume at /ircd.
47
+
48
+For example, to create a new docker volume and then mount it:
49
+
50
+```shell
51
+docker volume create oragono-data
52
+docker run -d -v oragono-data:/ircd -P oragono/oragono:tag
53
+```
54
+
55
+Or to mount a folder from your host machine:
56
+
57
+```shell
58
+mkdir oragono-data
59
+docker run -d -v $(PWD)/oragono-data:/ircd -P oragono/oragono:tag
60
+```
61
+
62
+## Customising the config
63
+
64
+Oragono's config file is stored at /ircd/ircd.yaml. If the file does not
65
+exist, the default config will be written out. You can copy the config from
66
+the container, edit it, and then copy it back:
67
+
68
+```shell
69
+# Assuming that your container is named `oragono`, as above.
70
+docker cp oragono:/ircd/ircd.yaml .
71
+vim ircd.yaml # edit the config to your liking
72
+docker cp ircd.yaml oragono:/ircd/ircd.yaml
73
+```
74
+
75
+You can use the `/rehash` command to make Oragono reload its config, or
76
+send it the HUP signal:
77
+
78
+```shell
79
+docker kill -HUP oragono
80
+```
81
+
82
+## Using custom TLS certificates
83
+
84
+TLS certs will by default be read from /ircd/tls.crt, with a private key
85
+in /ircd/tls.key. You can customise this path in the ircd.yaml file if
86
+you wish to mount the certificates from another volume. For information
87
+on using Let's Encrypt certificates, see
88
+[this manual entry](https://github.com/oragono/oragono/blob/master/docs/MANUAL.md#how-do-i-use-lets-encrypt-certificates).
89
+
90
+## Using docker-compose
91
+
92
+This folder contains a sample docker-compose file which can be used
93
+to start an Oragono instance with ports exposed and data persisted in
94
+a docker volume. Simply download the file and then bring it up:
95
+
96
+```shell
97
+curl -O https://raw.githubusercontent.com/oragono/oragono/master/distrib/docker/docker-compose.yml
98
+docker-compose up -d
99
+```
100
+
101
+## Building
102
+
103
+If you wish to manually build the docker image, you need to do so from
104
+the root of the Oragono repository (not the `distrib/docker` directory):
105
+
106
+```shell
107
+docker build -f distrib/docker/Dockerfile .
108
+```
109
+

+ 20
- 0
distrib/docker/docker-compose.yml Näytä tiedosto

@@ -0,0 +1,20 @@
1
+version: "3.2"
2
+
3
+services:
4
+  oragono:
5
+    image: oragono/oragono:latest
6
+    ports:
7
+      - "6667:6667/tcp"
8
+      - "6697:6697/tcp"
9
+    volumes:
10
+      - data:/ircd
11
+    deploy:
12
+      placement:
13
+        constraints:
14
+          - "node.role == manager"
15
+      restart_policy:
16
+        condition: on-failure
17
+      replicas: 1
18
+
19
+volumes:
20
+  data:

+ 29
- 0
distrib/docker/run.sh Näytä tiedosto

@@ -0,0 +1,29 @@
1
+#!/bin/sh
2
+
3
+# start in right dir
4
+cd /ircd
5
+
6
+# make config file
7
+if [ ! -f "/ircd/ircd.yaml" ]; then
8
+    awk '{gsub(/path: languages/,"path: /ircd-bin/languages")}1' /ircd-bin/oragono.yaml > /tmp/ircd.yaml
9
+
10
+    # change default oper passwd
11
+    OPERPASS=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c20)
12
+    echo "Oper username:password is dan:$OPERPASS"
13
+    ENCRYPTEDPASS=$(echo "$OPERPASS" | /ircd-bin/oragono genpasswd)
14
+    ORIGINALPASS='\$2a\$04\$LiytCxaY0lI.guDj2pBN4eLRD5cdM2OLDwqmGAgB6M2OPirbF5Jcu'
15
+
16
+    awk "{gsub(/password: \\\"$ORIGINALPASS\\\"/,\"password: \\\"$ENCRYPTEDPASS\\\"\")}1" /tmp/ircd.yaml > /tmp/ircd2.yaml
17
+
18
+    unset OPERPASS
19
+    unset ENCRYPTEDPASS
20
+    unset ORIGINALPASS
21
+
22
+    mv /tmp/ircd2.yaml /ircd/ircd.yaml
23
+fi
24
+
25
+# make self-signed certs if they don't already exist
26
+/ircd-bin/oragono mkcerts
27
+
28
+# run!
29
+exec /ircd-bin/oragono run

Loading…
Peruuta
Tallenna