Browse Source

Got multi stage working for #2 and small distro

pull/4/head
Jason Singleton 6 years ago
parent
commit
a523c4812f
3 changed files with 342 additions and 25 deletions
  1. 15
    8
      Dockerfile
  2. 327
    0
      oragono.yaml
  3. 0
    17
      run.sh

+ 15
- 8
Dockerfile View File

@@ -6,20 +6,27 @@ RUN apt-get install -y git
6 6
 RUN mkdir -p /go/src/github.com/oragono
7 7
 WORKDIR /go/src/github.com/oragono
8 8
 
9
-RUN git clone https://github.com/oragono/oragono.git
9
+RUN git clone -b stable https://github.com/oragono/oragono.git
10 10
 WORKDIR /go/src/github.com/oragono/oragono
11 11
 RUN git submodule update --init
12
-RUN make linux
13 12
 
14
-# run in Alpine, being a lightweight distro
15
-FROM alpine:latest
13
+# compile
14
+RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s" -o build/docker/oragono oragono.go
15
+
16
+
17
+# run in a lightweight distro
18
+FROM alpine
19
+
16 20
 EXPOSE 6667/tcp 6697/tcp
17 21
 
18 22
 RUN mkdir -p /ircd
19 23
 WORKDIR /ircd
24
+COPY --from=build-env /go/src/github.com/oragono/oragono/build/docker/ .
25
+COPY oragono.yaml ircd.yaml
20 26
 
21
-COPY --from=build-env /go/src/github.com/oragono/oragono/build/oragono-XXX-linux.tgz /
22
-RUN tar -xzf /oragono-XXX-linux.tgz
23
-COPY run.sh /ircd
27
+# init
28
+RUN ./oragono initdb
29
+RUN ./oragono mkcerts
24 30
 
25
-CMD ["./run.sh"]
31
+# launch
32
+CMD ./oragono run

+ 327
- 0
oragono.yaml View File

