There are multiple ways to use Magic, depending upon whether or not you just want to try it out locally on your development machine, use the Docker images to more rapidly getting up to speed, or deploy it to your production server. In this section we’ll walk you through all of your options, starting with the easiest method, to start out with Magic on your development machine.
The easiest way to get started is to download the docker-compose.yml file, assuming you have Docker installed, and then execute the following in a terminal window where you saved the file. This is the exact same process for both Windows, Mac and Linux - And can also be extended to install Magic in your server or cloud of choice. Notice, you’ll need to have Docker installed on your development machine if you want to follow this approach.
Then when the Docker containers have started, open your browser and go to http://localhost:5555, and use the default configuration settings for MySQL, choose a root password, type your name and email address when you generate a key pair, and Magic should work out of the box without having to mess with anything.
If you don’t want to use Docker, you can also configure your development environment locally on your development machine using the code directly. If so you will first of all need the following components.
In the video below I go through the manual setup process.
Notice - This part is not entirely done quite yet, and you might have to fiddle with the
file a bit to make it work adequately. However, the basics of this file should be more or less done …
The easiest way to deploy Magic into production, is to use the following docker-compose file.
Copy the content below into a file named
servergardens.com with your own
domain, replace firstname.lastname@example.org with your own email address, make sure your server has Docker installed,
docker-compose up -d. Then create two DNS A records for “api” and “magic” pointing
to your server’s IP address, and after your Docker images have been started you can find the frontend
# Docker file to couple frontend, backend, MySQL database, # nGinx reverse proxy, and LetsEncrypt instances into one. # Replace the xxxxx.com parts with your own domain # Then create two DNS A records pointing to the IP address of # your server. Content of DNS records should be 'api' and 'magic'. version: "2" services: # This is the internet facing reverse proxy that routes # requests to either the frontend or the backend. # This is the only thing that's actually exposed to the internet. nginx-proxy: image: jwilder/nginx-proxy container_name: nginx-proxy ports: - "80:80" - "443:443" volumes: - conf:/etc/nginx/conf.d - vhost:/etc/nginx/vhost.d - dhparam:/etc/nginx/dhparam - certs:/etc/nginx/certs:ro - /var/run/docker.sock:/tmp/docker.sock:ro - /usr/share/nginx/html networks: - proxy restart: always # This is the container that is responsible for retrieving # and renewing SSL certificates from LetsEncrypt letsencrypt: image: jrcs/letsencrypt-nginx-proxy-companion container_name: nginx-proxy-le volumes_from: - nginx-proxy volumes: - certs:/etc/nginx/certs:rw - /var/run/docker.sock:/var/run/docker.sock:ro networks: - proxy restart: always # This is our MySQL database db: image: mysql restart: always environment: MYSQL_ROOT_PASSWORD: ThisIsNotAGoodPassword volumes: - database:/var/lib/mysql networks: - proxy # Our Magic backend backend: image: servergardens/magic-backend:latest restart: unless-stopped depends_on: - db - letsencrypt - nginx-proxy volumes: - magic_files:/magic/files/modules/magic - crypto_keys:/magic/files/modules/system/crypto/keys environment: # REPLACE THESE NEXT 3 PARTS WITH YOUR OWN DOMAIN/EMAIL - VIRTUAL_HOST=api.servergardens.com - LETSENCRYPT_HOST=api.servergardens.com - LETSENCRYPT_EMAILemail@example.com networks: - proxy # Our Magic frontend (dashboard) frontend: image: servergardens/magic-frontend:latest restart: unless-stopped depends_on: - backend environment: # REPLACE THESE NEXT 3 PARTS WITH YOUR OWN DOMAIN/EMAIL - VIRTUAL_HOST=magic.servergardens.com - LETSENCRYPT_HOST=magic.servergardens.com - LETSENCRYPT_EMAILfirstname.lastname@example.org networks: - proxy volumes: conf: vhost: dhparam: certs: database: magic_files: crypto_keys: networks: proxy: external: name: nginx-proxy
If you have a support request of private nature, you can send me an email at email@example.com. If you want to submit a feature request or a bug report, you can do such through the project’s GitHub Issues.
Magic is 100% Open Source and free to use, also in proprietary and closed source applications. The only exception is if you improve the frontend dashboard, or improve one of its plugins, at which point you must make your improvements publicly available for others to use.
If you want to buy me a cup of coffee, saying thx for the great work, I would appreciate a donation.