Skip to content

Commit 37b6ea6

Browse files
committed
Split Dockerfile into Build vs Run for compactness. Add password _FILE support. Add environmental variables and documentation for general settings. Synced settings with default anope download.
1 parent 357e463 commit 37b6ea6

File tree

13 files changed

+815
-739
lines changed

13 files changed

+815
-739
lines changed

Dockerfile

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,46 @@
1-
FROM alpine:3.23
2-
3-
LABEL org.opencontainers.image.authors="Anope Team <team@anope.org>"
1+
FROM alpine:3.23 AS builder
42

53
ARG VERSION=2.0
6-
ARG RUN_DEPENDENCIES="gnutls gnutls-utils mariadb-client mariadb-connector-c sqlite-libs"
74
ARG BUILD_DEPENDENCIES="gnutls-dev mariadb-dev sqlite-dev"
85
ARG EXTRA_MODULES="m_mysql m_sqlite m_ssl_gnutls"
96

10-
RUN apk add --no-cache --virtual .build-utils gcc g++ ninja git cmake $BUILD_DEPENDENCIES && \
11-
apk add --no-cache --virtual .dependencies libgcc libstdc++ $RUN_DEPENDENCIES && \
12-
# Create a user to run anope later
13-
adduser -u 10000 -h /anope/ -D -S anope && \
7+
RUN apk add --no-cache gcc g++ ninja git cmake $BUILD_DEPENDENCIES && \
148
mkdir -p /src && \
159
cd /src && \
16-
# Clone the requested version
1710
git clone --depth 1 https://github.com/anope/anope.git anope -b $VERSION && \
1811
cd /src/anope && \
19-
# Add and overwrite modules
2012
for module in $EXTRA_MODULES; do ln -s /src/anope/modules/extra/$module.cpp modules; done && \
2113
mkdir build && \
2214
cd /src/anope/build && \
2315
cmake -DINSTDIR=/anope/ -DDEFUMASK=077 -DCMAKE_BUILD_TYPE=RELEASE -GNinja .. && \
24-
# Run build multi-threaded
25-
ninja install && \
26-
# Uninstall all unnecessary tools after build process
27-
apk del .build-utils && \
28-
rm -rf /src && \
29-
# Provide a data location
16+
ninja install
17+
18+
FROM alpine:3.23
19+
20+
LABEL org.opencontainers.image.authors="Anope Team <team@anope.org>"
21+
22+
ARG RUN_DEPENDENCIES="gnutls gnutls-utils mariadb-client mariadb-connector-c sqlite-libs"
23+
24+
RUN apk add --no-cache libgcc libstdc++ $RUN_DEPENDENCIES && \
25+
adduser -u 10000 -h /anope/ -D -S anope && \
3026
mkdir -p /data && \
31-
touch /data/anope.db && \
32-
ln -s /data/anope.db /anope/data/anope.db && \
33-
# Make sure everything is owned by anope
27+
touch /data/anope.db
28+
29+
COPY --from=builder /anope /anope
30+
31+
RUN ln -s /data/anope.db /anope/data/anope.db && \
3432
chown -R anope /anope/ && \
3533
chown -R anope /data/
3634

3735
COPY ./conf/ /anope/conf/
3836

