Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
barry cho
Rancher
Commits
b808b6f0
Commit
b808b6f0
authored
7 years ago
by
Darren Shepherd
Browse files
Options
Download
Email Patches
Plain Diff
Rancher 2.0 build
parent
7961e141
v2.0-tp1
Tags unavailable
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
agent/run.sh
+1
-0
agent/run.sh
server/Dockerfile
+17
-15
server/Dockerfile
server/artifacts/cattle.sh
+15
-120
server/artifacts/cattle.sh
server/artifacts/install_cattle_binaries
+5
-14
server/artifacts/install_cattle_binaries
server/artifacts/mysql-dump.sql
+728
-2374
server/artifacts/mysql-dump.sql
with
766 additions
and
2523 deletions
+766
-2523
agent/run.sh
+
1
-
0
View file @
b808b6f0
...
@@ -291,6 +291,7 @@ run_bootstrap()
...
@@ -291,6 +291,7 @@ run_bootstrap()
if
[
"
$CATTLE_EXEC_AGENT
"
=
"true"
]
;
then
if
[
"
$CATTLE_EXEC_AGENT
"
=
"true"
]
;
then
exec
bash
$SCRIPT
"
$@
"
exec
bash
$SCRIPT
"
$@
"
else
else
cat
$SCRIPT
bash
$SCRIPT
"
$@
"
bash
$SCRIPT
"
$@
"
fi
fi
}
}
...
...
This diff is collapsed.
Click to expand it.
server/Dockerfile
+
17
-
15
View file @
b808b6f0
...
@@ -39,30 +39,28 @@ EXPOSE 8080
...
@@ -39,30 +39,28 @@ EXPOSE 8080
ENV
CATTLE_HOST_API_PROXY_MODE embedded
ENV
CATTLE_HOST_API_PROXY_MODE embedded
# Environment variables commonly updated when performing a release
# Environment variables commonly updated when performing a release
ENV
CATTLE_RANCHER_SERVER_VERSION v
1.6.10
ENV
CATTLE_RANCHER_SERVER_VERSION v
2.0.0-alpha1
ENV
DEFAULT_CATTLE_API_UI_INDEX //releases.rancher.com/ui/1.6.
23
ENV
DEFAULT_CATTLE_API_UI_INDEX //releases.rancher.com/ui/1.6.
17
ENV
CATTLE_CATTLE_VERSION v0.18
3.22
ENV
CATTLE_CATTLE_VERSION v0.18
4.0
ENV
CATTLE_RANCHER_CLI_VERSION v0.6.
4
ENV
CATTLE_RANCHER_CLI_VERSION v0.6.
3
ENV
CATTLE_RANCHER_COMPOSE_VERSION v0.12.5
#
ENV
DEFAULT_CATTLE_CATALOG_URL='{"catalogs":{"community":{"url":"https://git.rancher.io/community-catalog.git","branch":"master"},"library":{"url":"https://git.rancher.io/rancher-catalog.git","branch":"${RELEASE}"}}}'
ENV
DEFAULT_CATTLE_CATALOG_URL='{"catalogs":{"community":{"url":"https://git.rancher.io/community-catalog.git","branch":"master"},"library":{"url":"https://git
.
rancher
.io
/rancher-catalog.git","branch":"
${RELEASE}
"}}}'
ENV
DEFAULT_CATTLE_CATALOG_URL='{"catalogs":{"community":{"url":"https://git.rancher.io/community-catalog.git","branch":"master"},"library":{"url":"https://git
hub.com/
rancher/rancher-catalog.git","branch":"
v2.0-development
"}}}'
ENV
DEFAULT_CATTLE_RANCHER_COMPOSE_LINUX_URL https://releases.rancher.com/compose/${CATTLE_RANCHER_COMPOSE_VERSION}/rancher-compose-linux-amd64-${CATTLE_RANCHER_COMPOSE_VERSION}.tar.gz
ENV
DEFAULT_CATTLE_RANCHER_COMPOSE_DARWIN_URL https://releases.rancher.com/compose/${CATTLE_RANCHER_COMPOSE_VERSION}/rancher-compose-darwin-amd64-${CATTLE_RANCHER_COMPOSE_VERSION}.tar.gz
ENV
DEFAULT_CATTLE_RANCHER_COMPOSE_WINDOWS_URL https://releases.rancher.com/compose/${CATTLE_RANCHER_COMPOSE_VERSION}/rancher-compose-windows-386-${CATTLE_RANCHER_COMPOSE_VERSION}.zip
ENV
DEFAULT_CATTLE_RANCHER_CLI_LINUX_URL https://releases.rancher.com/cli/${CATTLE_RANCHER_CLI_VERSION}/rancher-linux-amd64-${CATTLE_RANCHER_CLI_VERSION}.tar.gz
ENV
DEFAULT_CATTLE_RANCHER_CLI_LINUX_URL https://releases.rancher.com/cli/${CATTLE_RANCHER_CLI_VERSION}/rancher-linux-amd64-${CATTLE_RANCHER_CLI_VERSION}.tar.gz
ENV
DEFAULT_CATTLE_RANCHER_CLI_DARWIN_URL https://releases.rancher.com/cli/${CATTLE_RANCHER_CLI_VERSION}/rancher-darwin-amd64-${CATTLE_RANCHER_CLI_VERSION}.tar.gz
ENV
DEFAULT_CATTLE_RANCHER_CLI_DARWIN_URL https://releases.rancher.com/cli/${CATTLE_RANCHER_CLI_VERSION}/rancher-darwin-amd64-${CATTLE_RANCHER_CLI_VERSION}.tar.gz
ENV
DEFAULT_CATTLE_RANCHER_CLI_WINDOWS_URL https://releases.rancher.com/cli/${CATTLE_RANCHER_CLI_VERSION}/rancher-windows-386-${CATTLE_RANCHER_CLI_VERSION}.zip
ENV
DEFAULT_CATTLE_RANCHER_CLI_WINDOWS_URL https://releases.rancher.com/cli/${CATTLE_RANCHER_CLI_VERSION}/rancher-windows-386-${CATTLE_RANCHER_CLI_VERSION}.zip
EXPOSE
3306
EXPOSE
3306
ADD
https://github.com/rancherio/cattle/releases/download/${CATTLE_CATTLE_VERSION}/cattle
.jar /usr/share/cattle/
RUN
curl
-sfL
https://github.com/rancherio/cattle/releases/download/
${
CATTLE_CATTLE_VERSION
}
/cattle
-
${
CATTLE_CATTLE_VERSION
}
.tar.gz |
tar
xvzf -
-C
/usr/share/cattle/
--strip-components
=
1
RUN
cd
/
&&
for
i
in
$(
ls
/s6-statics/
*
static.tar.gz
)
;
do
tar
-C
/usr
-zxvf
$i
;
done
&&
rm
-rf
/s6-statics/
*
static.tar.gz
&&
\
RUN
cd
/
&&
for
i
in
$(
ls
/s6-statics/
*
static.tar.gz
)
;
do
tar
-C
/usr
-zxvf
$i
;
done
&&
rm
-rf
/s6-statics/
*
static.tar.gz
&&
\
mkdir
-p
$CATTLE_HOME
&&
\
mkdir
-p
$CATTLE_HOME
&&
\
/usr/share/cattle/cattle.sh extract
&&
\
mkdir
-p
/usr/share/cattle/ui/api-ui
&&
\
curl
-sL
https:
${
DEFAULT_CATTLE_API_UI_INDEX
}
.tar.gz |
tar
xvzf -
-C
/usr/share/cattle/war
--strip-components
=
1
&&
\
curl
-sL
https:
${
DEFAULT_CATTLE_API_UI_INDEX
}
.tar.gz |
tar
xvzf -
-C
/usr/share/cattle/ui
--strip-components
=
1
&&
\
mkdir
-p
/usr/share/cattle/war/api-ui
&&
\
curl
-sL
https:
${
CATTLE_API_UI_URL
}
.tar.gz |
tar
xvzf -
-C
/usr/share/cattle/ui/api-ui
--strip-components
=
1
&&
\
curl
-sL
https:
${
CATTLE_API_UI_URL
}
.tar.gz |
tar
xvzf -
-C
/usr/share/cattle/war/api-ui
--strip-components
=
1
&&
\
jar xvf /usr/share/cattle/lib/cattle-resources-
${
CATTLE_CATTLE_VERSION
}
.jar cattle-global.properties
&&
\
/usr/share/cattle/install_cattle_binaries
&&
\
bash
-x
/usr/share/cattle/install_cattle_binaries
&&
\
rm
cattle-global.properties
&&
\
curl
-sL
https://github.com/prometheus/graphite_exporter/releases/download/v0.2.0/graphite_exporter-0.2.0.linux-amd64.tar.gz |
tar
-xzv
-C
/usr/bin/
--strip-components
=
1
curl
-sL
https://github.com/prometheus/graphite_exporter/releases/download/v0.2.0/graphite_exporter-0.2.0.linux-amd64.tar.gz |
tar
-xzv
-C
/usr/bin/
--strip-components
=
1
RUN
cd
$CATTLE_HOME
&&
\
RUN
cd
$CATTLE_HOME
&&
\
echo
"
$DEFAULT_CATTLE_CATALOG_URL
"
|
sed
's/${RELEASE}/'
$(
echo
$CATTLE_RANCHER_SERVER_VERSION
|
sed
-E
's/(v[0-9]+\.[0-9]+).*/\1-release/'
)
/g
>
repo.json
&&
\
echo
"
$DEFAULT_CATTLE_CATALOG_URL
"
|
sed
's/${RELEASE}/'
$(
echo
$CATTLE_RANCHER_SERVER_VERSION
|
sed
-E
's/(v[0-9]+\.[0-9]+).*/\1-release/'
)
/g
>
repo.json
&&
\
...
@@ -80,7 +78,11 @@ ENV DEFAULT_CATTLE_CATALOG_EXECUTE true
...
@@ -80,7 +78,11 @@ ENV DEFAULT_CATTLE_CATALOG_EXECUTE true
ENV
DEFAULT_CATTLE_AUTH_SERVICE_EXECUTE true
ENV
DEFAULT_CATTLE_AUTH_SERVICE_EXECUTE true
ENV
DEFAULT_CATTLE_WEBHOOK_SERVICE_EXECUTE true
ENV
DEFAULT_CATTLE_WEBHOOK_SERVICE_EXECUTE true
ENV
DEFAULT_CATTLE_SECRETS_API_EXECUTE true
ENV
DEFAULT_CATTLE_SECRETS_API_EXECUTE true
ENV
DEFAULT_CATTLE_NETES_AGENT_EXECUTE true
ENV
DEFAULT_CATTLE_NETES_EXECUTE true
ENV
CATTLE_RANCHER_SERVER_IMAGE rancher/server
ENV
CATTLE_RANCHER_SERVER_IMAGE rancher/server
ENTRYPOINT
["/usr/bin/entry"]
ENTRYPOINT
["/usr/bin/entry"]
CMD
["/usr/bin/s6-svscan", "/service"]
CMD
["/usr/bin/s6-svscan", "/service"]
ENV
REPOS "netes-agent"
This diff is collapsed.
Click to expand it.
server/artifacts/cattle.sh
+
15
-
120
View file @
b808b6f0
#!/bin/bash
#!/bin/bash
set
-e
set
-e
-x
cd
/var/lib/cattle
cd
/var/lib/cattle
JAR
=
/usr/share/cattle/cattle.jar
SCRIPT
=
/usr/share/cattle/bin/cattle
HASH
=
$(
md5sum
$JAR
|
awk
'{print $1}'
)
HASH
=
$(
md5sum
$SCRIPT
|
awk
'{print $1}'
)
DEBUG_JAR
=
/var/lib/cattle/lib/cattle-debug.jar
LOG_DIR
=
/var/lib/cattle/logs
LOG_DIR
=
/var/lib/cattle/logs
export
S6_SERVICE_DIR
=
${
S6_SERVICE_DIR
:-
$S6_SERVICE_DIR
}
export
S6_SERVICE_DIR
=
${
S6_SERVICE_DIR
:-
$S6_SERVICE_DIR
}
if
[
"
$URL
"
!=
""
]
then
echo
Downloading
$URL
curl
-sLf
$URL
>
cattle-download.jar
JAR
=
cattle-download.jar
fi
if
[
-e
$DEBUG_JAR
]
;
then
JAR
=
$DEBUG_JAR
fi
setup_local_agents
()
setup_local_agents
()
{
{
if
[
"
${
CATTLE_USE_LOCAL_ARTIFACTS
}
"
==
"true"
]
;
then
if
[
"
${
CATTLE_USE_LOCAL_ARTIFACTS
}
"
==
"true"
]
;
then
...
@@ -77,76 +65,6 @@ setup_mysql()
...
@@ -77,76 +65,6 @@ setup_mysql()
fi
fi
}
}
setup_redis
()
{
local
hosts
=
""
local
i
=
1
while
[
-n
"
$(
eval echo
\$
REDIS
${
i
}
_PORT_6379_TCP_ADDR
)
"
]
;
do
local
host
=
"
$(
eval echo
\$
REDIS
${
i
}
_PORT_6379_TCP_ADDR:
\$
REDIS
${
i
}
_PORT_6379_TCP_PORT
)
"
if
[
-n
"
$hosts
"
]
;
then
hosts
=
"
$hosts
,
$host
"
else
hosts
=
"
$host
"
fi
i
=
$((
i+1
))
done
if
[
-n
"
$hosts
"
]
;
then
export
CATTLE_REDIS_HOSTS
=
${
CATTLE_REDIS_HOSTS
:-
$hosts
}
fi
if
[
-n
"
$CATTLE_REDIS_HOSTS
"
]
;
then
export
CATTLE_MODULE_PROFILE_REDIS
=
true
fi
}
setup_zk
()
{
local
hosts
=
""
local
i
=
1
while
[
-n
"
$(
eval echo
\$
ZK
${
i
}
_PORT_2181_TCP_ADDR
)
"
]
;
do
local
host
=
"
$(
eval echo
\$
ZK
${
i
}
_PORT_2181_TCP_ADDR:
\$
ZK
${
i
}
_PORT_2181_TCP_PORT
)
"
if
[
-n
"
$hosts
"
]
;
then
hosts
=
"
$hosts
,
$host
"
else
hosts
=
"
$host
"
fi
i
=
$((
i+1
))
done
if
[
-n
"
$hosts
"
]
;
then
export
CATTLE_ZOOKEEPER_CONNECTION_STRING
=
${
CATTLE_ZOOKEEPER_CONNECTION_STRING
:-
$hosts
}
fi
if
[
-n
"
$CATTLE_ZOOKEEPER_CONNECTION_STRING
"
]
;
then
export
CATTLE_MODULE_PROFILE_ZOOKEEPER
=
true
fi
if
[
-n
"
$CATTLE_ZOOKEEPER_CONNECTION_STRING
"
]
;
then
local
ok
=
false
for
((
i
=
0
;
i<
=
30
;
i++
))
;
do
local
host
=
"
$(
echo
$CATTLE_ZOOKEEPER_CONNECTION_STRING
|
cut
-f1
-d
, |
cut
-f1
-d
:
)
"
local
port
=
"
$(
echo
$CATTLE_ZOOKEEPER_CONNECTION_STRING
|
cut
-f1
-d
, |
cut
-f2
-d
:
)
"
echo
Waiting
for
Zookeeper at
${
host
}
:
${
port
}
if
[
"
$(
echo
ruok | nc
$host
$port
)
"
==
"imok"
]
;
then
ok
=
true
break
fi
sleep
2
done
if
[
"
$ok
"
!=
"true"
]
;
then
echo
Failed waiting
for
Zookeeper at
${
host
}
:
${
port
}
return
1
fi
fi
}
setup_proxy
()
setup_proxy
()
{
{
if
[
-n
"
$http_proxy
"
]
;
then
if
[
-n
"
$http_proxy
"
]
;
then
...
@@ -176,8 +94,6 @@ run() {
...
@@ -176,8 +94,6 @@ run() {
setup_prometheus
setup_prometheus
setup_gelf
setup_gelf
setup_mysql
setup_mysql
setup_redis
setup_zk
setup_proxy
setup_proxy
env
|
grep
CATTLE |
grep
-v
PASS |
sort
env
|
grep
CATTLE |
grep
-v
PASS |
sort
...
@@ -191,29 +107,10 @@ run() {
...
@@ -191,29 +107,10 @@ run() {
MX
=
"1g"
MX
=
"1g"
fi
fi
HASH_PATH
=
$(
dirname
$JAR
)
/
$HASH
unset
DEFAULT_CATTLE_API_UI_JS_URL
if
[
-e
$HASH_PATH
]
;
then
unset
DEFAULT_CATTLE_API_UI_CSS_URL
if
[
-e
$HASH_PATH
/index.html
]
;
then
export
JAVA_OPTS
=
"
${
CATTLE_JAVA_OPTS
:-
-XX
:+UseConcMarkSweepGC
-XX
:+CMSClassUnloadingEnabled
-Xms128m -Xmx
${
MX
}
-XX
:+HeapDumpOnOutOfMemoryError
-XX
:HeapDumpPath
=
$LOG_DIR
}
$PROXY_ARGS
$JAVA_OPTS
"
export
DEFAULT_CATTLE_API_UI_INDEX
=
local
exec
$SCRIPT
"
$@
"
$ARGS
fi
exec
java
${
CATTLE_JAVA_OPTS
:-
-XX
:+UseConcMarkSweepGC
-XX
:+CMSClassUnloadingEnabled
-Xms128m -Xmx
${
MX
}
-XX
:+HeapDumpOnOutOfMemoryError
-XX
:HeapDumpPath
=
$LOG_DIR
}
-Dlogback
.bootstrap.level
=
WARN
$PROXY_ARGS
$JAVA_OPTS
-cp
${
HASH_PATH
}
:
${
HASH_PATH
}
/etc/cattle io.cattle.platform.launcher.Main
"
$@
"
$ARGS
else
unset
DEFAULT_CATTLE_API_UI_JS_URL
unset
DEFAULT_CATTLE_API_UI_CSS_URL
exec
java
${
CATTLE_JAVA_OPTS
:-
-XX
:+UseConcMarkSweepGC
-XX
:+CMSClassUnloadingEnabled
-Xms128m -Xmx
${
MX
}
-XX
:+HeapDumpOnOutOfMemoryError
-XX
:HeapDumpPath
=
$LOG_DIR
}
$PROXY_ARGS
$JAVA_OPTS
-jar
$JAR
"
$@
"
$ARGS
fi
}
extract
()
{
cd
$(
dirname
$JAR
)
java
-jar
$JAR
war
mkdir
$HASH
ln
-s
$HASH
war
cd
war
unzip ../
*
.war
unzip
$JAR
etc
\*
rm
../
*
.war
}
}
master
()
master
()
...
@@ -243,18 +140,18 @@ master()
...
@@ -243,18 +140,18 @@ master()
get_source
get_source
cd
cattle
cd
cattle
cattle-binary-pull ./resources/
content
/cattle-global.properties /usr/bin
>
/tmp/download.log 2>&1 &
cattle-binary-pull ./
modules/
resources/
src/main/resources
/cattle-global.properties /usr/bin
>
/tmp/download.log 2>&1 &
cd
..
cd
..
build_source
build_source
cd
cattle
cd
cattle
./
mvnw package
./
gradlew distZip
wait
||
{
EXTRACT
=
$(
mktemp
-d
)
cat
/tmp/download.log
ZIP
=
$(
readlink
-f
modules/main/build/distributions/cattle
*
.zip
)
exit
1
cd
$EXTRACT
}
unzip
$ZIP
JAR
=
$(
readlink
-f
code/packaging/app/target/cattle-app-
*
.war
)
SCRIPT
=
$(
readlink
-f
*
/bin/cattle
)
run
run
}
}
...
@@ -313,9 +210,7 @@ build_source()
...
@@ -313,9 +210,7 @@ build_source()
update-rancher-ssl
update-rancher-ssl
if
[
"
$1
"
=
"extract"
]
;
then
if
[
"
$CATTLE_MASTER
"
=
true
]
;
then
extract
elif
[
"
$CATTLE_MASTER
"
=
true
]
;
then
master
master
else
else
run
run
...
...
This diff is collapsed.
Click to expand it.
server/artifacts/install_cattle_binaries
+
5
-
14
View file @
b808b6f0
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
set
-e
set
-e
PROP
=
$(
readlink
-f
cattle-global.properties
)
mkdir
-p
/tmp/extracted_cattle
mkdir
-p
/tmp/extracted_cattle
cd
/tmp/extracted_cattle
cd
/tmp/extracted_cattle
...
@@ -16,14 +18,6 @@ install_build_tools()
...
@@ -16,14 +18,6 @@ install_build_tools()
rm
-rf
${
tmpdir
}
rm
-rf
${
tmpdir
}
}
}
unpack_jar
()
{
unzip /usr/share/cattle/cattle.jar
mkdir
-p
res
&&
cd
res
unpack200 ../WEB-INF/lib/cattle-resources-
*
.jar.pack resources.jar
unzip resources.jar
}
clean_up
()
clean_up
()
{
{
cd
/tmp
cd
/tmp
...
@@ -46,9 +40,6 @@ trap clean_up EXIT SIGINT SIGTERM
...
@@ -46,9 +40,6 @@ trap clean_up EXIT SIGINT SIGTERM
install_build_tools
install_build_tools
if
[
-f
"/usr/share/cattle/cattle.jar"
]
;
then
/usr/bin/cattle-binary-pull
$PROP
/usr/bin
unpack_jar
local_agents
/usr/bin/cattle-binary-pull ./cattle-global.properties /usr/bin
/usr/bin/cattle-binary-pull
$PROP
/usr/share/cattle/artifacts agent
local_agents
/usr/bin/cattle-binary-pull ./cattle-global.properties /usr/share/cattle/artifacts agent
fi
This diff is collapsed.
Click to expand it.
server/artifacts/mysql-dump.sql
+
728
-
2374
View file @
b808b6f0
This source diff could not be displayed because it is too large. You can
view the blob
instead.
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help