Merge branch 'master' into dev

This commit is contained in:
Tan Jiang 2016-07-29 18:06:18 +08:00
commit 0f6cfa7623
6 changed files with 52 additions and 86 deletions

View File

@ -1,68 +0,0 @@
version: '2'
services:
log:
image: daocloud.io/harbor/deploy_log:latest
volumes:
- /var/log/harbor/:/var/log/docker/
ports:
- 1514:514
registry:
image: daocloud.io/library/registry:2.3.0
volumes:
- /data/registry:/storage
- ./config/registry/:/etc/registry/
ports:
- 5001:5001
command:
/etc/registry/config.yml
depends_on:
- log
logging:
driver: "syslog"
options:
syslog-address: "tcp://127.0.0.1:1514"
syslog-tag: "registry"
mysql:
image: daocloud.io/harbor/deploy_mysql:latest
volumes:
- /data/database:/var/lib/mysql
env_file:
- ./config/db/env
depends_on:
- log
logging:
driver: "syslog"
options:
syslog-address: "tcp://127.0.0.1:1514"
syslog-tag: "mysql"
ui:
image: daocloud.io/harbor/deploy_ui:latest
env_file:
- ./config/ui/env
volumes:
- ./config/ui/app.conf:/etc/ui/app.conf
- ./config/ui/private_key.pem:/etc/ui/private_key.pem
depends_on:
- log
logging:
driver: "syslog"
options:
syslog-address: "tcp://127.0.0.1:1514"
syslog-tag: "ui"
proxy:
image: daocloud.io/library/nginx:1.9
volumes:
- ./config/nginx:/etc/nginx
ports:
- 80:80
- 443:443
depends_on:
- mysql
- registry
- ui
- log
logging:
driver: "syslog"
options:
syslog-address: "tcp://127.0.0.1:1514"
syslog-tag: "proxy"

View File

@ -0,0 +1 @@
docker-compose.sh is used to configure docker-compose.yml to pull images from platform like docker hub, daocloud.io and others. If you don't want to waste time on building images, you can execute this script to pull images from platform you prefer. Currently, we only support daocloud.io and docker hub, the default is docker hub.

View File

@ -0,0 +1,32 @@
#/bin/bash
read -p "Please input the platform name you want to pull images, for docker hub, enter 1; for daocloud.io, enter 2, otherwise enter the name of the platform, the default is 1:" choice
cd ../../Deploy
template_file="docker-compose.yml.template"
yml_file='docker-compose.yml'
if test -e $template_file
then
cp $template_file $yml_file
else
cp $yml_file $template_file
fi
platform=''
choice=${choice:-1}
if [ $choice == '1' ]
then
platform='prjharbor/'
elif [ $choice == '2' ]
then
platform='daocloud.io/harbor/'
else
platform=$choice
fi
version='0.3.0'
log='deploy_log:'
db='deploy_mysql:'
job_service='deploy_jobservice:'
ui='deploy_ui:'
sed -i -- '/build: .\/log\//c\ image: '$platform$log$version'' $yml_file
sed -i -- '/build: .\/db\//c\ image: '$platform$db$version'' $yml_file
sed -i -- '/ui:/{n;N;N;d}' $yml_file && sed -i -- '/ui:/a\\ image: '$platform$ui$version'' $yml_file
sed -i -- '/jobservice:/{n;N;N;d}' $yml_file && sed -i -- '/jobservice:/a\\ image: '$platform$job_service$version'' $yml_file
echo "succeed! "

View File

