Git Product home page Git Product logo

gin_video_server's Introduction

gin_video_server

一个基于gin的视频网站go服务(用于学习交流)

要感谢的人

部署

环境

  • 确保自己的开发机器上安装了docker,及其相关组件: docker-machine, docker-compose
  • 将代码git clone到本地开发机器的$GOPATH/src目录下

构建镜像

构建数据库(mysql)镜像并初始化
  1. 从docker hub 拉取最新的mysql镜像
docker pull mysql
  1. 进入mysql目录,运行
docker-compose up -d
  1. 连接到mysql并执行initdb.sql
构建程序镜像
  1. 运行脚本,构建项目镜像
./docker_server_create.sh
  1. 在gin_video_server目录下运行
docker-compose up -d
登陆一下

http://127.0.0.1/api/v1

远程云服务器部署

  1. 创建docker-machine到远程云服务器的主机
  2. 在云主机上安装docker-compose(也可以在本地使用docker stack,大家自己看看怎么弄,这里就不细说了)
  3. 将mysql构建相关文件拷贝到云主机hxaliyunecs
docker-machine scp -r mysql hxaliyunecs:~/mysql/
  1. 将runtime拷贝的云主机
docker-machine scp -r runtime/templates hxaliyunecs:~/gin_video_server/runtime/templates/
  1. 设置docker-machine的env为云服务器
eval $(docker-machine env hxaliyunecs)
  1. 在本地为远程云服务器构建项目镜像
./docker_server_create.sh
  1. 进入远程云服务器,拉取最新的mysql镜像
docker-machine ssh hxaliyunecs
docker pull mysql
  1. 进入远程云服务器,进入mysql目录,运行
docker-compose up -d
  1. 进入远程云服务器,连接到mysql并执行initdb.sql
  2. 进入远程云服务器, 在gin_video_server目录下运行
docker-compose up -d
  1. 登陆一下

http://{远程服务器IP}/api/v1

gin_video_server's People

Contributors

habohai avatar

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.