编程知识 cdmana.com

Pancakeswap front-end source compilation and deployment Linux

Related information

One 、 Source compilation environment deployment

1.1 yarn Deploy

  • Install source configuration
wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo
  • install yarn
yum install yarn -y
  • View version
yarn --version

1.2 nodejs Deploy

  • download nodejs Binary package
wget https://nodejs.org/download/release/v12.20.0/node-v12.20.0-linux-x64.tar.xz
  • Decompress the package
tar xvf node-v12.20.0-linux-x64.tar.xz
  • Change package name
mv node-v12.20.0-linux-x64 /usr/local/nodejs
  • Add environment variables
# vim /etc/profile#nodejsexport NODE_HOME=/usr/local/nodejsexport PATH=$NODE_HOME/bin:$PATH
  • Effective environment variables
source /etc/profile
  • verification nodejs Whether the deployment is successful
# node -vv12.20.0# npm -v6.14.8

1.3 install git

  • install git
yum -y install git
  • View version
# git versiongit version 1.8.3.1

Two 、pancakeswap Front end source code compilation

2.1 download pancakeswap Front end source code

  • download pancakeswap Front end source code compressed package
https://github.com/pancakeswap/pancake-frontend/archive/refs/heads/master.zip
  • decompression pancakeswap Front end source code compressed package
unzip master.zip

2.2 compile pancakeswap Front end source code

  • Get into pancakeswap Front end source folder
# cd pancake-frontend-master/# lsCONTRIBUTING.md  crowdin.yml  cypress  cypress.json  doc  LICENSE  netlify.toml  package.json  public  README.md  scripts  src  static.json  tsconfig.json  yarn.lock
  • initialization git
git init
  • Install all dependent packages
yarn
  • There are many projects node_modules Dependency package
# lsCONTRIBUTING.md  crowdin.yml  cypress  cypress.json  doc  LICENSE  netlify.toml  node_modules  package.json  public  README.md  scripts  src  static.json  tsconfig.json  yarn.lock
  • Project package
npm run build
  • The compiled static page is in build in
# lsbuild  CONTRIBUTING.md  crowdin.yml  cypress  cypress.json  doc  LICENSE  netlify.toml  node_modules  package.json  public  README.md  scripts  src  static.json  tsconfig.json  yarn.lock

3、 ... and 、 Compile the error report and solve it

3.1 git Not installed

  • Wrong content :
Couldn't find the binary git
  • Error reason : No installation git
  • resolvent :
yum -y install git

3.2 nodejs Version low

  • Wrong content :
error [email protected]: The engine "node" is incompatible with this module. Expected version "^10.17.0 || ^12.0.0 || >= 13.7.0". Got "10.12.0"error Found incompatible module.
  • Error reason :nodejs Version low
  • resolvent : take node Upgrade to the following version , The personal version used this time is :v12.20.0
^10.17.0 || ^12.0.0 || >= 13.7.0

3.3 git Not initialized

  • Wrong content :
fatal: Not a git repository (or any parent up to mount point /opt)
  • Error reason :git Not initialized after installation
  • resolvent : initialization git
git init

3.4 git Can't be found

  • Wrong content :
.git can't be found (see https://git.io/Jc3F9)error Command failed with exit code 1.
  • git Can't be found
  • resolvent : Initialize in the source folder path git
# git initInitialized empty Git repository in /opt/tools/pancake-frontend-master/.git/

Four 、 Deploy pancakeswap The front page

4.1 download nginx Mirror image

docker pull nginx:1.17.9

4.2 newly build nginx Mount Directory

mkdir -p /opt/docker/nginx/{conf,html,logs,cert}

4.3 To write nginx Container startup script

# pwd/opt/docker/nginx# vim run.sh #!/bin/bashdocker run -itd --restart=unless-stopped \ -v /etc/localtime:/etc/localtime \ -v /etc/timezone:/etc/timezone \ --network=host \ --name nginx \ -v /opt/docker/nginx/html:/usr/share/nginx/html \ -v /opt/docker/nginx/logs:/var/log/nginx \ -v /opt/docker/nginx/cert:/etc/nginx/cert \ -v /opt/docker/nginx/nginx.conf:/etc/nginx/nginx.conf \ -v /opt/docker/nginx/conf:/etc/nginx/conf.d \ nginx:1.17.9docker logs -f nginx

4.4 To write nginx Master profile

# pwd/opt/docker/nginx# vim nginx.confworker_processes  4;user  nginx;#pid /opt/app/nginx/sbin/nginx.pid;events {    worker_connections  409600;}http {    include       mime.types;    default_type  application/octet-stream;    server_tokens  off;    autoindex on;    autoindex_exact_size off;    autoindex_localtime on;    keepalive_timeout  65;    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '                      '$status $body_bytes_sent "$http_referer" '                      '"$http_user_agent" "$http_x_forwarded_for"';    access_log /var/log/nginx/access.log  main;    error_log  /var/log/nginx/error.log  error;    include /etc/nginx/conf.d/*.conf;}

4.5 Will compile pancakeswap The front-end static page is placed in nginx Under project directory

# mkdir /opt/docker/nginx/html/pancakeswap -p# cd /opt/docker/nginx/html/pancakeswap# cp /opt/tools/pancake-frontend-master/build/* ./ -rf# lsasset-manifest.json  favicon.ico  googlefddf3c367e79f9e2.html  images  index.html  locales  logo.png  manifest.json  _redirects  robots.txt  static  swap.mp3

4.6 Write domain name conf file

# pwd/opt/docker/nginx/conf# vim www.pancakeswap.com.confserver {        listen       80;        server_name www.pancakeswap.com;        rewrite ^ https://$http_host$request_uri? permanent;        server_tokens off;    }server {        listen 443 ssl;        server_name  127.0.0.1;        ssl_certificate   /etc/nginx/cert/xxx.com.pem;        ssl_certificate_key  /etc/nginx/cert/xxx.com.key;        ssl_session_timeout 5m;        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;        ssl_prefer_server_ciphers on;        charset utf-8;        location / {            root /usr/share/nginx/html/pancakeswap;            index  index.php index.html index.htm;        }        access_log /var/log/nginx/www.pancakeswap.com.log;        error_log /var/log/nginx/www.pancakeswap.com.log;}

4.7 Start the container , Access page

版权声明
本文为[toString]所创,转载请带上原文链接,感谢
https://cdmana.com/2021/10/20211002145721848P.html

Scroll to Top