For bare metal see: Admin Bare Metal Guide.
Note Mbin is still in development.
-
Docker Engine
-
Docker Compose V2
If you are using Compose V1, replace
docker composewithdocker-composein those commands below.
The most convenient way to install docker is using an official convenience script provided at get.docker.com:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.shAlternatively, you can follow the official Docker install documentation for your platform.
Once Docker is installed on your system, it is recommended to create a docker group and add it to your user:
sudo groupadd docker
sudo usermod -aG docker $USERClone git repository:
git clone https://github.com/MbinOrg/mbin.git
cd mbinBuild the Docker image:
Note If you're using a version of Docker Engine earlier than 23.0, run
export DOCKER_BUILDKIT=1, prior to building the image. This does not apply to users running Docker Desktop. More info can be found here
docker build -t mbin -f docker/Dockerfile .Create config files and storage directories:
cd docker
cp ../.env.example_docker .env
cp compose.prod.yml compose.override.yml
mkdir -p storage/media storage/caddy_config storage/caddy_data
sudo chown $USER:$USER storage/media storage/caddy_config storage/caddy_data- Choose your Redis password, PostgreSQL password, RabbitMQ password, and Mercure password.
- Place them in the corresponding variables in both
.envandcompose.override.yml.
Note Ensure the
HTTPSenvironmental variable is set toTRUEincompose.override.ymlfor thephp,messenger, andmessenger_apcontainers if your environment is using a valid certificate behind a reverse proxy. This is likely true for most production environments and is required for proper federation, that is, this will ensure the webfinger responses includehttps:in the URLs generated.
- Create an RSA key pair using OpenSSL:
# Replace <mbin_dir> with Mbin's root directory
mkdir <mbin_dir>/config/oauth2/
# If you protect the key with a passphrase, make sure to remember it!
# You will need it later
openssl genrsa -des3 -out ./config/oauth2/private.pem 4096
openssl rsa -in ./config/oauth2/private.pem --outform PEM -pubout -out ./config/oauth2/public.pem- Generate a random hex string for the OAuth2 encryption key:
openssl rand -hex 16- Add the public and private key paths to
.env:
OAUTH_PRIVATE_KEY=%kernel.project_dir%/config/oauth2/private.pem
OAUTH_PUBLIC_KEY=%kernel.project_dir%/config/oauth2/public.pem
OAUTH_PASSPHRASE=<Your (optional) passphrase from above here>
OAUTH_ENCRYPTION_KEY=<Hex string generated in previous step>By default docker compose will execute the compose.yml and compose.override.yml files.
Run the container in the background (-d means detached, but this can also be omitted for testing):
# Replace <mbin_dir> with Mbin's root directory
cd <mbin_dir>/docker
docker compose up -dSee your running containers via: docker ps.
Then, you should be able to access the new instance via http://localhost.
You can also access RabbitMQ management UI via http://localhost:15672.
Create new admin user (without email verification), please change the username, email and password below:
docker compose exec php bin/console kbin:user:create <username> <email@example.com> <password>
docker compose exec php bin/console kbin:user:admin <username>docker compose exec php bin/console kbin:ap:keys:updateNext, log in and create a magazine named "random" to which unclassified content from the fediverse will flow.
Add any auxiliary container as you want. For example, add a Nginx container as reverse proxy to provide HTTPS encryption.
Uploaded media files (e.g. photos uploaded by users) will be stored on the host directory storage/media. They will be served by the Caddy web server in the www container as static files.
Make sure KBIN_STORAGE_URL in your .env configuration file is set to be https://yourdomain.tld/media (assuming you setup Nginx with SSL certificate by now).
You can also serve those media files on another server by mirroring the files at storage/media and changing KBIN_STORAGE_URL correspondingly.
The filesystem ACL is disabled by default, in the mbin image. You can set the environment variable ENABLE_ACL=1 to enable it. Remember that not all filesystems support ACL. This will cause an error if you enable filesystem ACL for such filesystems.
If you created the file compose.override.yml with your configs (cp compose.prod.yml compose.override.yml), running production would be the same command:
docker compose up -dSee also the official: Deploying in Production guide.
If you want to deploy your app on a cluster of machines, you can use Docker Swarm, which is compatible with the provided Compose files.
docker compose exec php bin/console cache:clear
docker compose exec redis redis-cli
> auth REDIS_PASSWORD
> FLUSHDBdocker exec -it container_id pg_dump -U kbin mbin > dump.sql
docker compose exec -T database psql -U kbin mbin < dump.sql