Skip to content

Commit 7000103

Browse files
committed
Initial
1 parent 6793c79 commit 7000103

File tree

23 files changed

+354
-0
lines changed

23 files changed

+354
-0
lines changed

Dockerfile

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
FROM ghcr.io/linuxserver/baseimage-alpine:edge AS buildstage
2+
3+
ARG SL_RELEASE
4+
5+
RUN \
6+
echo "**** install build packages ****" && \
7+
apk add \
8+
nodejs \
9+
npm \
10+
p7zip \
11+
zip
12+
13+
RUN \
14+
echo "**** grab simplelogin ****" && \
15+
mkdir /simplelogin && \
16+
if [ -z ${SL_RELEASE+x} ]; then \
17+
SL_RELEASE=$(curl -sX GET "https://api.github.com/repos/simple-login/app/releases/latest" \
18+
| jq -r '. | .tag_name'); \
19+
fi && \
20+
curl -o \
21+
/tmp/simplelogin.tar.gz -L \
22+
"https://github.com/simple-login/app/archive/${SL_RELEASE}.tar.gz" && \
23+
tar xf \
24+
/tmp/simplelogin.tar.gz -C \
25+
/simplelogin/ --strip-components=1
26+
27+
RUN \
28+
echo "**** build simplelogin ****" && \
29+
cd /simplelogin/static && \
30+
npm ci
31+
32+
FROM ghcr.io/linuxserver/baseimage-ubuntu:noble
33+
34+
# set version label
35+
ARG BUILD_DATE
36+
ARG VERSION
37+
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
38+
LABEL maintainer="quietsy"
39+
40+
COPY --from=buildstage /simplelogin/ /code/
41+
42+
WORKDIR /code
43+
44+
ENV PATH="$HOME/.local/bin:/code/.venv/bin:$PATH"
45+
46+
# Install deps
47+
RUN \
48+
echo "**** install build packages ****" && \
49+
apt-get update && \
50+
apt-get install -y \
51+
git \
52+
libre2-dev \
53+
pkg-config \
54+
ninja-build \
55+
clang && \
56+
curl -o /tmp/uv-installer.sh -L https://astral.sh/uv/install.sh && \
57+
sh /tmp/uv-installer.sh && \
58+
uv python install `cat .python-version` && \
59+
uv sync --locked && \
60+
echo "**** install runtime packages ****" && \
61+
apt-get install -y \
62+
gnupg \
63+
libre2-10 && \
64+
echo "**** cleanup ****" && \
65+
apt-get purge -y \
66+
git \
67+
libre2-dev \
68+
pkg-config \
69+
ninja-build \
70+
clang && \
71+
apt-get autoremove -y && \
72+
apt-get autoclean -y && \
73+
rm -rf \
74+
/var/lib/apt/lists \
75+
$HOME/.cache \
76+
/tmp/*
77+
78+
# copy local files
79+
COPY root/ /
80+
81+
# ports and volumes
82+
EXPOSE 7777
83+
VOLUME /config

root/defaults/simplelogin.env

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
# This file contains all available options in SimpleLogin.
2+
# Some are optional and are commented out by default.
3+
# Some are only relevant for our SaaS version, for example for payment integration, analytics, etc.
4+
5+
# Server url
6+
URL=http://localhost:7777
7+
8+
# If you want to enable sentry for error tracking, put your sentry dsn here.
9+
# SENTRY_DSN=your_sentry_dsn
10+
11+
# Possible to use another sentry project for the front-end to avoid noises
12+
# If not set, fallback to SENTRY_DSN
13+
# SENTRY_FRONT_END_DSN=your_sentry_dsn
14+
15+
# apply colored log to facilitate local development
16+
# COLOR_LOG=true
17+
18+
# Only print email content, not sending it, for local development
19+
# NOT_SEND_EMAIL=true
20+
21+
# domain used to create alias
22+
EMAIL_DOMAIN=sl.local
23+
24+
# Allow SimpleLogin to enforce SPF by using the extra headers from postfix
25+
# ENFORCE_SPF=true
26+
27+
# other domains that can be used to create aliases, in addition to EMAIL_DOMAIN
28+
# OTHER_ALIAS_DOMAINS=["domain1.com", "domain2.com"]
29+
30+
# domains that can be used to create aliases. If set, override OTHER_ALIAS_DOMAINS
31+
# ALIAS_DOMAINS=["domain1.com", "domain2.com"]
32+
33+
# (optional) domains that are only available to premium accounts
34+
# PREMIUM_ALIAS_DOMAINS=["premium.com"]
35+
36+
# the alias domain used when creating the first alias for user, default to EMAIL_DOMAIN if not set
37+
# FIRST_ALIAS_DOMAIN = another-domain.com
38+
39+
# transactional email is sent from this email address
40+
SUPPORT_EMAIL=[email protected]
41+
SUPPORT_NAME=Son from SimpleLogin
42+
43+
# To use VERP
44+
# prefix must end with + and suffix must start with +
45+
# BOUNCE_PREFIX = "bounces+"
46+
# BOUNCE_SUFFIX = "[email protected]"
47+
# same as BOUNCE_PREFIX but used for reply phase. Note it doesn't have the plus sign (+) at the end.
48+
# BOUNCE_PREFIX_FOR_REPLY_PHASE = "bounce_reply"
49+
50+
# to receive general stats.
51+
52+
53+
# Max number emails user can generate for free plan
54+
# Set to 5 by default
55+
MAX_NB_EMAIL_FREE_PLAN=10000
56+
57+
# Close registration. Avoid people accidentally creating new account on a self-hosted SimpleLogin
58+
# DISABLE_REGISTRATION=1
59+
60+
# custom domain needs to point to these MX servers
61+
EMAIL_SERVERS_WITH_PRIORITY=[(10, "email.hostname.")]
62+
63+
# By default, new aliases must end with ".{random_word}". This is to avoid a person taking all "nice" aliases.
64+
# this option doesn't make sense in self-hosted. Set this variable to disable this option.
65+
DISABLE_ALIAS_SUFFIX=1
66+
67+
# If you want to use another MTA to send email, you could set the address of your MTA here
68+
# By default, emails are sent using the the same Postfix server that receives emails
69+
# POSTFIX_SERVER=my-postfix.com
70+
71+
# the DKIM private key used to compute DKIM-Signature
72+
DKIM_PRIVATE_KEY_PATH=/config/dkim.key
73+
74+
# DB Connection
75+
DB_URI=postgresql://myuser:mypassword@localhost:5432/simplelogin
76+
77+
FLASK_SECRET=secret
78+
79+
# AWS params
80+
# BUCKET=to_fill
81+
# AWS_ACCESS_KEY_ID=to_fill
82+
# AWS_SECRET_ACCESS_KEY=to_fill
83+
# AWS_REGION=to_fill
84+
85+
# Paddle
86+
# PADDLE_VENDOR_ID=123
87+
# PADDLE_MONTHLY_PRODUCT_ID=123
88+
# PADDLE_YEARLY_PRODUCT_ID=123
89+
# PADDLE_PUBLIC_KEY_PATH=local_data/paddle.key.pub
90+
# PADDLE_AUTH_CODE=123
91+
92+
# OpenId key
93+
# OPENID_PRIVATE_KEY_PATH=local_data/jwtRS256.key
94+
# OPENID_PUBLIC_KEY_PATH=local_data/jwtRS256.key.pub
95+
96+
# Words to generate random email alias
97+
WORDS_FILE_PATH=local_data/test_words.txt
98+
99+
# Login with Github
100+
# GITHUB_CLIENT_ID=to_fill
101+
# GITHUB_CLIENT_SECRET=to_fill
102+
103+
# Login with Google
104+
# GOOGLE_CLIENT_ID=to_fill
105+
# GOOGLE_CLIENT_SECRET=to_fill
106+
107+
# Login with Facebook
108+
# FACEBOOK_CLIENT_ID=to_fill
109+
# FACEBOOK_CLIENT_SECRET=to_fill
110+
111+
# Login with Proton
112+
# PROTON_CLIENT_ID=to_fill
113+
# PROTON_CLIENT_SECRET=to_fill
114+
# PROTON_BASE_URL=to_fill
115+
# PROTON_VALIDATE_CERTS=true
116+
# CONNECT_WITH_PROTON=true
117+
# CONNECT_WITH_PROTON_COOKIE_NAME=to_fill
118+
119+
# Login with OIDC
120+
# CONNECT_WITH_OIDC_ICON=fa-github
121+
# OIDC_WELL_KNOWN_URL=to_fill
122+
# OIDC_SCOPES=openid email profile
123+
# OIDC_NAME_FIELD=name
124+
# OIDC_CLIENT_ID=to_fill
125+
# OIDC_CLIENT_SECRET=to_fill
126+
127+
# Flask profiler
128+
# FLASK_PROFILER_PATH=/tmp/flask-profiler.sql
129+
# FLASK_PROFILER_PASSWORD=password
130+
131+
# Where to store GPG Keyring
132+
GNUPGHOME=/config/gnupg
133+
134+
# By default, files are uploaded to s3
135+
# Set this variable to use the local "static/upload/" directory instead
136+
LOCAL_FILE_UPLOAD=true
137+
138+
# The landing page
139+
# LANDING_PAGE_URL=https://simplelogin.io
140+
141+
# The status page
142+
# STATUS_PAGE_URL=https://status.simplelogin.io
143+
144+
# Used when querying info on Apple API
145+
# APPLE_API_SECRET=secret
146+
# MACAPP_APPLE_API_SECRET=secret
147+
148+
# Disable onboarding emails
149+
# For self-hosted instance
150+
DISABLE_ONBOARDING=true
151+
152+
# By default use postfix port 25. This param is used to override the Postfix port,
153+
# useful when using another SMTP server when developing locally
154+
# POSTFIX_PORT=1025
155+
156+
# set the 2 below variables to enable hCaptcha
157+
# HCAPTCHA_SECRET=very_long_string
158+
# HCAPTCHA_SITEKEY=00000000-0000-0000-0000-000000000000
159+
160+
# Set the 2 below variables to enable Plausible Analytics
161+
# PLAUSIBLE_HOST=https://plausible.io
162+
# PLAUSIBLE_DOMAIN=yourdomain.com
163+
164+
# Spamassassin server
165+
# SPAMASSASSIN_HOST = 127.0.0.1
166+
167+
# if set, used to sign the forwarding emails
168+
# PGP_SENDER_PRIVATE_KEY_PATH=local_data/private-pgp.asc
169+
170+
# Coinbase
171+
# COINBASE_WEBHOOK_SECRET=to_fill
172+
# COINBASE_CHECKOUT_ID=to_fill
173+
# COINBASE_API_KEY=to_fill
174+
# COINBASE_YEARLY_PRICE=30.00
175+
176+
# set the frequency limit on alias creation
177+
# ALIAS_LIMIT = "100/day;50/hour;5/minute"
178+
179+
# whether to enable spam scan using SpamAssassin
180+
# ENABLE_SPAM_ASSASSIN = 1
181+
182+
# Have I Been Pwned
183+
# HIBP_SCAN_INTERVAL_DAYS = 7
184+
# HIBP_API_KEYS=[]
185+
186+
# POSTMASTER = [email protected]
187+
188+
# TEMP_DIR = /tmp
189+
190+
# ALIAS_AUTOMATIC_DISABLE=true
191+
192+
# domains that can be present in the &next= section when using absolute urls
193+
ALLOWED_REDIRECT_DOMAINS=[]
194+
195+
# DNS nameservers to be used by the app
196+
# Multiple nameservers can be specified, separated by ','
197+
NAMESERVERS="1.1.1.1"
198+
PARTNER_API_TOKEN_SECRET="changeme"

root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-sl-config

Whitespace-only changes.

root/etc/s6-overlay/s6-rc.d/init-sl-config/dependencies.d/init-config

Whitespace-only changes.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/with-contenv bash
2+
# shellcheck shell=bash
3+
4+
mkdir -p \
5+
/config/gnupg \
6+
/config/upload
7+
8+
if [[ ! -f "/config/dkim.key" ]]; then
9+
openssl genrsa -out /config/dkim.key -traditional 1024
10+
fi
11+
12+
if [[ ! -f "/config/dkim.pub.key" ]]; then
13+
openssl rsa -in /config/dkim.key -pubout -out /config/dkim.pub.key
14+
fi
15+
16+
if [[ ! -f "/config/simplelogin.env" ]]; then
17+
cp /defaults/simplelogin.env /config/simplelogin.env
18+
fi
19+
20+
lsiown -R abc:abc /config
21+
22+
ln -s /config /sl
23+
ln -s /config/upload /code/static/upload
24+
cp /config/simplelogin.env /code/.env
25+
26+
if [[ -z "${DB_URI}" ]]; then
27+
echo "*** No DB_URI set, cannot configure database settings. ***"
28+
sleep infinity
29+
else
30+
echo "*** Waiting for DB_URI ${DB_URI} to be reachable. ***"
31+
DBCOUNT=0
32+
HOST=$(echo $DB_URI | awk -F[:@/] '{print $6}')
33+
PORT=$(echo $DB_URI | awk -F[:@/] '{print $7}')
34+
while true; do
35+
if nc -w1 "${HOST}" "${PORT}" >/dev/null 2>&1; then
36+
break
37+
fi
38+
DBCOUNT=$((DBCOUNT+1))
39+
if [[ ${DBCOUNT} -gt 6 ]]; then
40+
echo "*** Defined DB_URI ${DB_URI} is not reachable, cannot proceed. ***"
41+
sleep infinity
42+
fi
43+
sleep 5
44+
done
45+
fi
46+
47+
cd /code
48+
alembic upgrade head
49+
/code/.venv/bin/python /code/init_app.py
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oneshot
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/etc/s6-overlay/s6-rc.d/init-sl-config/run

root/etc/s6-overlay/s6-rc.d/svc-sl-app/dependencies.d/init-services

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/with-contenv bash
2+
# shellcheck shell=bash
3+
4+
exec s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 7777" \
5+
cd /code /code/.venv/bin/gunicorn wsgi:app -b 0.0.0.0:7777 -w 1 --timeout 15

0 commit comments

Comments
 (0)