Giter VIP home page Giter VIP logo

f17-gta5's Introduction

Hưỡng dẫn deploy.

Các khái niệm đầu tiên

  • Docker là 1 server ảo, chạy trong máy thật.( file Dockerfile, và docker-compose.yml chứa config)
  • nodejs trình thông dịch thực thi mã JavaScript
  • NPM Node package manager là một công cụ tạo và quản lý các thư viện lập trình Javascript cho Node.js.

2 Cách cài.

Cách 1: Không phụ thuộc môi trường

  • Với khái niện Docker bên trên, chúng ta sẽ upweb chỉ với 1 click hoặc 1 dòng lệnh bằng cách cài docker.

  • Máy ảo này chạy trên bất kỳ máy thật nào được cài docker. Việc còn lại để docker lo(các tác vụ tự động được code ở 2 file trong khái niệm)

Cách 2: Phụ thuộc môi trường.

  • Cách này đòi hỏi phải cài các thư viện phức tạp liên quan(cũng ko quá nhiều)
  • Nhược điểm so với cách 1 là dễ phát sinh lỗi do cài nhiều và mỗi loại máy cài 1 cách khác nhau.
  • Ưu điểm là tự kiểm soát, không phụ thuộc docker

Cách 1: Không phụ thuộc môi trường

Server cần có:

  1. Cài sẵn docker
  1. Run web với 1 dòng lệnh
  • di chuyển dòng lệnh tới thư mục dự án này.
  • Sau đó dùng lệnh: docker-compose -f compose.yml up --build -d

Giải thích:

  • docker-compose là từ khoá của docker.
  • -f compose.yml là chỉ định file: - compose.yml
  • up là báo cho docker biết: chúng ta muốn đưa ứng dụng lên(vào) trong container để sử dụng
  • --build đây là option, báo cho docker biết: chúng ta sẽ build ứng dụng này(thư mục hiện tại)
  • -d là Detached mode, chạy web ở chế độ backgroud

Cách 2: Phụ thuộc môi trường.

Server cần có:

  1. Nodejs: Tại đây có file cài đặt, hãy chọn hệ điều hành đang dùng
  • Link Nodejs cho window: here
  1. Cài đặt + run web
  • npm là từ khoá thuộc NPM(cần cài nodejs trước)
  • install yêu cầu cài đặt ứng dụng nào đó
  • -g global: Cài cho toàn hệ thống sử dụng( chứ ko chỉ cho ứng dụng hiện tại)

Lưu ý: cần cấp quyền cao nhất khi cài các thư viện dưới

  1. Cài máy chủ xử lý nhận request và handle.
  • npm install -g serve
  1. Cài các gói phụ thuộc nodejs
  • Dùng lệnh: npm install
  1. Bắt đầu build
  • npm run build
  1. Run server:
  • serve -s build
  1. [option] Run server with port
  • serve -s build -l 4000

Tài liệu liên quan web:

To be continues...

f17-gta5's People

Contributors

lupca avatar huyentrang93 avatar leanguyen6 avatar tungdt-3023 avatar santahashi 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.