Repository navigation
Expand file tree
/
Copy path.env.example
More file actions
173 lines (153 loc) · 7.58 KB
/
Copy path.env.example
File metadata and controls
173 lines (153 loc) · 7.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# npm-repo configuration
# Copy this to .env and edit. Nothing in here is read until you do, it's just
# sitting here looking helpful.
#
# cp .env.example .env
#
# everything has a working default, so the only line you really need to set is
# PUBLIC_URL. The rest is worth a read anyway.
# ----------------------------------------------------------------- the basics
# The address your developers will actually type. Tarball links in the metadata
# get rewritten to point here, so an install pulls from you and not from the
# public registry. Leave it blank and the app guesses from the Host header, which
# is fine for a quick try, but set it properly before anyone relies on it.
PUBLIC_URL=https://npm.example.com
# The first admin account. Only used on the very first start, when the users
# table is empty. Leave the password blank and a random one-time password is
# made and printed in the log (docker compose logs | grep "temporary password").
# Either way the portal asks for a new password at first sign in.
ADMIN_USER=admin
ADMIN_PASSWORD=
# ----------------------------------------------------------------- storage
#
# Where the database, the tarball cache and the metadata cache live.
#
# A bare name means a docker named volume. That's the default and the safest bet
# on a host you don't know well. Works the same on every distro and doesn't care
# about SELinux.
#
# A path starting with ./ or / means a plain host directory instead, which is
# easier to back up and poke around in. On RHEL, Rocky, Fedora or anything else
# running SELinux you'll need to relabel it first:
#
# sudo chcon -Rt svirt_sandbox_file_t ./data
#
# CAREFUL: `docker compose down -v` deletes a named volume and everything in it.
# it leaves a host directory alone.
DATA_PATH=npm-repo-data
#DATA_PATH=./data
# ----------------------------------------------------------------- networking
# Which host address to publish the port on. 127.0.0.1 means only this machine
# can reach it, which is what you want with a reverse proxy in front.
# Use 0.0.0.0 to expose it to the network directly, but then put a real
# certificate on it, or npm tokens cross the wire in clear text for anyone to read.
HOST_BIND=127.0.0.1
HOST_PORT=4444
# How many proxies sit in front of the app.
#
# 1 is right for the usual single nginx or Traefik in front. It has to be at least
# 1 even for a proxy on the same box, because docker publishes the port and the
# connection arrives from the bridge gateway, not from localhost.
# Only set it to 0 if nothing proxies this at all.
#
# Whatever proxy you use MUST overwrite X-Forwarded-For, not append to it, or a
# client can pretend to be any address it likes and stroll right through the ip
# whitelist. The bundled nginx config gets this right.
#
# A number trusts X-Forwarded-For from any connection that reaches the port, not
# just the proxy. If anything other than the proxy can reach HOST_BIND:HOST_PORT,
# it can claim to be an allowed address. So either keep the port where only the
# proxy can reach it, or put the address the proxy connects from here instead of a
# number, and then the header is believed from nowhere else. The app warns at
# start up for as long as this is a number.
TRUST_PROXY=1
# Marks the session cookie secure, so the browser only sends it over https.
# leave it on unless you're testing over plain http on localhost
SECURE_COOKIES=1
# ----------------------------------------------------------------- upstream
# Where packages come from when they aren't cached yet. These two only seed the
# default registry, the first time the box starts with an empty database. After
# that the list lives in the database and is managed under Settings, where you can
# add more registries and give each one a pattern like @acme/*. Changing these
# later does nothing, so don't sit there wondering why.
UPSTREAM_REGISTRY=https://registry.npmjs.org
#only needed if your upstream wants a token. usually blank
UPSTREAM_TOKEN=
# ----------------------------------------------------------------- odds and ends
CONTAINER_NAME=npm-repo
IMAGE_TAG=latest
TZ=UTC
# What this box is called in Utilization history. Defaults to CONTAINER_NAME, so
# recreating the container carries on the same history. Only worth setting when
# several nodes share one database.
#NODE_NAME=npm-repo
# ----------------------------------------------------------------- clamav
#
# Uncomment to run ClamAV next to ForgeRepo for the malware scanner. Then in
# Settings -> Malware set the clamd host to "clamav", port 3310, and add clamav to
# the scanners. It needs internet for its signatures and roughly 2-3GB of memory.
#COMPOSE_PROFILES=clamav
# How many times a day ClamAV checks for new signatures. It updates itself and
# reloads, nothing else to do. 12 is every two hours. ClamAV's mirrors ask for no
# more than once an hour, so keep it between 1 and 24.
#CLAMAV_UPDATE_CHECKS=12
# Portal session length, in hours, before you have to log in again.
SESSION_HOURS=12
# ---------------------------------------------------------------------------
# Database
# ---------------------------------------------------------------------------
# Leave DB_HOST empty and the container runs its own database on a unix socket.
# That's the normal single box setup and needs nothing here.
#
# Set DB_HOST and the local database isn't started at all. The app talks to an
# outside server instead, which is how you run more than one node against shared
# rules, users and audit. RDS, Cloud SQL, or your own MySQL or MariaDB box all
# work; the schema builds itself on first boot either way.
#
# Before pointing at an outside server, create the database and a user for it:
#
# CREATE DATABASE npmrepo CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
# CREATE USER 'npmrepo'@'%' IDENTIFIED BY 'a long password';
# GRANT ALL PRIVILEGES ON npmrepo.* TO 'npmrepo'@'%';
#
# ALL PRIVILEGES on that one database, not just read and write. Every boot runs
# CREATE TABLE IF NOT EXISTS and the migrations run ALTER TABLE, so the user needs
# schema rights or the app won't start.
#
# Moving an existing single box onto an outside server? Run this while the
# container is still on its own database, BEFORE setting DB_HOST below:
#
# docker exec npm-repo node /opt/npmrepo/src/migrate-db.js --check \
# --host db.example.com --user npmrepo --password 'secret' --ssl rds
#
# ...same again with --run once the preflight is clean.
#
# It copies everything across and leaves the local database alone, so backing out
# is just emptying DB_HOST again. --skip-packuments leaves the cached npm metadata
# behind, which is most of the size and gets refetched on demand anyway.
#
#DB_HOST=npmrepo.abc123.eu-west-1.rds.amazonaws.com
#DB_PORT=3306
#DB_NAME=npmrepo
#DB_USER=npmrepo
#DB_PASSWORD=
#DB_POOL=10
# TLS to the database. Unset means none, which is fine for the built in database
# since it never leaves the container. For anything going over a network, turn
# it on.
#
# rds verify against Amazon's CA chain, which ships with the driver.
# the one to use for RDS, no certificate file needed
# 1 encrypt and verify against the system certificate store
# 0 off
#
# MySQL 8 authenticates with caching_sha2_password, which wants an encrypted
# connection, so turn this on for MySQL 8 whether or not it's on RDS.
#DB_SSL=rds
#DB_SSL_CA=/data/rds-ca.pem
#DB_SSL_VERIFY=1
# Biggest rule file the import will take in one request, in megabytes. No limit on
# the number of rules in a file, only on how much text arrives at once, and a rule
# averages about 200 bytes. The default fits roughly 300,000 of them. The browser
# reads this same number back from the server, so both ends agree on what fits.
MAX_IMPORT_MB=64