@ -1,8 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
import requests import json
import simplejson
import logging import logging
import requests
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
@ -52,7 +52,8 @@ class HarborClient(object):
project_id, project_name)) project_id, project_name))
return project_id return project_id
else: else:
pritn("Fail to get project id from project name", project_name) logging.error("Fail to get project id from project name",
project_name)
return None return None
# GET /search # GET /search
@ -107,8 +108,8 @@ class HarborClient(object):
def create_project(self, project_name, is_public=False): def create_project(self, project_name, is_public=False):
result = False result = False
path = '%s://%s/api/projects' % (self.protocol, self.host) path = '%s://%s/api/projects' % (self.protocol, self.host)
request_body = simplejson.dumps({'project_name': project_name, request_body = json.dumps({'project_name': project_name,
'public': is_public}) 'public': is_public})
response = requests.post(path, response = requests.post(path,
cookies={'beegosessionID': self.session_id}, cookies={'beegosessionID': self.session_id},
data=request_body) data=request_body)
@ -129,7 +130,7 @@ class HarborClient(object):
result = False result = False
path = '%s://%s/api/projects/%s/publicity?project_id=%s' % ( path = '%s://%s/api/projects/%s/publicity?project_id=%s' % (
self.protocol, self.host, project_id, project_id) self.protocol, self.host, project_id, project_id)
request_body = simplejson.dumps({'public': is_public}) request_body = json.dumps({'public': is_public})
response = requests.put(path, response = requests.put(path,
cookies={'beegosessionID': self.session_id}, cookies={'beegosessionID': self.session_id},
data=request_body) data=request_body)
@ -175,11 +176,11 @@ class HarborClient(object):
def create_user(self, username, email, password, realname, comment): def create_user(self, username, email, password, realname, comment):
result = False result = False
path = '%s://%s/api/users' % (self.protocol, self.host) path = '%s://%s/api/users' % (self.protocol, self.host)
request_body = simplejson.dumps({'username': username, request_body = json.dumps({'username': username,
'email': email, 'email': email,
'password': password, 'password': password,
'realname': realname, 'realname': realname,
'comment': comment}) 'comment': comment})
response = requests.post(path, response = requests.post(path,
cookies={'beegosessionID': self.session_id}, cookies={'beegosessionID': self.session_id},
data=request_body) data=request_body)
@ -199,9 +200,9 @@ class HarborClient(object):
result = False result = False
path = '%s://%s/api/users/%s?user_id=%s' % (self.protocol, self.host, path = '%s://%s/api/users/%s?user_id=%s' % (self.protocol, self.host,
user_id, user_id) user_id, user_id)
request_body = simplejson.dumps({'email': email, request_body = json.dumps({'email': email,
'realname': realname, 'realname': realname,
'comment': comment}) 'comment': comment})
response = requests.put(path, response = requests.put(path,
cookies={'beegosessionID': self.session_id}, cookies={'beegosessionID': self.session_id},
data=request_body) data=request_body)
@ -236,8 +237,8 @@ class HarborClient(object):
result = False result = False
path = '%s://%s/api/users/%s/password?user_id=%s' % ( path = '%s://%s/api/users/%s/password?user_id=%s' % (
self.protocol, self.host, user_id, user_id) self.protocol, self.host, user_id, user_id)
request_body = simplejson.dumps({'old_password': old_password, request_body = json.dumps({'old_password': old_password,
'new_password': new_password}) 'new_password': new_password})
response = requests.put(path, response = requests.put(path,
cookies={'beegosessionID': self.session_id}, cookies={'beegosessionID': self.session_id},
data=request_body) data=request_body)

View File

@ -44,7 +44,7 @@
<td width="20%">//u.email//</td> <td width="20%">//u.email//</td>
<td width="35%">//u.creation_time | dateL : 'YYYY-MM-DD HH:mm:ss'//</td> <td width="35%">//u.creation_time | dateL : 'YYYY-MM-DD HH:mm:ss'//</td>
<td width="15%"> <td width="15%">
<toggle-admin has-admin-role="u.has_admin_role == 1" user-id="//u.user_id//"></toggle-admin> <toggle-admin has-admin-role="u.has_admin_role" user-id="//u.user_id//"></toggle-admin>
</td> </td>
<td width="20%"> <td width="20%">
&nbsp;&nbsp;<a href="javascript:void(0)" ng-click="vm.confirmToDelete(u.user_id, u.username)"><span class="glyphicon glyphicon-trash"></span></a> &nbsp;&nbsp;<a href="javascript:void(0)" ng-click="vm.confirmToDelete(u.user_id, u.username)"><span class="glyphicon glyphicon-trash"></span></a>

View File

@ -25,7 +25,7 @@
function ToggleAdminController($scope, ToggleAdminService, $filter, trFilter) { function ToggleAdminController($scope, ToggleAdminService, $filter, trFilter) {
var vm = this; var vm = this;
vm.isAdmin = (vm.hasAdminRole === 1) ? true : false; vm.isAdmin = (vm.hasAdminRole === 1);
vm.enabled = vm.isAdmin ? 0 : 1; vm.enabled = vm.isAdmin ? 0 : 1;
vm.toggle = toggle; vm.toggle = toggle;