-
Notifications
You must be signed in to change notification settings - Fork 21
Rework docker setup #1542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework docker setup #1542
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: Melroy van den Berg <melroy@melroy.org>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
I think it's really ready this time! Of course, if I find anything else, I'll just make another PR. Once this is merged, I'm going to put it on kbin.earth. That will be the real test! |
Yeah! I'm really happy with this! Thank you so much! |
Changes to Docker setup
.env
andcompose.override.yaml
files are now stored in the root of the Mbin directory, with all other server specific data stored instorage/
(including OAuth keys).kbin
tombin
.17
.S3_KEY
is provided.301
status code) by default.Quick Start Guide
Use these steps to install Mbin on a new server. It is assumed that docker is already installed and set up.
git clone https://github.com/MbinOrg/mbin.git && cd mbin
(make sure to switch to this docker branch)../docker/setup.sh prod DOMAINHERE
(uselocalhost
for the domain if you want to test locally)..env
.docker build -t mbin -f docker/Dockerfile .
to build the Docker image.docker compose up -d
to start the Docker containers.80
and443
allowed) are correctly configured, then you should be able to access your new Mbin instance from your domain (or https://localhost_ if you usedlocalhost
)!Migration Guide
Use these steps to migrate from the old Docker setup to this one. The big thing to keep in mind is that all your server data is now in one of three locations:
.env
,compose.override.yaml
, andstorage/
. So, all server data will be going under here from now on.Additionally, this new setup does not require a reverse proxy (and actually recommends not using one), as the PHP server it's using comes with built-in HTTPS support via Let's Encrypt and Caddy. You will need to ensure ports
80
and443
are directly exposed and available on your server in order for this migration guide to work.git clone https://github.com/MbinOrg/mbin.git
)! I'll referenceold
as your old Mbin directory andnew
as your new one.new
(with this docker branch of course):./docker/setup.sh prod DOMAINHERE
.docker compose down
inold/docker
if you haven't already.old/docker/storage/postgres
tonew/storage/postgres
.old/docker/storage/media
tonew/storage/media
.old/config/oauth2
tonew/storage/oauth
(bothprivate.pem
andpublic.pem
).old/docker/.env
andnew/.env
side by side so you can copy values from the old.env
file to the new one as needed..env
values, includingKBIN_*
,MBIN_*
,MAX_IMAGE_BYTES
,HCAPTCHA_*
,S3_*
, the SSO fields,EXIF_*
,APP_SECRET
,POSTGRES_*
,MAILER_DSN
,MERCURE_JWT_SECRET
,OAUTH_PASSPHRASE
, andOAUTH_ENCRYPTION_KEY
. Everything else, you can leave alone; feel free to ask if you have any questions about this.new/storage/
to matchMBIN_USER
in.env
. Runchown -R 1000:1000 new/storage/
if yourMBIN_USER
is1000:1000
. Running the new setup under root has not been tested yet, but you will likely not need to change any file permissions if you were running as root previously.new/compose.override.yaml
, uncomment the section that enables you to build the Docker image locally.new
, rundocker compose up -d
to build and start the Docker containers.To Do
compose.override.yaml
instead ofcompose.prod.yaml
to use the prebuilt image.