39-
RUN chown -R anope /anope/conf/
37+
RUN chown -R anope /anope/conf/ && \
38+
chmod 755 /anope/conf/*.sh
4039

4140
WORKDIR /anope/
4241

4342
VOLUME /data/
4443

4544
USER anope
4645

47-
CMD ["/anope/bin/services", "-n"]
46+
CMD ["/anope/bin/services", "--nofork"]

README.md

Lines changed: 97 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,113 @@ $ docker run --name anope -v /path/to/your/config:/anope/conf/ anope/anope
2525
```
2626

2727

28-
## Generated configuration
28+
# Configuration
2929

3030
This image provides various options to configure it by environment variables.
3131

32-
Use the following environment variables to configure your container:
32+
## Server Information
3333

3434
|Available variables |Default value |Description |
3535
|-------------------------|--------------------------------|--------------------------------------------|
3636
|`ANOPE_SERVICES_NAME` |`services.localhost.net` |Name of the services. *Important for uplink*|
37+
|`ANOPE_SERVICES_DESCRIPTION`|`Services for IRC Networks` |Description of the services |
3738
|`ANOPE_SERVICES_VHOST` |`services.localhost.net` |Host used by services pseudo clients |
39+
40+
## Uplink Configuration
41+
42+
|Available variables |Default value |Description |
43+
|-------------------------|--------------------------------|--------------------------------------------|
3844
|`ANOPE_UPLINK_IP` |no default |DNS name or IP of the uplink host |
3945
|`ANOPE_UPLINK_PORT` |`7000` |Port used to connect to uplink host |
4046
|`ANOPE_UPLINK_PASSWORD` |no default |Password used to authenticate against uplink|
47+
|`ANOPE_UPLINK_PASSWORD_FILE`|no default |File containing password used to authenticate against uplink|
48+
|`ANOPE_UPLINK_IPV6` |`no` |Enable if Services should connect using IPv6|
49+
|`ANOPE_UPLINK_SSL` |`no` |Enable if Services should connect using SSL |
4150

51+
## Network Information
52+
53+
|Available variables |Default value |Description |
54+
|-------------------------|--------------------------------|--------------------------------------------|
55+
|`ANOPE_NETWORK_NAME` |`LocalNet` |Name of the network |
56+
|`ANOPE_NICKLEN` |`31` |Maximum allowed nick length |
57+
|`ANOPE_USERLEN` |`10` |Maximum allowed ident length |
58+
|`ANOPE_HOSTLEN` |`64` |Maximum allowed hostname length |
59+
|`ANOPE_CHANLEN` |`32` |Maximum allowed channel length |
60+
|`ANOPE_MODELISTSIZE` |`100` |Maximum number of list modes settable |
4261

43-
## Database configuration
62+
## Options
63+
64+
|Available variables |Default value |Description |
65+
|-------------------------|--------------------------------|--------------------------------------------|
66+
|`ANOPE_CASEMAP` |`ascii` |Case mapping used by services |
67+
|`ANOPE_BADPASSLIMIT` |`5` |Invalid password tries before kill |
68+
|`ANOPE_BADPASSTIMEOUT` |`1h` |Time after which invalid passwords are forgotten|
69+
|`ANOPE_UPDATETIMEOUT` |`2m` |Delay between automatic database updates |
70+
|`ANOPE_EXPIRETIMEOUT` |`30m` |Delay between checks for expired nicks/chans|
71+
|`ANOPE_READTIMEOUT` |`5s` |Timeout period for reading from the uplink |
72+
|`ANOPE_TIMEOUTCHECK` |`3s` |Frequency at which the timeout list is checked|
73+
|`ANOPE_RETRYWAIT` |`60s` |Wait time between connection retries |
74+
|`ANOPE_HIDEPRIVILEGEDCOMMANDS`|`yes` |Hide commands users can't execute |
75+
|`ANOPE_HIDEREGISTEREDCOMMANDS`|`yes` |Hide commands unregistered users can't execute|
76+
|`ANOPE_DIDYOUMEANDIFFERENCE`|`4` |Max difference for command suggestions |
77+
|`ANOPE_CODELENGTH` |`15` |Length of confirmation codes |
78+
|`ANOPE_LINELENGTH` |`100` |Max bytes to wrap services messages |
79+
|`ANOPE_REGEXENGINE` |`regex/stdlib` |Regex engine to use |
80+
|`ANOPE_LANGUAGES` |`de_DE.UTF-8 ...` |List of languages to load |
81+
|`ANOPE_DEFAULTLANGUAGE` |`es_ES.UTF-8` |Default language for users |
82+
83+
## Mail Configuration
84+
85+
|Available variables |Default value |Description |
86+
|-------------------------|--------------------------------|--------------------------------------------|
87+
|`ANOPE_USEMAIL` |`no` |Enable mail commands |
88+
|`ANOPE_SENDMAILPATH` |`/usr/sbin/sendmail -t` |Command used for sending emails |
89+
|`ANOPE_SENDFROM` |`services@localhost.net` |Email address to send from |
90+
|`ANOPE_MAILDELAY` |`5m` |Minimum time between emails |
91+
|`ANOPE_DONTQUOTEADDRESSES`|`yes` |Don't quote TO: fields |
92+
|`ANOPE_MAIL_CONTENT_TYPE`|`text/plain; charset=UTF-8` |Content type for emails |
93+
|`ANOPE_MAIL_REGISTRATION_SUBJECT`|`Nickname registration for {nick}`|Subject for registration emails|
94+
|`ANOPE_MAIL_REGISTRATION_MESSAGE`|no default |Message for registration emails |
95+
|`ANOPE_MAIL_RESET_SUBJECT`|`Reset password request for {nick}`|Subject for password reset emails |
96+
|`ANOPE_MAIL_RESET_MESSAGE`|no default |Message for password reset emails |
97+
|`ANOPE_MAIL_EMAILCHANGE_SUBJECT`|`Email confirmation` |Subject for email change emails |
98+
|`ANOPE_MAIL_EMAILCHANGE_MESSAGE`|no default |Message for email change emails |
99+
|`ANOPE_MAIL_MEMO_SUBJECT`|`New memo` |Subject for memo emails |
100+
|`ANOPE_MAIL_MEMO_MESSAGE`|no default |Message for memo emails |
101+
102+
## Webcpanel Configuration
103+
104+
|Available variables |Default value |Description |
105+
|-------------------------|--------------------------------|--------------------------------------------|
106+
|`ANOPE_WEBCPANEL_ENABLE` |`no` |Enable webcpanel |
107+
|`ANOPE_WEBCPANEL_TITLE` |`Anope IRC Services` |Page title |
108+
|`ANOPE_HTTPD_IP` |`0.0.0.0` |IP to listen on |
109+
|`ANOPE_HTTPD_PORT` |`8080` |Port to listen on |
110+
|`ANOPE_HTTPD_SSL` |`no` |Listen using SSL |
111+
112+
## Operators
113+
114+
You can configure up to 20 operators using indexed variables `ANOPE_x_...` where `x` is a number from 0 to 19.
115+
116+
|Available variables |Default value |Description |
117+
|-------------------------|--------------------------------|--------------------------------------------|
118+
|`ANOPE_x_NAME` |no default |Oper's Nickname (Required) |
119+
|`ANOPE_x_TYPE` |`Services Root` |Opertype |
120+
|`ANOPE_x_REQUIRE_OPER` |`yes` |Require the oper to be oper'd on the ircd |
121+
|`ANOPE_x_PASSWORD` |no default |Optional password for oper access |
122+
|`ANOPE_x_PASSWORD_FILE` |no default |File containing password for oper access |
123+
|`ANOPE_x_CERTFP` |no default |Secure Cert finger print for oper access |
124+
|`ANOPE_x_HOST` |no default |Space separated Hostmask(s) for this oper |
125+
|`ANOPE_x_VHOST` |no default |Oper Vhost |
126+
127+
Available `ANOPE_x_TYPE` values (from `services.conf`):
128+
* `Services Root` (Default): Full access to all commands and privileges.
129+
* `Services Administrator`: Access to most administrative commands (BotServ, ChanServ, NickServ, OperServ, Global).
130+
* `Services Operator`: Access to basic operator commands (ChanServ, MemoServ, NickServ, OperServ).
131+
* `Helper`: Access to HostServ commands.
132+
133+
134+
## Database Configuration
44135

45136
This image provides two way to configure database handling. You can use sqlite inside a volume or an external mysqldb.
46137

@@ -67,7 +158,10 @@ For a production setup MySQL is the recommended way to set this image up. Checko
67158
|`ANOPE_MYSQL_PORT` |`3306` |Port used to access the mysql database |
68159
|`ANOPE_MYSQL_USER` |`anope` |Username for the MySQL database |
69160
|`ANOPE_MYSQL_PASSWORD` |no default |Password for the `ANOPE_MYSQL_USER` |
161+
|`ANOPE_MYSQL_PASSWORD_FILE`|no default |File containing password for the `ANOPE_MYSQL_USER`|
70162
|`ANOPE_SQL_LIVE` |`no` |Enable Anope SQL-DB live feature |
163+
|`ANOPE_SQL_PREFIX` |`anope_db_` |Prefix for SQL tables |
164+
|`ANOPE_SQL_IMPORT` |`false` |Import data from another DB module on startup|
71165

72166

73167
# Updates and updating
@@ -107,4 +201,3 @@ You can also reach many of the project maintainers via the `#anope` IRC channel
107201
## Contributing
108202

109203
You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can.
110-

conf/config.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,4 @@ define
66
name = "services.host"
77
value = "${ANOPE_SERVICES_VHOST:-services.localhost.net}"
88
}
9-
10-
define
11-
{
12-
name = "services.name"
13-
value = "${ANOPE_SERVICES_NAME:-services.localhost.net}"
14-
}
159
EOF

conf/database.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/bin/sh
22

3+
if [ -n "$ANOPE_MYSQL_PASSWORD_FILE" ]; then
4+
ANOPE_MYSQL_PASSWORD=$(cat "$ANOPE_MYSQL_PASSWORD_FILE")
5+
fi
6+
37
if [ "$ANOPE_SQL_LIVE" = "yes" ]; then
48
ANOPE_SQL_LIVE="_live"
59
else
@@ -19,7 +23,8 @@ cat <<EOF
1923
* db_sql_live module allows saving and loading databases using one of the SQL engines.
2024
* This module reads and writes to SQL in real time. Changes to the SQL tables
2125
* will be immediately reflected into Anope. This module should not be loaded
22-
* in conjunction with db_sql.
26+
* in conjunction with db_sql. It should also not be used on large networks as it
27+
* executes quite a lot of queries which can cause performance issues.
2328
*
2429
*/
2530
module
@@ -36,19 +41,21 @@ module
3641
* An optional prefix to prepended to the name of each created table.
3742
* Do not use the same prefix for other programs.
3843
*/
39-
#prefix = "anope_db_"
44+
prefix = "${ANOPE_SQL_PREFIX:-anope_db_}"
4045
4146
/* Whether or not to import data from another database module in to SQL on startup.
4247
* If you enable this, be sure that the database services is configured to use is
43-
* empty and that another database module to import from is loaded before db_sql.
44-
* After you enable this and do a database import you should disable it for
45-
* subsequent restarts.
48+
* empty and that another database module to import from is loaded BEFORE db_sql.
49+
* After you enable this and do a database import you MUST disable it for
50+
* subsequent restarts. If you want to keep writing a flatfile database after the
51+
* SQL import is done you should load db_flatfile AFTER this module.
4652
*
4753
* Note that you can not import databases using db_sql_live. If you want to import
4854
* databases and use db_sql_live you should import them using db_sql, then shut down
4955
* and start services with db_sql_live.
5056
*/
51-
import = false
57+
58+
import = ${ANOPE_SQL_IMPORT:-false}
5259
}
5360
EOF
5461

0 commit comments

Comments
 (0)