开源论坛homeland容器化部署
一、homeland(论坛)介绍
homeland一款开源不限制商用的精致社区/论坛系统。国内最大的 Ruby 社区 Ruby China 开源的项目,值得一提的是该系统拥有完整的实时通知和社交功能:关注的人和话题动态通知、@提及通知、丰富的表情系统等。如果你能把这个项目跑起来,就立刻拥有了一个“社区”。
演示:https://ruby-china.org/
地址:https://github.com/ruby-china/homeland
官网:https://homeland.ruby-china.org/zh-CN/
二、homeland容器化部署
2.1 常用命令
make install 首次安装,创建数据库
make install_ssl 安装并申请 SSL 证书 (since: 2.5.0)
make update 更新应用程序,当 homeland/homeland 这个 Docker Image 版本变化的时候,需要执行,合并数据库、编译 Assets
make start 启动所有服务,将会自动启动所有的服务
make stop 停止所有服务
make restart 硬重启服务
make status 查看服务状态
make console 进入 Rails 控制台
make stop-all 停止所有服务,包括数据库
make reindex 重建搜索索引
2.2 容器化部署
(1)下载homeland源码
[root@10-27-0-224 ~]# git clone https://github.com/ruby-china/homeland-docker.git [root@10-27-0-224 ~]# cd homeland-docker/
(2)修改Application configuration配置
[root@10-27-0-224 homeland-docker]# cp app.local.env.example app.local.env [root@10-27-0-224 homeland-docker]# vim app.local.env RAILS_ENV=production # RAILS_LOG_TO_STDOUT=true # Database DATABASE_URL=postgres://postgres:@postgresql:5432/homeland # DATABASE_POOL=64 REDIS_URL=redis://redis:6379/1 # App Config app_name=community https=false domain=community.starcto.com admin_emails=starcto@163.com cert_domain=*.starcto.cat modules=home,topic,press,site,note profile_fields=all asset_host= upload_provider=file upload_host=
(3)安装基础服务
[root@10-27-0-224 homeland-docker]# make install make[1]: Entering directory `/root/homeland-docker' SECRET_KEY_BASE=ed44213b6776a66cdb7fa8e04c05081358c3ebf54acc6e187b27e24f59b42dff make[1]: Leaving directory `/root/homeland-docker' Creating network "homelanddocker_default" with the default driver Creating homeland_postgresql ... done Creating homeland_redis ... Database 'homeland' already exists Starting homeland_redis ... Starting homeland_postgresql ... done Starting homeland_postgresql ... done Starting homeland_redis ... done
(4)启动web应用
[root@10-27-0-224 homeland-docker]# make start Creating homeland_app_backup ... done Creating homeland_web ... done Creating homeland_caddy ... done homeland_redis is up-to-date Creating homeland_worker ... Creating homeland_app ... Creating homeland_app_backup ... Creating homeland_web ... Creating homeland_caddy ...
(5)停止所有服务,包括数据库
[root@10-27-0-224 homeland-docker]# make stop-all Stopping homeland_caddy ... done Stopping homeland_web ... done Stopping homeland_app_backup ... done Stopping homeland_worker ... done Stopping homeland_app ... done Stopping homeland_redis ... done Stopping homeland_postgresql ... done Removing homeland_caddy ... done Removing homeland_web ... done Removing homeland_app_backup ... done Removing homeland_worker ... done Removing homeland_app ... done Removing homelanddocker_app_run_3 ... done Removing homelanddocker_app_run_2 ... done Removing homelanddocker_app_run_1 ... done Removing homeland_redis ... done Removing homeland_postgresql ... done Removing network homelanddocker_default
(6)查看容器运行情况
[root@10-27-0-224 homeland-docker]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES bae61a6c7d77 caddy:2-alpine "caddy run --config …" 13 minutes ago Up 13 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 2019/tcp homeland_caddy 5bb7a4c32128 homeland/homeland:3-8-latest "/etc/nginx/start" 13 minutes ago Up 13 minutes 0.0.0.0:8080->80/tcp homeland_web d279295f3d65 homeland/homeland:3-8-latest "bundle exec puma -C…" 13 minutes ago Up 13 minutes 0.0.0.0:49167->7001/tcp homeland_app_backup c8c142cb43c4 homeland/homeland:3-8-latest "/home/app/homeland/…" 13 minutes ago Up 13 minutes 0.0.0.0:49168->7000/tcp homeland_app 95008ac0a9fe homeland/homeland:3-8-latest "bundle exec sidekiq…" 13 minutes ago Up 13 minutes homeland_worker d0c393889c30 redis:4-alpine "docker-entrypoint.s…" 14 minutes ago Up 14 minutes 0.0.0.0:49165->6379/tcp homeland_redis 2bb1104a09e9 postgres:9.5-alpine "docker-entrypoint.s…" 14 minutes ago Up 14 minutes 0.0.0.0:49166->5432/tcp homeland_postgresql
2.3 配置文件参数解读
app.local.env配置介绍:
(1)admin_emails 一定要修改成你自己的邮箱,这款论坛程序是根据邮箱来添加管理员账号的。也就是说你在这里配置好你的邮箱地址,待会在前台注册用户的时候填写和这个地址相同的邮箱,那么你注册的账号就是管理员。
(2)https=false,初次安装这个一定要关闭,否则安装完成之后站点无法打开。要配置ssl也是在安装完成之后配置,但是我实测这个程序配置ssl这块估计是有点bug,Nginx各种出错。
(3)domain修改成你自己的域名,app_name则是你的论坛名字,这个在安装完成之后也可以在后台设置。
2.4 访问web页面
作者:UStarGao
链接:https://www.starcto.com/open-sourcing/232.html
来源:STARCTO
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
UCloud云平台推荐
随便看看
- 2021-11-26MongoDB副本集设置节点优先级priority
- 2021-06-03开源笔记Leanote解决方案
- 2022-05-28MongoDB慢日志文件分析工具-mtools
- 2021-08-12开源分布式爬虫管理平台Crawlab容器化部署
- 2021-09-04Linux磁盘UUID冲突解决方案