@@ -0,0 +1,327 @@
1
+# oragono IRCd config
2
+
3
+# network configuration
4
+network:
5
+    # name of the network
6
+    name: OragonoTest
7
+
8
+# server configuration
9
+server:
10
+    # server name
11
+    name: oragono.test
12
+
13
+    # addresses to listen on
14
+    listen:
15
+        - ":6667"
16
+        - "127.0.0.1:6668"
17
+        #- "[::1]:6668"
18
+        - ":6697" # ssl port
19
+
20
+    # tls listeners
21
+    tls-listeners:
22
+        # listener on ":6697"
23
+        ":6697":
24
+            key: tls.key
25
+            cert: tls.crt
26
+
27
+    # strict transport security, to get clients to automagically use TLS
28
+    sts:
29
+        # whether to advertise STS
30
+        #
31
+        # to stop advertising STS, leave this enabled and set 'duration' below to "0". this will
32
+        # advertise to connecting users that the STS policy they have saved is no longer valid
33
+        enabled: false
34
+
35
+        # how long clients should be forced to use TLS for.
36
+        # setting this to a too-long time will mean bad things if you later remove your TLS.
37
+        # the default duration below is 1 month, 2 days and 5 minutes.
38
+        duration: 1mo2d5m
39
+
40
+        # tls port - you should be listening on this port above
41
+        port: 6697
42
+
43
+        # should clients include this STS policy when they ship their inbuilt preload lists?
44
+        preload: false
45
+
46
+    # use ident protocol to get usernames
47
+    check-ident: true
48
+
49
+    # password to login to the server
50
+    # generated using  "oragono genpasswd"
51
+    #password: ""
52
+
53
+    # motd filename
54
+    # if you change the motd, you should move it to ircd.motd
55
+    motd: oragono.motd
56
+
57
+    # motd formatting codes
58
+    # if this is true, the motd is escaped using formatting codes like $c, $b, and $i
59
+    #motd-formatting: true
60
+
61
+    # addresses/hostnames the PROXY command can be used from
62
+    # this should be restricted to 127.0.0.1 and localhost at most
63
+    # you should also add these addresses to the connection limits and throttling exemption lists
64
+    proxy-allowed-from:
65
+        # - localhost
66
+        # - "127.0.0.1"
67
+
68
+    # controls the use of the WEBIRC command (by IRC<->web interfaces, bouncers and similar)
69
+    webirc:
70
+        # one webirc block -- should correspond to one set of gateways
71
+        -
72
+            # tls fingerprint the gateway must connect with to use this webirc block
73
+            fingerprint: 938dd33f4b76dcaf7ce5eb25c852369cb4b8fb47ba22fc235aa29c6623a5f182
74
+
75
+            # password the gateway uses to connect, made with  oragono genpasswd
76
+            password: JDJhJDA0JG9rTTVERlNRa0hpOEZpNkhjZE95SU9Da1BseFdlcWtOTEQxNEFERVlqbEZNTkdhOVlYUkMu
77
+
78
+            # hosts that can use this webirc command
79
+            hosts:
80
+                # - localhost
81
+                # - "127.0.0.1"
82
+                # - "0::1"
83
+
84
+    # maximum length of clients' sendQ in bytes
85
+    # this should be big enough to hold /LIST and HELP replies
86
+    max-sendq: 16k
87
+
88
+    # maximum number of connections per subnet
89
+    connection-limits:
90
+        # whether to enforce connection limits or not
91
+        enabled: true
92
+
93
+        # how wide the cidr should be for IPv4
94
+        cidr-len-ipv4: 32
95
+
96
+        # how wide the cidr should be for IPv6
97
+        cidr-len-ipv6: 64
98
+
99
+        # maximum number of IPs per subnet (defined above by the cird length)
100
+        ips-per-subnet: 16
101
+
102
+        # IPs/networks which are exempted from connection limits
103
+        exempted:
104
+            - "127.0.0.1"
105
+            - "127.0.0.1/8"
106
+            - "::1/128"
107
+
108
+    # automated connection throttling
109
+    connection-throttling:
110
+        # whether to throttle connections or not
111
+        enabled: true
112
+
113
+        # how wide the cidr should be for IPv4
114
+        cidr-len-ipv4: 32
115
+
116
+        # how wide the cidr should be for IPv6
117
+        cidr-len-ipv6: 64
118
+
119
+        # how long to keep track of connections for
120
+        duration: 10m
121
+
122
+        # maximum number of connections, per subnet, within the given duration
123
+        max-connections: 32
124
+
125
+        # how long to ban offenders for, and the message to use
126
+        # after banning them, the number of connections is reset (which lets you use UNDLINE to unban people)
127
+        ban-duration: 10m
128
+        ban-message: You have attempted to connect too many times within a short duration. Wait a while, and you will be able to connect.
129
+
130
+        # IPs/networks which are exempted from connection limits
131
+        exempted:
132
+            - "127.0.0.1"
133
+            - "127.0.0.1/8"
134
+            - "::1/128"
135
+
136
+# account options
137
+accounts:
138
+    # account registration
139
+    registration:
140
+        # can users register new accounts?
141
+        enabled: true
142
+
143
+        # length of time a user has to verify their account before it can be re-registered
144
+        # default is 120 hours, or 5 days
145
+        verify-timeout: "120h"
146
+
147
+        # callbacks to allow
148
+        enabled-callbacks:
149
+            - none # no verification needed, will instantly register successfully
150
+        
151
+        # allow multiple account registrations per connection
152
+        # this is for testing purposes and shouldn't be allowed on real networks
153
+        allow-multiple-per-connection: false
154
+
155
+    # is account authentication enabled?
156
+    authentication-enabled: true
157
+
158
+# channel options
159
+channels:
160
+    # modes that are set when new channels are created
161
+    # +n is no-external-messages and +t is op-only-topic
162
+    # see  /QUOTE HELP cmodes  for more channel modes
163
+    default-modes: +nt
164
+
165
+    # channel registration - requires an account
166
+    registration:
167
+        # can users register new channels?
168
+        enabled: true
169
+
170
+# operator classes
171
+oper-classes:
172
+    # local operator
173
+    "local-oper":
174
+        # title shown in WHOIS
175
+        title: Local Operator
176
+
177
+        # capability names
178
+        capabilities:
179
+            - "oper:local_kill"
180
+            - "oper:local_ban"
181
+            - "oper:local_unban"
182
+
183
+    # network operator
184
+    "network-oper":
185
+        # title shown in WHOIS
186
+        title: Network Operator
187
+
188
+        # oper class this extends from
189
+        extends: "local-oper"
190
+
191
+        # capability names
192
+        capabilities:
193
+            - "oper:remote_kill"
194
+            - "oper:remote_ban"
195
+            - "oper:remote_unban"
196
+
197
+    # server admin
198
+    "server-admin":
199
+        # title shown in WHOIS
200
+        title: Server Admin
201
+
202
+        # oper class this extends from
203
+        extends: "local-oper"
204
+
205
+        # capability names
206
+        capabilities:
207
+            - "oper:rehash"
208
+            - "oper:die"
209
+            - "samode"
210
+
211
+# ircd operators
212
+opers:
213
+    # operator named 'dan'
214
+    dan:
215
+        # which capabilities this oper has access to
216
+        class: "server-admin"
217
+
218
+        # custom whois line
219
+        whois-line: is a cool dude
220
+
221
+        # custom hostname
222
+        vhost: "n"
223
+
224
+        # modes are the modes to auto-set upon opering-up
225
+        modes: +is acjknoqtux
226
+
227
+        # password to login with /OPER command
228
+        # generated using  "oragono genpasswd"
229
+        password: JDJhJDA0JE1vZmwxZC9YTXBhZ3RWT2xBbkNwZnV3R2N6VFUwQUI0RUJRVXRBRHliZVVoa0VYMnlIaGsu
230
+
231
+# logging, takes inspiration from Insp
232
+logging:
233
+    -
234
+        # how to log these messages
235
+        #
236
+        #   file    log to given target filename
237
+        #   stdout  log to stdout
238
+        #   stderr  log to stderr
239
+        method: file stderr
240
+
241
+        # filename to log to, if file method is selected
242
+        filename: ircd.log
243
+
244
+        # type(s) of logs to keep here. you can use - to exclude those types
245
+        #
246
+        # exclusions take precedent over inclusions, so if you exclude a type it will NEVER
247
+        # be logged, even if you explicitly include it
248
+        #
249
+        # useful types include:
250
+        #   *               everything (usually used with exclusing some types below)
251
+        #   accounts        account registration and authentication
252
+        #   channels        channel creation and operations
253
+        #   commands        command calling and operations
254
+        #   opers           oper actions, authentication, etc
255
+        #   password        password hashing and comparing
256
+        #   userinput       raw lines sent by users
257
+        #   useroutput      raw lines sent to users
258
+        type: "* -userinput -useroutput -localconnect -localconnect-ip"
259
+
260
+        # one of: debug info warn error
261
+        level: info
262
+    -
263
+        # avoid logging IP addresses to file
264
+        method: stderr
265
+        type: localconnect localconnect-ip
266
+        level: debug
267
+
268
+# debug options
269
+debug:
270
+    # when enabled, oragono will attempt to recover from certain kinds of
271
+    # client-triggered runtime errors that would normally crash the server.
272
+    # this makes the server more resilient to DoS, but could result in incorrect
273
+    # behavior. deployments that would prefer to "start from scratch", e.g., by
274
+    # letting the process crash and auto-restarting it with systemd, can set
275
+    # this to false.
276
+    recover-from-errors: true
277
+
278
+    # enabling StackImpact profiling
279
+    stackimpact:
280
+        # whether to use StackImpact
281
+        enabled: false
282
+
283
+        # the AgentKey to use
284
+        agent-key: examplekeyhere
285
+
286
+        # the app name to report
287
+        app-name: Oragono
288
+
289
+# datastore configuration
290
+datastore:
291
+    # path to the datastore
292
+    path: ircd.db
293
+
294
+# limits - these need to be the same across the network
295
+limits:
296
+    # nicklen is the max nick length allowed
297
+    nicklen: 32
298
+
299
+    # channellen is the max channel length allowed
300
+    channellen: 64
301
+
302
+    # awaylen is the maximum length of an away message
303
+    awaylen: 500
304
+
305
+    # kicklen is the maximum length of a kick message
306
+    kicklen: 1000
307
+
308
+    # topiclen is the maximum length of a channel topic
309
+    topiclen: 1000
310
+
311
+    # maximum number of monitor entries a client can have
312
+    monitor-entries: 100
313
+
314
+    # whowas entries to store
315
+    whowas-entries: 100
316
+
317
+    # maximum length of channel lists (beI modes)
318
+    chan-list-modes: 60
319
+
320
+    # maximum length of IRC lines
321
+    # this should generally be 1024-2048, and will only apply when negotiated by clients
322
+    linelen:
323
+        # tags section
324
+        tags: 2048
325
+
326
+        # rest of the message
327
+        rest: 2048

+ 0
- 17
run.sh View File

@@ -1,17 +0,0 @@
1
-#!/bin/sh
2
-
3
-set -e
4
-
5
-if [ ! -f ./ircd.yaml ]; then
6
-  cp oragono.yaml ircd.yaml
7
-fi
8
-
9
-if [ ! -f ircd.db ]; then
10
-  ./oragono initdb
11
-fi
12
-
13
-if [ ! -f tls.crt ]; then
14
-  ./oragono mkcerts
15
-fi
16
-
17
-exec ./oragono run

Loading…
Cancel
Save