Monica can run with Docker images.
You can use Docker and docker-compose to pull or build and run a Monica image, complete with a self-contained MySQL database. This has the nice properties that you don't have to install lots of software directly onto your system, and you can be up and running quickly with a known working environment.
For any help about how to install Docker, see their documentation
There are two versions of the image you may choose from.
The apache tag contains a full Monica installation with an apache webserver. This points to the default latest tag too.
The fpm tag contains a fastCGI-Process that serves the web pages. This image should be combined with a webserver used as a proxy, like apache or nginx.
This image contains a webserver that exposes port 80. Run the container with:
docker run -d -p 8080:80 monica
This image serves a fastCGI server that exposes port 9000. You may need an additional web server that can proxy requests to the fpm port 9000 of the container. Run this container with:
docker run -d -p 9000:9000 monica:fpm
To have a persistent storage for your datas, you may want to create volumes for your db, and for monica you will have to save the /var/www/html/storage directory.
Run a container with this named volume:
docker run -d -v monica_data:/var/www/html/storage monica
Monica needs a database connection, and currently supports mysql/mariadb only. Run these to have a running environment:
mysqlCid="$(docker run -d \ -e MYSQL_RANDOM_ROOT_PASSWORD=true \ -e MYSQL_DATABASE=monica \ -e MYSQL_USER=homestead \ -e MYSQL_PASSWORD=secret \ "mariadb:11")" docker run -d \ --link "$mysqlCid":mysql \ -e DB_HOST=mysql \ -p 8080:80 \ monica
If you want to use a mysql installation that already exists, you can pass the database environment variables directly into the docker run command, with DB_HOST indicating the IP address of the MySQL database. Ensure all permissions are granted to the user specified in the enviornment variable DB_USERNAME.
docker run -d \ -e DB_PORT=3306 \ -e DB_DATABASE=monica \ -e DB_USERNAME=homestead \ -e DB_PASSWORD=secret \ -e DB_HOST=0.0.0.0 \ -p 8080:80 \ monica
Wait until all migrations are done and then access Monica at http://localhost:8080/ from your host system. If this looks ok, add your first user account.
Like every Laravel application, the php artisan command is very usefull for Monica.
To run a command inside the container, run
docker exec CONTAINER_ID php artisan COMMAND
or for docker-compose
docker-compose exec monica php artisan COMMAND
where monica is the name of the service in your docker-compose.yml file.
See some examples of docker-compose possibilities in the example section.
This version will use the apache image and add a mysql container. The volumes are set to keep your data persistent. This setup provides no ssl encryption and is intended to run behind a proxy.
Make sure to pass in values for APP_KEY variable before you run this setup.
Set APP_KEY to a random 32-character string. You can for instance copy and paste the output of echo -n 'base64:'; openssl rand -base64 32.
docker-compose.yml fileversion: "3.4" services: app: image: monica depends_on: - db ports: - 8080:80 environment: - APP_KEY= - DB_HOST=db - DB_USERNAME=usermonica - DB_PASSWORD=secret volumes: - data:/var/www/html/storage restart: always db: image: mariadb:11 environment: - MYSQL_RANDOM_ROOT_PASSWORD=true - MYSQL_DATABASE=monica - MYSQL_USER=usermonica - MYSQL_PASSWORD=secret volumes: - mysql:/var/lib/mysql restart: always volumes: data: name: data mysql: name: mysql
Set a value for APP_KEY variable before you run this setup. You can for instance copy and paste the output of
echo -n 'base64:'; openssl rand -base64 32
Run
docker-compose up -d
Wait until all migrations are done and then access Monica at http://localhost:8080/ from your host system. If this looks ok, add your first user account.
Run this command once:
docker-compose exec app php artisan setup:production
When using FPM image, you will need another container with a webserver to proxy http requests. In this example we use nginx with a basic container to do this.
nginx.conf and Dockerfile file for nginx image. An example can be found on the example section
mkdir web curl -sSL https://raw.githubusercontent.com/monicahq/docker/master/.examples/nginx-proxy/web/nginx.conf -o web/nginx.conf curl -sSL https://raw.githubusercontent.com/monicahq/docker/master/.examples/nginx-proxy/web/Dockerfile -o web/Dockerfile
The web container image should be pre-build before each deploy with: docker-compose build
docker-compose.yml fileversion: "3.4" services: app: image: monica:fpm depends_on: - db environment: - APP_KEY= - DB_HOST=db - DB_USERNAME=usermonica - DB_PASSWORD=secret volumes: - data:/var/www/html/storage restart: always web: build: ./web ports: - 8080:80 depends_on: - app volumes: - data:/var/www/html/storage:ro restart: always db: image: mariadb:11 environment: - MYSQL_RANDOM_ROOT_PASSWORD=true - MYSQL_DATABASE=monica - MYSQL_USER=usermonica - MYSQL_PASSWORD=secret volumes: - mysql:/var/lib/mysql restart: always volumes: data: name: data mysql: name: mysql
Set a value for APP_KEY variable before you run this setup. You can for instance copy and paste the output of
echo -n 'base64:'; openssl rand -base64 32
Run
docker-compose up -d
Wait until all migrations are done and then access Monica at http://localhost:8080/ from your host system. If this looks ok, add your first user account.
Run this command once:
docker-compose exec app php artisan setup:production
To expose your Monica instance for the internet, it's important to set APP_ENV=production in your .env file or environment variables. In this case https scheme will be mandatory.
One way to expose your Monica instance is to use a proxy webserver from your host with SSL capabilities. This is possible with a reverse proxy.
See some examples of docker-compose possibilities in the example section to show how to a proxy webserver with ssl capabilities.


