Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 46 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

## RPM for CentOS 7
## build apisix RPM for CentOS 7

### install Luarocks
https://github.com/luarocks/luarocks/wiki/Installation-instructions-for-Unix
Expand All @@ -22,20 +22,56 @@ Then you can install `fpm`:
gem install --no-ri --no-rdoc fpm
```

### install yarn for build dashboard
### run build tool script:
The version of APISIX is hard-code in `run.sh` now, you can change it by yourself.

```
./run.sh
```


## build apisix-dashboard RPM for CentOS 7

### install Yarn、nodejs
```
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -
sudo yum clean all && sudo yum makecache fast
sudo yum install -y nodejs
sudo yum install yarn
sudo sh -c "$(curl -fsSL https://rpm.nodesource.com/setup_10.x)"
sudo yum install –y nodejs yarn
```

### run build tool script:
The version of APISIX is hard-code in `run.sh` now, you can change it by yourself.
### install golang
```
wget https://dl.google.com/go/go1.15.2.linux-amd64.tar.gz
tar -xzf go1.15.2.linux-amd64.tar.gz
sudo mv go /usr/local
```

### adjust the Path Variable for golang
appending the following line to the `/etc/profile` file
```
./run.sh
export GO111MODULE=on
export GOROOT=/usr/local/go
export GOPATH=$HOME/gopath
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
```

### load the new PATH environment variable with the following command:
```
source /etc/profile
```

### create the workspace directory for golang
```
cd ~
mkdir gopath
```

### run build tool script for apisix-dashboard (must use root privileges):
```
./dashboard-rpm.sh
```

The RPM package will be in `/tmp/rpm`.
### after you installed the rpm of apisix-dashboard, run apisix-dashboard like this:
```
sudo manager-api -p /usr/local/apisix/dashboard/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@idbeta since this command only read files under /usr/local/apisix/dashboard. So do we need to use sudo here?

Copy link
Contributor Author

@idbeta idbeta Dec 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, otherwise it will prompt error

panic: couldn't open sink "/usr/local/apisix/dashboard/logs/error.log": open /usr/local/apisix/dashboard/logs/error.log: permission denied

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, otherwise it will prompt error

panic: couldn't open sink "/usr/local/apisix/dashboard/logs/error.log": open /usr/local/apisix/dashboard/logs/error.log: permission denied

@idbeta ok, my fault. I forgot the command would generate log files under /usr/local/apisix/dashboard/logs/ directory. Thanks for explanations.

```
38 changes: 38 additions & 0 deletions dashboard-rpm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

set -ex

# set the code branch
version=master

# clear the environment
rm -rf /tmp/apisix/
rm -rf /tmp/apisix-dashboard/

mkdir -p /tmp/rpm/
mkdir -p /tmp/apisix/dashboard/usr/bin/
mkdir -p /tmp/apisix/dashboard/usr/local/apisix/dashboard/

# build dashboard
cd /tmp/
git clone -b $version https://github.com/apache/apisix-dashboard.git
cd apisix-dashboard
make build

cp -r output/* /tmp/apisix/dashboard/usr/local/apisix/dashboard
ln -s /usr/local/apisix/dashboard/manager-api /tmp/apisix/dashboard/usr/bin/manager-api
cd ../..
rm -rf apisix-dashboard

# build the rpm for dashboard
fpm -f \
-s dir \
-t rpm \
-n apisix-dashboard -a `uname -i` -v $version \
--description 'Apache APISIX Dashboard is designed to make it as easy as possible for users to operate Apache APISIX through a frontend interface.' \
-C /tmp/apisix/dashboard/ \
-p /tmp/rpm/ \
--url 'https://github.com/apache/apisix-dashboard'

# copy rpm package to the `output`
cp -r /tmp/rpm/* ~/output
4 changes: 4 additions & 0 deletions output/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore