added golang

This commit is contained in:
marvzhang
2020-07-30 11:12:36 +08:00
parent 0a75b359f5
commit 27fd16f345
8 changed files with 61 additions and 6 deletions

View File

@@ -39,7 +39,7 @@ task:
workers: 16
other:
tmppath: "/tmp"
version: 0.5.0
version: 0.5.1
setting:
crawlabLogToES: "N" # Send crawlab runtime log to ES, open this option "Y", remember to set esClient
crawlabLogIndex: "crawlab-log"

View File

@@ -0,0 +1,20 @@
#!/bin/bash
# lock global
touch /tmp/install.lock
# lock
touch /tmp/install-go.lock
# install golang
apt-get update
apt-get install -y golang
# environment variables
export GOPROXY=https://goproxy.cn
export GOPATH=/opt/go
# unlock global
rm /tmp/install.lock
# unlock
rm /tmp/install-go.lock

View File

@@ -8,8 +8,8 @@ touch /tmp/install-nodejs.lock
# install node.js
curl -sL https://deb.nodesource.com/setup_10.x | bash -
apt install -y nodejs
apt install -y npm
apt-get update && apt install -y nodejs nodejs-dev node-gyp libssl1.0-dev
apt-get update && apt install -y npm
# install chromium
# See https://crbug.com/795759
@@ -20,7 +20,17 @@ apt-get update && apt-get install -yq libgconf-2-4
# Note: this installs the necessary libs to make the bundled version
# of Chromium that Puppeteer
# installs, work.
apt-get update && apt-get install -y --no-install-recommends gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
RUN apt-get update \
&& apt-get install -y wget gnupg \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get -y install xvfb gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 \
libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 \
libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \
libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 \
libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget \
&& rm -rf /var/lib/apt/lists/*
# install default dependencies
PUPPETEER_DOWNLOAD_HOST=https://npm.taobao.org/mirrors

View File

@@ -23,3 +23,19 @@ then
/bin/sh /app/backend/scripts/install-dotnet.sh
echo "installed dotnet"
fi
# install php
if [ "${CRAWLAB_SERVER_LANG_PHP}" = "Y" ];
then
echo "installing php"
/bin/sh /app/backend/scripts/install-php.sh
echo "installed php"
fi
# install go
if [ "${CRAWLAB_SERVER_LANG_GO}" = "Y" ];
then
echo "installing go"
/bin/sh /app/backend/scripts/install-go.sh
echo "installed go"
fi

View File

@@ -50,6 +50,13 @@ func GetLangList() []entity.Lang {
LockPath: "/tmp/install-php.lock",
InstallScript: "install-php.sh",
},
{
Name: "Golang",
ExecutableName: "go",
ExecutablePaths: []string{"/usr/bin/go", "/usr/local/bin/go"},
LockPath: "/tmp/install-go.lock",
InstallScript: "install-go.sh",
},
}
return list
}

View File

@@ -26,6 +26,7 @@ services:
# CRAWLAB_SERVER_LANG_JAVA: "Y" # whether to pre-install Java 预安装 Java 语言环境
# CRAWLAB_SERVER_LANG_DOTNET: "Y" # whether to pre-install .Net core 预安装 .Net Core 语言环境
# CRAWLAB_SERVER_LANG_PHP: "Y" # whether to pre-install PHP 预安装 PHP 语言环境
# CRAWLAB_SERVER_LANG_GO: "Y" # whether to pre-install Golang 预安装 Golang 语言环境
# CRAWLAB_SETTING_ALLOWREGISTER: "N" # whether to allow user registration 是否允许用户注册
# CRAWLAB_SETTING_ENABLETUTORIAL: "N" # whether to enable tutorial 是否启用教程
# CRAWLAB_SETTING_RUNONMASTER: "N" # whether to run on master node 是否在主节点上运行任务

View File

@@ -23,7 +23,7 @@ fi
service nginx start
# install languages
if [ "${CRAWLAB_SERVER_LANG_NODE}" = "Y" ] || [ "${CRAWLAB_SERVER_LANG_JAVA}" = "Y" ];
if [ "${CRAWLAB_SERVER_LANG_NODE}" = "Y" ] || [ "${CRAWLAB_SERVER_LANG_JAVA}" = "Y" ] || [ "${CRAWLAB_SERVER_LANG_DOTNET}" = "Y" ] || [ "${CRAWLAB_SERVER_LANG_PHP}" = "Y" ] || [ "${CRAWLAB_SERVER_LANG_GO}" = "Y" ];
then
echo "installing languages"
echo "you can view log at /var/log/install.sh.log"

View File

@@ -225,7 +225,8 @@
{ label: 'Node.js', name: 'node', hasDeps: true },
{ label: 'Java', name: 'java', hasDeps: false },
{ label: '.Net Core', name: 'dotnet', hasDeps: false },
{ label: 'PHP', name: 'php', hasDeps: false }
{ label: 'PHP', name: 'php', hasDeps: false },
{ label: 'Golang', name: 'go', hasDeps: false }
],
langsDataDict: {},
handle: undefined,