Merge pull request #2026 from wy65701436/1.1.0-document

update compile document
This commit is contained in:
Yan 2017-04-17 22:16:15 -07:00 committed by GitHub
commit c06abe9b8a
6 changed files with 87 additions and 83 deletions

View File

@ -88,7 +88,7 @@ MARIADBVERSION=mariadb-10.1.10
HTTPPROXY= HTTPPROXY=
#clarity parameters #clarity parameters
CLARITYIMAGE=danieljt/harbor-clarity-base[:tag] CLARITYIMAGE=vmware/harbor-clarity-ui-builder[:tag]
CLARITYSEEDPATH=/clarity-seed CLARITYSEEDPATH=/clarity-seed
CLARITYBUILDSCRIPT=/entrypoint.sh CLARITYBUILDSCRIPT=/entrypoint.sh

View File

@ -1,21 +1,21 @@
## Introduction ## Introduction
This guide provides instructions for developers to build and run Harbor from source code. This guide provides instructions for developers to build and run Harbor from source code.
## Step 1: Prepare for a build environment for Harbor ## Step 1: Prepare for a build environment for Harbor
Harbor is deployed as several Docker containers and most of the code is written in Go language. The build host requires Python, Docker, Docker Compose and golang development environment. Please install the below prerequisites: Harbor is deployed as several Docker containers and most of the code is written in Go language. The build environment requires Python, Docker, Docker Compose and golang development environment. Please install the below prerequisites:
Software | Required Version Software | Required Version
----------------------|-------------------------- ----------------------|--------------------------
docker | 1.10.0 + docker | 1.12.0 +
docker-compose | 1.7.1 + docker-compose | 1.11.0 +
python | 2.7 + python | 2.7 +
git | 1.9.1 + git | 1.9.1 +
make | 3.81 + make | 3.81 +
golang* | 1.6.0 + golang* | 1.7.3 +
*optional *optional, required only if you use your own Golang environment.
## Step 2: Getting the source code ## Step 2: Getting the source code
@ -28,13 +28,13 @@ golang* | 1.6.0 +
### Configuration ### Configuration
Edit the file **make/harbor.cfg** and make necessary configuration changes such as hostname, admin password and mail server. Refer to **[Installation and Configuration Guide](installation_guide.md#configuring-harbor)** for more info. Edit the file **make/harbor.cfg** and make necessary configuration changes such as hostname, admin password and mail server. Refer to **[Installation and Configuration Guide](installation_guide.md#configuring-harbor)** for more info.
```sh ```sh
$ cd harbor $ cd harbor
$ vi make/harbor.cfg $ vi make/harbor.cfg
``` ```
### Compiling and Running ### Compiling and Running
You can compile the code by one of the three approaches: You can compile the code by one of the three approaches:
@ -47,10 +47,16 @@ You can compile the code by one of the three approaches:
$ docker pull golang:1.7.3 $ docker pull golang:1.7.3
``` ```
* Build, install and bring up Harbor: * Build, install and bring up Harbor without Notary:
```sh ```sh
$ make install -e GOBUILDIMAGE=golang:1.7.3 COMPILETAG=compile_golangimage $ make install GOBUILDIMAGE=golang:1.7.3 COMPILETAG=compile_golangimage CLARITYIMAGE=vmware/harbor-clarity-ui-builder:0.8.4
```
* Build, install and bring up Harbor with Notary:
```sh
$ make install GOBUILDIMAGE=golang:1.7.3 COMPILETAG=compile_golangimage CLARITYIMAGE=vmware/harbor-clarity-ui-builder:0.8.4 NOTARYFLAG=true
``` ```
#### II. Compile code with your own Golang environment, then build Harbor #### II. Compile code with your own Golang environment, then build Harbor
@ -63,40 +69,27 @@ You can compile the code by one of the three approaches:
$ mv harbor $GOPATH/src/github.com/vmware/. $ mv harbor $GOPATH/src/github.com/vmware/.
``` ```
* Build, install and run Harbor * Build, install and run Harbor without Notary:
```sh ```sh
$ cd $GOPATH/src/github.com/vmware/harbor $ cd $GOPATH/src/github.com/vmware/harbor
$ make install $ make install
``` ```
#### III. Manual build process (compatible with previous versions) * Build, install and run Harbor with Notary:
```sh ```sh
$ cd make $ cd $GOPATH/src/github.com/vmware/harbor
$ make install -e NOTARYFLAG=true
$ ./prepare ```
Generated configuration file: ./config/ui/env
Generated configuration file: ./config/ui/app.conf
Generated configuration file: ./config/registry/config.yml
Generated configuration file: ./config/db/env
...
$ cd dev
$ docker-compose up -d
```
### Verify your installation ### Verify your installation
If everyting worked properly, you can get the below message: If everything worked properly, you can get the below message:
```sh ```sh
... ...
----Harbor has been installed and started successfully.---- Start complete. You can visit harbor now.
Now you should be able to visit the admin portal at http://$YOURIP.
For more details, please visit https://github.com/vmware/harbor .
``` ```
Refer to [Installation and Configuration Guide](installation_guide.md#managing-harbors-lifecycle) for more information about managing your Harbor instance. Refer to [Installation and Configuration Guide](installation_guide.md#managing-harbors-lifecycle) for more information about managing your Harbor instance.
@ -109,8 +102,11 @@ The `Makefile` contains these configurable parameters:
Variable | Description Variable | Description
-------------------|------------- -------------------|-------------
BASEIMAGE | Container base image, default: photon BASEIMAGE | Container base image, default: photon
CLARITYIMAGE | Clarity UI builder image, default: harbor-clarity-ui-builder
DEVFLAG | Build model flag, default: dev DEVFLAG | Build model flag, default: dev
COMPILETAG | Compile model flag, default: compile_normal (local golang build) COMPILETAG | Compile model flag, default: compile_normal (local golang build)
NOTARYFLAG | Notary mode flag, default: false
HTTPPROXY | NPM http proxy for Clarity UI builder
REGISTRYSERVER | Remote registry server IP address REGISTRYSERVER | Remote registry server IP address
REGISTRYUSER | Remote registry server user name REGISTRYUSER | Remote registry server user name
REGISTRYPASSWORD | Remote registry server user password REGISTRYPASSWORD | Remote registry server user password
@ -120,23 +116,24 @@ REGISTRYPROJECTNAME| Project name on remote registry server
Target | Description Target | Description
--------------------|------------- --------------------|-------------
all | prepare env, compile binaries, build images and install images all | prepare env, compile binaries, build images and install images
prepare | prepare env prepare | prepare env
compile | compile ui and jobservice code compile | compile ui and jobservice code
compile_ui | compile ui binary compile_ui | compile ui binary
compile_jobservice | compile jobservice binary compile_jobservice | compile jobservice binary
compile_clarity | compile Clarity binary
build | build Harbor docker images (default: using build_photon) build | build Harbor docker images (default: using build_photon)
build_photon | build Harbor docker images from Photon OS base image build_photon | build Harbor docker images from Photon OS base image
install | compile binaries, build images, prepare specific version of compose file and startup Harbor instance install | compile binaries, build images, prepare specific version of compose file and startup Harbor instance
start | startup Harbor instance start | startup Harbor instance (set NOTARYFLAG=true when with Notary)
down | shutdown Harbor instance down | shutdown Harbor instance (set NOTARYFLAG=true when with Notary)
package_online | prepare online install package package_online | prepare online install package
package_offline | prepare offline install package package_offline | prepare offline install package
pushimage | push Harbor images to specific registry server pushimage | push Harbor images to specific registry server
clean all | remove binary, Harbor images, specific version docker-compose file, specific version tag and online/offline install package clean all | remove binary, Harbor images, specific version docker-compose file, specific version tag and online/offline install package
cleanbinary | remove ui and jobservice binary cleanbinary | remove ui and jobservice binary
cleanimage | remove Harbor images cleanimage | remove Harbor images
cleandockercomposefile | remove specific version docker-compose cleandockercomposefile | remove specific version docker-compose
cleanversiontag | remove specific version tag cleanversiontag | remove specific version tag
cleanpackage | remove online/offline install package cleanpackage | remove online/offline install package
@ -163,7 +160,7 @@ cleanpackage | remove online/offline install package
$ make clean -e VERSIONTAG=[TAG] $ make clean -e VERSIONTAG=[TAG]
``` ```
**Note**: If new code had been added to Github, the git commit TAG will change. Better use this command to clean up images and files of previous TAG. **Note**: If new code had been added to Github, the git commit TAG will change. Better use this command to clean up images and files of previous TAG.
#### By default, the make process create a development build. To create a release build of Harbor, set the below flag to false. #### By default, the make process create a development build. To create a release build of Harbor, set the below flag to false.
@ -171,4 +168,3 @@ cleanpackage | remove online/offline install package
$ make XXXX -e DEVFLAG=false $ make XXXX -e DEVFLAG=false
``` ```

View File

@ -1,7 +0,0 @@
version: '2'
services:
nodeclarity:
image : danieljt/harbor-clarity-base:0.8.1
volumes:
- ../../src/ui/static/new-ui:/clarity-seed/dist
- ../../src/ui_ng:/clarity-seed

View File

@ -4,17 +4,23 @@ services:
build: build:
context: ../../ context: ../../
dockerfile: make/photon/log/Dockerfile dockerfile: make/photon/log/Dockerfile
container_name: harbor-log
restart: always restart: always
volumes: volumes:
- /var/log/harbor/:/var/log/docker/ - /var/log/harbor/:/var/log/docker/:z
ports: ports:
- 1514:514 - 127.0.0.1:1514:514
networks:
- harbor
registry: registry:
image: library/registry:2.6.0 image: vmware/registry:photon-2.6.0
container_name: registry
restart: always restart: always
volumes: volumes:
- /data/registry:/storage - /data/registry:/storage:z
- ../common/config/registry/:/etc/registry/ - ./common/config/registry/:/etc/registry/:z
networks:
- harbor
environment: environment:
- GODEBUG=netdns=cgo - GODEBUG=netdns=cgo
command: command:
@ -23,89 +29,105 @@ services:
- log - log
logging: logging:
driver: "syslog" driver: "syslog"
options: options:
syslog-address: "tcp://127.0.0.1:1514" syslog-address: "tcp://127.0.0.1:1514"
tag: "registry" tag: "registry"
mysql: mysql:
build: ../common/db/ build: ../common/db/
container_name: harbor-db
restart: always restart: always
volumes: volumes:
- /data/database:/var/lib/mysql - /data/database:/var/lib/mysql:z
networks:
- harbor
env_file: env_file:
- ../common/config/db/env - ../common/config/db/env
depends_on: depends_on:
- log - log
logging: logging:
driver: "syslog" driver: "syslog"
options: options:
syslog-address: "tcp://127.0.0.1:1514" syslog-address: "tcp://127.0.0.1:1514"
tag: "mysql" tag: "mysql"
adminserver: adminserver:
build: build:
context: ../../ context: ../../
dockerfile: make/dev/adminserver/Dockerfile dockerfile: make/dev/adminserver/Dockerfile
container_name: harbor-adminserver
env_file: env_file:
- ../common/config/adminserver/env - ../common/config/adminserver/env
restart: always restart: always
volumes: volumes:
- /data/config/:/etc/adminserver/config/ - /data/config/:/etc/adminserver/config/:z
- /data/secretkey:/etc/adminserver/key - /data/secretkey:/etc/adminserver/key:z
- /data/:/data/ - /data/:/data/:z
depends_on: depends_on:
- log - log
networks:
- harbor
logging: logging:
driver: "syslog" driver: "syslog"
options: options:
syslog-address: "tcp://127.0.0.1:1514" syslog-address: "tcp://127.0.0.1:1514"
tag: "adminserver" tag: "adminserver"
ui: ui:
build: build:
context: ../../ context: ../../
dockerfile: make/dev/ui/Dockerfile dockerfile: make/dev/ui/Dockerfile
container_name: harbor-ui
env_file: env_file:
- ../common/config/ui/env - ../common/config/ui/env
restart: always restart: always
volumes: volumes:
- ../common/config/ui/app.conf:/etc/ui/app.conf - ./common/config/ui/app.conf:/etc/ui/app.conf:z
- ../common/config/ui/private_key.pem:/etc/ui/private_key.pem - ./common/config/ui/private_key.pem:/etc/ui/private_key.pem:z
- /data/secretkey:/etc/ui/key - /data/secretkey:/etc/ui/key:z
- /data/ca_download/:/etc/ui/ca/ - /data/ca_download/:/etc/ui/ca/:z
networks:
- harbor
depends_on: depends_on:
- log - log
- adminserver - adminserver
- registry - registry
logging: logging:
driver: "syslog" driver: "syslog"
options: options:
syslog-address: "tcp://127.0.0.1:1514" syslog-address: "tcp://127.0.0.1:1514"
tag: "ui" tag: "ui"
jobservice: jobservice:
build: build:
context: ../../ context: ../../
dockerfile: make/dev/jobservice/Dockerfile dockerfile: make/dev/jobservice/Dockerfile
container_name: harbor-jobservice
env_file: env_file:
- ../common/config/jobservice/env - ../common/config/jobservice/env
restart: always restart: always
volumes: volumes:
- /data/job_logs:/var/log/jobs - /data/job_logs:/var/log/jobs:z
- ../common/config/jobservice/app.conf:/etc/jobservice/app.conf - ./common/config/jobservice/app.conf:/etc/jobservice/app.conf:z
- /data/secretkey:/etc/jobservice/key - /data/secretkey:/etc/jobservice/key:z
networks:
- harbor
depends_on: depends_on:
- ui - ui
- adminserver - adminserver
logging: logging:
driver: "syslog" driver: "syslog"
options: options:
syslog-address: "tcp://127.0.0.1:1514" syslog-address: "tcp://127.0.0.1:1514"
tag: "jobservice" tag: "jobservice"
proxy: proxy:
image: library/nginx:1.11.5 image: vmware/nginx:1.11.5-patched
container_name: nginx
restart: always restart: always
volumes: volumes:
- ../common/config/nginx:/etc/nginx - ./common/config/nginx:/etc/nginx:z
networks:
- harbor
ports: ports:
- 80:80 - 80:80
- 443:443 - 443:443
- 4443:4443
depends_on: depends_on:
- mysql - mysql
- registry - registry
@ -113,6 +135,9 @@ services:
- log - log
logging: logging:
driver: "syslog" driver: "syslog"
options: options:
syslog-address: "tcp://127.0.0.1:1514" syslog-address: "tcp://127.0.0.1:1514"
tag: "proxy" tag: "proxy"
networks:
harbor:
external: false

View File

@ -7,14 +7,13 @@ WORKDIR /go/src/github.com/vmware/harbor/src/ui
RUN go build -v -a -o /go/bin/harbor_ui RUN go build -v -a -o /go/bin/harbor_ui
ENV MYSQL_USR root \
MYSQL_PWD root \
REGISTRY_URL localhost:5000
COPY src/ui/views /go/bin/views COPY src/ui/views /go/bin/views
COPY src/ui/static /go/bin/static COPY src/ui/static /go/bin/static
COPY src/favicon.ico /go/bin/favicon.ico COPY src/favicon.ico /go/bin/favicon.ico
RUN mkdir /go/bin/harbor/
COPY VERSION /go/bin/harbor/VERSION
RUN chmod u+x /go/bin/harbor_ui RUN chmod u+x /go/bin/harbor_ui
WORKDIR /go/bin/ WORKDIR /go/bin/

View File

@ -1,9 +0,0 @@
version: '2'
services:
nodeclarity:
image : danieljt/harbor-clarity-base:0.8.0
volumes:
- ../src/ui/static/new-ui:/clarity-seed/dist
- ../src/ui_ng/src/app:/clarity-seed/src/app
depends_on:
- ui