Coder Social home page Coder Social logo

Comments (3)

guoyun911 avatar guoyun911 commented on September 15, 2024 1

自行解决了运行问题:
1、README中说明go run main 不行,在我的环境中需要将扩展名写全,go run main.go
2、数据库wxcomponent需要手动创建,创建后才能运行go run main.go,否则报错找不到数据库
3、需要安装nodejs,并且在client/html/下运行npm install 以及npm run build,否则提示dist/index.html找不到
4、根据日志打印看出由于80端口被占用,同时监听了8081端口;配置相应的nginx转发规则后,浏览器中输入地址后报404,输入/index.html也同样404,没头绪中...

以上内容未在README中体现,希望更新至README文档中,以便后面来的朋友运行顺利
问题4望wx方技术大佬指点,难道还需要配置其他什么?继续学习微信第三方文档ing

from wxcloudrun-wxcomponent.

guoyun911 avatar guoyun911 commented on September 15, 2024

问题4也自行解决了,main.go代码中监听的两个端口,分内部服务和外部服务(现阶段不明白这俩分别是干啥的)。
修改80端口为未占用端口后成功运行。
出现问题5。。登录账号密码是啥?
登录数据库查询到账号是root,密码加密了。。跟着inits.go挨个看代码。。终于找到,账号密码就是在.env中配置的数据库账号密码。。
目前已经成功运行并且登录进去了,继续探索中。。
最后,还是希望作者可以进一步完善文档,让后面的朋友少走弯路,谢谢

from wxcloudrun-wxcomponent.

guoyun911 avatar guoyun911 commented on September 15, 2024

后续:
由于后台运行该服务,该服务也会把日志直接输出到终端界面,太霸道了。。看到有dockfile,就考虑用docker的方式部署,这里记录一点细节,供后面的朋友方便
1、.env文件配置的数据库配置在容器中读取不到,docker运行后会发现连接数据库失败,容器中连接的数据库地址是127.0.0.1,而我在.env中已经改了相应的数据库容器IP了;代码中看到是获取环境变量的方式来读取配置,所以我这里修改dockfile,将数据库配置写到dockfile里面(当然也可以使用docker-compose的方式,写在docker-compose文件中,运行时加载环境变量,再或者直接在docker run 加参数...不再敖述);
2、dockerfile中使用的是npm安装前端依赖并打包,我服务器上已经安装过cnpm并已经安装依赖并打包出dist目录,所以修改了dockfile中的内容,将npm install那行注释掉了(其实也可以修改去掉nodejs的镜像依赖,需要修改下面的复制逻辑),不注释掉的话npm install会非常的慢(笔者就是等了5分钟没耐心了除此下策)。当然,也可以修改dockerfile去安装cnpm,其他方法自行发挥吧,继续探索了,good luck

from wxcloudrun-wxcomponent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.