{"id":1090,"date":"2021-09-07T23:45:09","date_gmt":"2021-09-07T15:45:09","guid":{"rendered":"http:\/\/www.tra56.com\/?p=1090"},"modified":"2021-09-07T23:45:09","modified_gmt":"2021-09-07T15:45:09","slug":"1090","status":"publish","type":"post","link":"https:\/\/www.tra56.com\/1090.html","title":{"rendered":"\u4f7f\u7528Docker\u521b\u5efaHyperf\u9879\u76ee"},"content":{"rendered":"

\u6587\u7ae0\u76ee\u5f55<\/p>\n

\u5b89\u88c5Hyperf\u5f00\u53d1\u5bb9\u5668<\/p>\n

\u5b89\u88c5Composer<\/p>\n

\u521b\u5efa\u9879\u76ee,\u4ee5\u4e0b\u547d\u4ee4\u90fd\u662f\u5728\u5bb9\u5668\u5185\u90e8\u6267\u884c<\/p>\n

\u914d\u7f6e\u9879\u76ee<\/p>\n

\u5f00\u53d1\u73af\u5883\u4e0b\u7684\u70ed\u66f4\u65b0<\/p>\n

\u6570\u636e\u8868\u8bbe\u8ba1<\/p>\n

\u521b\u5efa\u8868<\/p>\n

\u6570\u636e\u586b\u5145<\/p>\n

\u8fd0\u884c\u8fc1\u79fb<\/p>\n

\u9879\u76ee\u6e90\u7801<\/p>\n

\u5b89\u88c5Hyperf\u5f00\u53d1\u5bb9\u5668<\/p>\n

docker run -d --name user_center \\\r\n  --restart=always \\\r\n  #\u6620\u5c04\u5230\u5bbf\u4e3b\u673a\u76ee\u5f55\uff0c\u8fd9\u6837\u6211\u4eec\u5c31\u76f4\u63a5\u5728\/home\/wwwroot\/user_center\u5f00\u53d1\r\n  -v \/home\/wwwroot\/user_center:\/hyperf-skeleton \\ \r\n  # 9501\u63d0\u4f9bhttp\u670d\u52a1\uff0c9504\u63d0\u4f9bjson-rpc\u670d\u52a1\r\n  -p 9501:9501 -p 9504:9504 \\ \r\n  -it --entrypoint \/bin\/sh \\\r\n  hyperf\/hyperf:7.3-alpine-cli<\/pre>\n

\u5b89\u88c5Composer<\/p>\n

docker exec -it user_center bash #\u8fdb\u5165\u5bb9\u5668\r\n#\u4e0b\u8f7dCOMPOSER\r\nwget https:\/\/github.com\/composer\/composer\/releases\/download\/1.9.0\/composer.phar\r\n#\u4fee\u6539\u4e3a\u53ef\u6267\u884c\r\nchmod u+x composer.phar\r\n#\u590d\u5236\u5230\/usr\/local\/bin\/ \u8fd9\u6837\u5c31\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884ccomposer \u547d\u4ee4\r\nmv composer.phar \/usr\/local\/bin\/composer\r\n#\u4fee\u6539\u4ed3\u5e93\u5730\u5740\u4e3a\u963f\u91cc\u4e91\r\ncomposer config -g repo.packagist composer https:\/\/mirrors.aliyun.com\/composer<\/pre>\n

\u521b\u5efa\u9879\u76ee,\u4ee5\u4e0b\u547d\u4ee4\u90fd\u662f\u5728\u5bb9\u5668\u5185\u90e8\u6267\u884c<\/p>\n

cd \/hyperf-skeleton\r\ncomposer create-project hyperf\/hyperf-skeleton=1.1.* #\u76f4\u63a5\u4e00\u8def\u56de\u8f66\u4e0d\u5b89\u88c5\u9644\u52a0\u7ec4\u4ef6<\/pre>\n

\u5b89\u88c5\u9700\u8981\u7528\u5230\u7684\u7ec4\u4ef6<\/p>\n

<\/p>\n

composer require illuminate\/hashing gregwar\/captcha \\ hyperf\/validation hyperf\/translation hyperf\/constants phper666\/jwt-auth:~2.0.1 hyperf\/config-aliyun-acm hyperf\/json-rpc hyperf\/rpc-server<\/pre>\n

illuminate\/hashing laravel\u7684hash\u7ec4\u4ef6<\/p>\n

gregwar\/captcha \u9a8c\u8bc1\u7801\u7ec4\u4ef6<\/p>\n

hyperf\/validation \u5b98\u65b9\u9a8c\u8bc1\u7ec4\u4ef6<\/p>\n

hyperf\/translation \u591a\u79cd\u8bed\u8a00\u7ec4\u4ef6<\/p>\n

hyperf\/translation \u5b98\u65b9\u679a\u4e3e\u7c7b<\/p>\n

phper666\/jwt-auth JWT\u7ec4\u4ef6<\/p>\n

hyperf\/config-aliyun-acm \u963f\u4e91\u914d\u7f6e\u4e2d\u5fc3\u7ec4\u4ef6<\/p>\n

hyperf\/json-rpc hyperf\/rpc-server \u5b98\u65b9RPC\u670d\u52a1\u7ec4\u4ef6<\/p>\n

\u53d1\u5e03\u7ec4\u4ef6\u914d\u7f6e<\/p>\n

php bin\/hyperf.php jwt:publish --config\r\nphp bin\/hyperf.php vendor:publish hyperf\/translation\r\nphp bin\/hyperf.php vendor:publish hyperf\/validation<\/pre>\n

\u914d\u7f6e\u9879\u76ee<\/p>\n

\u7f16\u8f91\u9879\u76ee\u6839\u76ee\u5f55\u7684.env\u6587\u4ef6\uff0c\u914d\u7f6e\u597d\u6570\u636e\u5e93\u548credis<\/p>\n

APP_NAME=user_center\r\n\r\nDB_DRIVER=mysql\r\nDB_HOST=192.168.137.200\r\nDB_PORT=3306\r\nDB_DATABASE=user_center\r\nDB_USERNAME=root\r\nDB_PASSWORD=123456\r\nDB_CHARSET=utf8mb4\r\nDB_COLLATION=utf8mb4_unicode_ci\r\nDB_PREFIX=\r\n\r\nREDIS_HOST=192.168.137.200\r\nREDIS_AUTH=(null)\r\nREDIS_PORT=6379\r\nREDIS_DB=0<\/pre>\n

\u5f00\u53d1\u73af\u5883\u4e0b\u7684\u70ed\u66f4\u65b0<\/p>\n

\u4e0b\u8f7dhttps:\/\/github.com\/ha-ni-cc\/hyperf-watch\u91cc\u7684watch\u6587\u4ef6\u5230\u9879\u76ee\u6839\u76ee\u5f55\uff0c\u7136\u540e\u542f\u52a8\u53ea\u9700\u8981\u6267\u884cphp watch\uff0c\u8fd9\u6837\u6211\u4eec\u4fee\u6539\u6587\u4ef6\uff0c\u5c31\u4f1a\u81ea\u52a8\u91cd\u542f\u8fdb\u7a0b<\/p>\n

<\/p>\n

\u6570\u636e\u8868\u8bbe\u8ba1<\/p>\n

\u521b\u5efa\u8868<\/p>\n

\u76ee\u524d\u6211\u4eec\u53ea\u521b\u5efa\u4e86\u4e24\u4e2a\u8868user\u548cwx_user\u8be6\u89c1\u8fc1\u79fb\u6587\u4ef6<\/p>\n

user\u8868<\/p>\n

https:\/\/github.com\/donjan-deng\/la-user-center\/blob\/master\/migrations\/2019_10_31_100142_create_user_table.php<\/p>\n

wx_user\u8868<\/p>\n

https:\/\/github.com\/donjan-deng\/la-user-center\/blob\/master\/migrations\/2019_10_31_100153_create_wx_user_table.php<\/p>\n

<\/p>\n

\u6570\u636e\u586b\u5145<\/p>\n

\u6211\u4eec\u521d\u59cb\u5316\u4e86\u4e00\u4e2a\u7ba1\u7406\u5458\u5e10\u53f7<\/p>\n

https:\/\/github.com\/donjan-deng\/la-user-center\/blob\/master\/seeders\/user_table_seeder.php<\/p>\n

<\/p>\n

\u8fd0\u884c\u8fc1\u79fb<\/p>\n

\u521b\u5efa\u6570\u636e\u5e93<\/p>\n

php bin\/hyperf.php migrate<\/pre>\n

\u586b\u5145\u6570\u636e<\/p>\n

php bin\/hyperf.php db:seed<\/pre>\n

\u6709\u5173\u6570\u636e\u8fc1\u79fb\u7684\u4f7f\u7528\u65b9\u6cd5\u53ef\u53c2\u9605\u5b98\u65b9\u6587\u6863https:\/\/hyperf.wiki\/#\/zh\/db\/migration<\/p>\n

<\/p>\n

\u9879\u76ee\u6e90\u7801<\/p>\n

\u9879\u76ee\u6e90\u7801\u5df2\u53d1\u5e03\u5230github https:\/\/github.com\/donjan-deng\/la-user-center<\/p>\n

<\/p>\n

\u300aPHP\u5fae\u670d\u52a1\u7ec3\u5175\u300b\u7cfb\u5217\u7d22\u5f15:https:\/\/blog.csdn.net\/donjan\/article\/details\/103005084<\/p>\n","protected":false},"excerpt":{"rendered":"

\u6587\u7ae0\u76ee\u5f55 \u5b89\u88c5Hyperf\u5f00\u53d1\u5bb9\u5668 \u5b89\u88c5Composer \u521b\u5efa\u9879\u76ee,\u4ee5\u4e0b\u547d\u4ee4\u90fd\u662f\u5728\u5bb9\u5668\u5185\u90e8\u6267\u884c \u914d\u7f6e\u9879\u76ee \u5f00\u53d1 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[91],"tags":[],"class_list":["post-1090","post","type-post","status-publish","format-standard","hentry","category-hyperf"],"_links":{"self":[{"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/posts\/1090"}],"collection":[{"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/comments?post=1090"}],"version-history":[{"count":1,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/posts\/1090\/revisions"}],"predecessor-version":[{"id":1091,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/posts\/1090\/revisions\/1091"}],"wp:attachment":[{"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/media?parent=1090"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/categories?post=1090"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/tags?post=1090"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}