1stel / stratostack-records-generation
StratoSTACK 账单记录生成。
Requires
- 1stel/cloudstack-php-client: ^3.0
- illuminate/html: ~5.0
- laracasts/flash: ~1.3
- laravel/framework: 5.1.*
- php-amqplib/php-amqplib: ^2.6
Requires (Dev)
- phpspec/phpspec: ~2.1
- phpunit/phpunit: ~4.0
This package is not auto-updated.
Last update: 2022-12-30 14:06:56 UTC
README
StratoSTACK 账单门户允许开发者、系统集成商、托管服务提供商以及在其他基于 Apache CloudStack 平台提供服务的个人无需购买昂贵的账单门户即可提供实例创建、配置和账单服务。
先决条件
包
Apache2
MySQL-5.5+
PHP-5.5.9+
Rabbitmq-server
安装
StratoSTACK 使用 Composer 进行依赖管理。请参阅其 下载指南 以获取安装说明。
Ubuntu
Ubuntu 14.04 包依赖项
# sudo apt-get install apache2 php5 mysql-server-5.5 rabbitmq-server php5-mysql php5-mcrypt
取消注释 /etc/default/rabbitmq-server 中的限制
启用 rabbitMQ 管理接口
# rabbitmq-plugins enable rabbitmq_management
为 Cloudstack 设置 RabbitMQ 用户
浏览到 http://[rabbitmq ip]:15672/。点击管理员。为 Cloudstack 添加用于与 RabbitMQ 通信的用户名和密码。
配置 ACS 管理服务器将事件发送到 RabbitMQ
在您的管理服务器上,编辑 /etc/cloudstack/management/META-INF/cloudstack/core/spring-event-bus-context.xml
添加以下内容
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="eventNotificationBus" class="org.apache.cloudstack.mom.rabbitmq.RabbitMQEventBus">
<property name="name" value="eventNotificationBus"/>
<property name="server" value="RABBITMQ_SERVER_ADDRESS"/>
<property name="port" value="5672"/>
<property name="username" value="USERNAME"/>
<property name="password" value="PASSWORD"/>
<property name="exchange" value="cloudstack-events"/>
</bean>
</beans>
在 /var/www/html 中安装 StratoSTACK 账单记录生成服务器
# composer create-project --prefer-dist 1stel/stratostack-records-generation recordsGen
创建 MySQL 数据库
# mysqladmin -u<user> -p create cloud_admin
服务器还需要访问 Cloudstack 安装使用的 cloud 和 cloud_usage 数据库。
更新配置文件
编辑 .env,更新 DB、CLOUD_DB 和 CLOUDUSAGE_DB 部分。
编辑 config/cloud.php,并设置云的资源限制。这些限制表示您的云支持的最大实例大小,或者您希望允许创建的最大大小。
填充数据库
# php artisan migrate:install
# php artisan migrate --seed
更新 Apache 配置
编辑 /etc/apache2/sites-enabled/000-default.conf
将 DocumentRoot 更改为 /var/www/html/recordsGen/public
在 DocumentRoot 下方添加以下内容
<Directory /var/www/html>
Options FollowSymLinks
AllowOverride All
</Directory>
启用 mod_rewrite
# a2enmod rewrite
重启 Apache
# service apache2 restart
设置权限
# chown www-data.www-data /var/www/html/recordsGen -R
将事件调度程序添加到 cron
将以下内容添加到您的 crontab 中
* * * * * root php /var/www/html/recordsGen/artisan schedule:run >> /dev/null 2>&1
登录到 BRG
浏览到 http:/// 并使用用户名:admin,密码:admin 登录。
更新设置
如果您没有自动被带到设置部分,请点击设置部分。填写管理服务器信息,并点击同步 ACS 设置。