AI一键生成PPT,就用博思AIPPT!
博思AIPPT,新一代的AI生成PPT平台,支持智能生成PPT、AI美化PPT、文本&链接生成PPT、导入Word/PDF/Markdown文档生成PPT等,内置海量精美PPT模板,涵盖商务、教育、科技等不同风格,同时针对每个页面提供多种版式,一键自适应切换,完美适配各种办公场景。


AI赋能电商视觉革命,一站式智能商拍平台
潮际好麦深耕服装行业,是国内AI试衣效果最好的软件。使用先进AIGC能力为电商卖家批量提供优质的、低成本的商拍图。合作品牌有Shein、Lazada、安踏、百丽等65个国内外头部品牌,以及国内10万+淘宝、天猫、京东等主流平台的品牌商家,为卖家节省将近85%的出图成本,提升约3倍出图效率,让品牌能够快速上架。


企业专属的AI法律顾问
iTerms是法大大集团旗下法律子品牌,基于最先进的大语言模型(LLM)、专业的法律知识库和强大的智能体架构,帮助企业扫清合规障碍,筑牢风控防线,成为您企业专属的AI法律顾问。


稳定高效的流量提升解决方案,助力品牌曝光
稳定高效的流量提升解决方案,助力品牌曝光


最新版Sora2模型免费使用,一键生成无水印视频
最新版Sora2模型免费使用,一键生成无水印视频


实时语音翻译/同声传译工具
Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让全世界的语言交流不再有国界。


选题、配图、成文,一站式创作,让内容运营更高效
讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。


AI辅助编程,代码自动修复
Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。


最强AI数据分析助手
小浣熊家族Raccoon,您的AI智能助手,致力于通过先进的人工智能技术,为用户提供高效、便捷的智能服务。无论是日常咨询还是专业问题解答,小浣熊都能以快速、准确的响应满足您的需求,让您的生活更加智能便捷。


像人一样思考的AI智能体
imini 是一款超级AI智能体,能根据人类指令,自主思考、自主完成、并且交付结果的AI智能体。
最新AI工具、AI资讯
独家AI资源、AI项目落地

微信扫一扫关注公众号