Compare commits

...

41 Commits

Author SHA1 Message Date
Sven Dowideit
a2e3c9aa50 Merge pull request #1940 from SvenDowideit/os-1643-vfat-config-drive
Add test for vfat formatted config drive
2017-06-23 21:51:38 +10:00
Sven Dowideit
09bd518cd0 go fmt tests/cloud_init_test.go
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-06-23 11:48:28 +00:00
Robert Juliano
5dd92a610b Add test for vfat formatted config drive 2017-06-23 11:48:03 +00:00
Sven Dowideit
68b005bc50 Merge pull request #1938 from SvenDowideit/fix-elide-cmdline-test
Fix ElideCmdline test by making it more robust
2017-06-23 13:04:21 +10:00
Sven Dowideit
94a4fe7778 Fix ElideCmdline test by making it more robust
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-06-23 03:03:57 +00:00
Sven Dowideit
4c49c8fef5 Merge pull request #1915 from SvenDowideit/test-complicated-dhcp-with-static-ip
Test complicated dhcp with static ip
2017-06-23 12:17:25 +10:00
Sven Dowideit
75168c6d11 Swap the remove and apply IP order - seem to fix the problem
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-06-23 12:16:41 +10:00
Sven Dowideit
3978d93fca Add a failing test for dualnics with static ip missing
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-06-23 12:16:11 +10:00
Sven Dowideit
034073b8ab Merge pull request #1922 from sebastien-prudhomme/master
Fix OpenStack console log problem #1094
2017-06-23 12:12:31 +10:00
Sven Dowideit
c539270c2a Merge pull request #1911 from SvenDowideit/registry-mirror-docs
Add some specific examples for registry mirror settings
2017-06-21 22:55:12 +10:00
Sven Dowideit
922b23eb78 Merge pull request #1909 from superseb/remove_dkms_sidebar
Remove link to removed page DKMS
2017-06-21 22:53:48 +10:00
Sven Dowideit
1e3cd14af7 Merge pull request #1930 from SvenDowideit/use-engine-registry-mirror
Use engine registry mirror
2017-06-20 15:26:30 +10:00
Sven Dowideit
3e68d3c92c Use a locally configured ENGINE_REGISTRY_MIRROR if available
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-06-20 15:24:57 +10:00
Sven Dowideit
853d27dffc Merge pull request #1929 from SvenDowideit/buildroot-v2017.02.2
update to buildroot v2017.02.2 until strato is ready
2017-06-20 11:59:07 +10:00
Sven Dowideit
284f029b19 buildroot v2017.02.2
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-06-20 01:57:10 +00:00
Sven Dowideit
437034cb48 Merge pull request #1447 from tetatetit/serial-console-online.net-fixed
Fixed serial console login did not work on Online.net and it daughter …
2017-06-20 10:34:26 +10:00
Sven Dowideit
06743261b9 Merge pull request #1928 from klud1/master
Simple update README.md to AARCH64 desciption
2017-06-20 09:32:55 +10:00
Mauricio Ugaz
c467aedcda Simple update README.md to AARCH64 desciption 2017-06-19 18:27:01 -04:00
Sven Dowideit
f9cbc5ce34 Merge pull request #1925 from SvenDowideit/linux-4.9.33
linux 4.9.33
2017-06-19 14:33:38 +10:00
Sven Dowideit
172a4782df linux 4.9.33
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-06-19 14:33:07 +10:00
Sébastien Prud'homme
4551278b99 Fix OpenStack console log problem #1094 2017-06-15 09:16:51 +02:00
Sven Dowideit
26939ebb7e Merge pull request #1920 from SvenDowideit/add-apt-cache-build-arg
Add apt-cacher build arg
2017-06-15 15:55:30 +10:00
Sven Dowideit
1eb6991798 Add apt-cacher build arg
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-06-14 13:45:04 +10:00
Sven Dowideit
d0bfdb444e Add some specific examples for registry mirror settings
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-06-12 12:36:04 +10:00
Sebastiaan van Steenis
6bbde90e0a Remove link to removed page DKMS 2017-06-09 17:23:25 +02:00
Sven Dowideit
d52b995450 Merge pull request #1905 from SvenDowideit/linux-4.9.31
linux kernel 4.9.31
2017-06-08 11:10:29 +10:00
Sven Dowideit
f0b9928541 linux kernel 4.9.31
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-06-08 01:03:43 +00:00
Sven Dowideit
0f0c9b6149 Merge pull request #1891 from SvenDowideit/cleanup-debug-log-symlink-msg
remove symlink error messages on second run of entrypoint
2017-06-06 11:46:15 +10:00
Sven Dowideit
ef7c16d4d4 Merge pull request #1846 from SvenDowideit/simplify-cloud-init
Add a default for configdrive, and add '*' to scan all defaultable da…
2017-06-05 15:48:05 +10:00
Sven Dowideit
ff87df4231 Merge pull request #1890 from SvenDowideit/resize_and_autoformat
Test resize, and update docs
2017-06-05 15:46:13 +10:00
Sven Dowideit
cfd9e80ac6 merge over https://github.com/rancher/rancher.github.io/pull/770
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-06-05 15:38:05 +10:00
Sven Dowideit
7d4685dcdd Merge pull request #1894 from SvenDowideit/rpi64
initial build of rpi64 - needs testing.
2017-06-05 11:41:11 +10:00
Sven Dowideit
272f3942f1 Initial build, copied from rpi32
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-06-05 11:35:26 +10:00
Sven Dowideit
abaecf4e44 Merge pull request #1892 from rancher/v1.0.2-release
v1.0.2 release
2017-06-05 10:41:22 +10:00
Sven Dowideit
e054331f11 v1.0.2 release
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-06-05 10:10:34 +10:00
Sven Dowideit
53fced8122 Merge pull request #1893 from aphillipo/patch-1
Update README.md
2017-06-04 13:37:37 +10:00
Andrew Phillipo
b033444d20 Update README.md 2017-06-03 18:42:11 +09:00
Sven Dowideit
242d42fbb1 remove symlink error messages on second run of entrypoint
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-06-02 14:17:29 +10:00
Sven Dowideit
62c9096164 Test resize, and update docs
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-06-02 13:21:47 +10:00
Sven Dowideit
f7605990a5 Add a default for configdrive, and add '*' to scan all defaultable datasources
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-05-12 01:48:19 +00:00
Serhiy Berezin
e43fb097c8 Fixed serial console login did not work on Online.net and it dougter Scaleway.com but shown garbage and broken futher output instead 2016-12-02 00:40:04 +00:00
34 changed files with 689 additions and 127 deletions

View File

@@ -1,8 +1,13 @@
FROM ubuntu:16.04
# FROM arm64=aarch64/ubuntu:16.04 arm=armhf/ubuntu:16.04
RUN apt-get update && \
apt-get install -y --no-install-recommends \
# get the apt-cacher proxy set
ARG APTPROXY=
RUN echo "Acquire::http { Proxy \"$APTPROXY\"; };" >> /etc/apt/apt.conf.d/01proxy \
&& cat /etc/apt/apt.conf.d/01proxy \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
cpio \
@@ -19,6 +24,7 @@ RUN apt-get update && \
libselinux1-dev \
locales \
module-init-tools \
mtools \
openssh-client \
pkg-config \
qemu \
@@ -28,11 +34,12 @@ RUN apt-get update && \
syslinux-common \
vim \
wget \
xorriso
xorriso \
telnet
########## Dapper Configuration #####################
ENV DAPPER_ENV VERSION DEV_BUILD RUNTEST DEBUG
ENV DAPPER_ENV VERSION DEV_BUILD RUNTEST DEBUG APTPROXY
ENV DAPPER_DOCKER_SOCKET true
ENV DAPPER_SOURCE /go/src/github.com/rancher/os
ENV DAPPER_OUTPUT ./bin ./dist ./build/initrd ./build/kernel
@@ -56,7 +63,7 @@ ARG DOCKER_BUILD_VERSION=1.10.3
ARG DOCKER_BUILD_PATCH_VERSION=v${DOCKER_BUILD_VERSION}-ros1
ARG SELINUX_POLICY_URL=https://github.com/rancher/refpolicy/releases/download/v0.0.3/policy.29
ARG KERNEL_VERSION_amd64=4.9.30-rancher
ARG KERNEL_VERSION_amd64=4.9.33-rancher
ARG KERNEL_URL_amd64=https://github.com/rancher/os-kernel/releases/download/v${KERNEL_VERSION_amd64}/linux-${KERNEL_VERSION_amd64}-x86.tar.gz
ARG KERNEL_URL_arm64=https://github.com/imikushin/os-kernel/releases/download/Estuary-4.4.0-arm64.8/linux-4.4.0-rancher-arm64.tar.gz
@@ -74,9 +81,9 @@ ARG OS_SERVICES_REPO=https://raw.githubusercontent.com/${OS_REPO}/os-services
ARG IMAGE_NAME=${OS_REPO}/os
ARG DFS_IMAGE=${OS_REPO}/docker:v${DOCKER_VERSION}-2
ARG OS_BASE_URL_amd64=https://github.com/rancher/os-base/releases/download/v2016.08.1-2/os-base_amd64.tar.xz
ARG OS_BASE_URL_arm64=https://github.com/rancher/os-base/releases/download/v2016.08.1-2/os-base_arm64.tar.xz
ARG OS_BASE_URL_arm=https://github.com/rancher/os-base/releases/download/v2016.08.1-3/os-base_arm.tar.xz
ARG OS_BASE_URL_amd64=https://github.com/rancher/os-base/releases/download/v2017.02.3-1/os-base_amd64.tar.xz
ARG OS_BASE_URL_arm64=https://github.com/rancher/os-base/releases/download/v2017.02.3-1/os-base_arm64.tar.xz
ARG OS_BASE_URL_arm=https://github.com/rancher/os-base/releases/download/v2017.02.3-1/os-base_arm.tar.xz
######################################################
# Set up environment and export all ARGS as ENV

View File

@@ -47,17 +47,22 @@ itest:
qcows:
cp dist/artifacts/rancheros.iso scripts/images/openstack/
cd scripts/images/openstack && \
APPEND="console=tty1 printk.devkmsg=on rancher.autologin=ttyS0" \
APPEND="console=tty1 console=ttyS0,115200n8 printk.devkmsg=on rancher.autologin=ttyS0" \
NAME=openstack ../../../.dapper
cd scripts/images/openstack && \
APPEND="console=tty1 rancher.debug=true printk.devkmsg=on notsc clocksource=kvm-clock rancher.network.interfaces.eth0.ipv4ll rancher.cloud_init.datasources=[digitalocean] rancher.autologin=tty1 rancher.autologin=ttyS0" \
NAME=digitalocean ../../../.dapper
cp ./scripts/images/openstack/dist/*.img dist/artifacts/
rpi: release
rpi:
# scripts/images/raspberry-pi-hypriot/dist/rancheros-raspberry-pi.zip
cp dist/artifacts/rootfs_arm.tar.gz scripts/images/raspberry-pi-hypriot/
cd scripts/images/raspberry-pi-hypriot/ \
rpi64:
# scripts/images/raspberry-pi-hypriot64/dist/rancheros-raspberry-pi.zip
cp dist/artifacts/rootfs_arm64.tar.gz scripts/images/raspberry-pi-hypriot64/
cd scripts/images/raspberry-pi-hypriot64/ \
&& ../../../.dapper
help:

View File

@@ -14,50 +14,52 @@ it would really be bad if somebody did `docker rm -f $(docker ps -qa)` and delet
## Latest Release
**v1.0.1 - Docker 17.03.1-ce - Linux 4.9.24**
**v1.0.2 - Docker 17.03.1-ce - Linux 4.9.30**
### ISO
- https://releases.rancher.com/os/latest/rancheros.iso
- https://releases.rancher.com/os/v1.0.1/rancheros.iso
- https://releases.rancher.com/os/v1.0.2/rancheros.iso
### Additional Downloads
#### Latest Links
* https://releases.rancher.com/os/latest/initrd
* https://releases.rancher.com/os/latest/initrd-v1.0.1
* https://releases.rancher.com/os/latest/initrd-v1.0.2
* https://releases.rancher.com/os/latest/iso-checksums.txt
* https://releases.rancher.com/os/latest/rancheros-openstack.img
* https://releases.rancher.com/os/latest/rancheros.ipxe
* https://releases.rancher.com/os/latest/rancheros.iso
* https://releases.rancher.com/os/latest/rancheros-v1.0.1.tar.gz
* https://releases.rancher.com/os/latest/rancheros-v1.0.2.tar.gz
* https://releases.rancher.com/os/latest/rootfs.tar.gz
* https://releases.rancher.com/os/latest/vmlinuz
* https://releases.rancher.com/os/latest/vmlinuz-4.9.24-rancher
* https://releases.rancher.com/os/latest/vmlinuz-4.9.30-rancher
#### v1.0.1 Links
#### v1.0.2 Links
* https://releases.rancher.com/os/v1.0.1/initrd
* https://releases.rancher.com/os/v1.0.1/initrd-v1.0.1
* https://releases.rancher.com/os/v1.0.1/iso-checksums.txt
* https://releases.rancher.com/os/v1.0.1/rancheros-openstack.img
* https://releases.rancher.com/os/v1.0.1/rancheros.ipxe
* https://releases.rancher.com/os/v1.0.1/rancheros.iso
* https://releases.rancher.com/os/v1.0.1/rancheros-v1.0.1.tar.gz
* https://releases.rancher.com/os/v1.0.1/rootfs.tar.gz
* https://releases.rancher.com/os/v1.0.1/vmlinuz
* https://releases.rancher.com/os/v1.0.1/vmlinuz-4.9.24-rancher
* https://releases.rancher.com/os/v1.0.2/initrd
* https://releases.rancher.com/os/v1.0.2/initrd-v1.0.2
* https://releases.rancher.com/os/v1.0.2/iso-checksums.txt
* https://releases.rancher.com/os/v1.0.2/rancheros-openstack.img
* https://releases.rancher.com/os/v1.0.2/rancheros.ipxe
* https://releases.rancher.com/os/v1.0.2/rancheros.iso
* https://releases.rancher.com/os/v1.0.2/rancheros-v1.0.2.tar.gz
* https://releases.rancher.com/os/v1.0.2/rootfs.tar.gz
* https://releases.rancher.com/os/v1.0.2/vmlinuz
* https://releases.rancher.com/os/v1.0.2/vmlinuz-4.9.40-rancher
#### v1.0.0 Links - updates coming soon
#### ARM Links
* https://releases.rancher.com/os/latest/rootfs_arm.tar.gz
* https://releases.rancher.com/os/latest/rootfs_arm64.tar.gz
* https://releases.rancher.com/os/latest/rancheros-raspberry-pi.zip
* https://releases.rancher.com/os/latest/rancheros-raspberry-pi64.zip
* https://releases.rancher.com/os/v1.0.0/rootfs_arm.tar.gz
* https://releases.rancher.com/os/v1.0.0/rootfs_arm64.tar.gz
* https://releases.rancher.com/os/v1.0.0/rancheros-raspberry-pi.zip
* https://releases.rancher.com/os/v1.0.2/rootfs_arm.tar.gz
* https://releases.rancher.com/os/v1.0.2/rootfs_arm64.tar.gz
* https://releases.rancher.com/os/v1.0.2/rancheros-raspberry-pi.zip
* https://releases.rancher.com/os/v1.0.2/rancheros-raspberry-pi64.zip
**Note**: you can use `http` instead of `https` in the above URLs, e.g. for iPXE.
@@ -69,21 +71,22 @@ SSH keys are added to the **`rancher`** user, so you must log in using the **ran
Region | Type | AMI |
-------|------|------
ap-south-1 | HVM | [ami-9b4e3cf4](https://ap-south-1.console.aws.amazon.com/ec2/home?region=ap-south-1#launchInstanceWizard:ami=ami-9b4e3cf4)
eu-west-2 | HVM | [ami-d8eafebc](https://eu-west-2.console.aws.amazon.com/ec2/home?region=eu-west-2#launchInstanceWizard:ami=ami-d8eafebc)
eu-west-1 | HVM | [ami-75cbcb13](https://eu-west-1.console.aws.amazon.com/ec2/home?region=eu-west-1#launchInstanceWizard:ami=ami-75cbcb13)
ap-northeast-2 | HVM | [ami-797cae17](https://ap-northeast-2.console.aws.amazon.com/ec2/home?region=ap-northeast-2#launchInstanceWizard:ami=ami-797cae17)
ap-northeast-1 | HVM | [ami-e499b383](https://ap-northeast-1.console.aws.amazon.com/ec2/home?region=ap-northeast-1#launchInstanceWizard:ami=ami-e499b383)
sa-east-1 | HVM | [ami-f4cca198](https://sa-east-1.console.aws.amazon.com/ec2/home?region=sa-east-1#launchInstanceWizard:ami=ami-f4cca198)
ca-central-1 | HVM | [ami-59b60a3d](https://ca-central-1.console.aws.amazon.com/ec2/home?region=ca-central-1#launchInstanceWizard:ami=ami-59b60a3d)
ap-southeast-1 | HVM | [ami-be853edd](https://ap-southeast-1.console.aws.amazon.com/ec2/home?region=ap-southeast-1#launchInstanceWizard:ami=ami-be853edd)
ap-southeast-2 | HVM | [ami-e2dcd481](https://ap-southeast-2.console.aws.amazon.com/ec2/home?region=ap-southeast-2#launchInstanceWizard:ami=ami-e2dcd481)
eu-central-1 | HVM | [ami-ef0bd780](https://eu-central-1.console.aws.amazon.com/ec2/home?region=eu-central-1#launchInstanceWizard:ami=ami-ef0bd780)
us-east-1 | HVM | [ami-5c5a3f4a](https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#launchInstanceWizard:ami=ami-5c5a3f4a)
us-east-2 | HVM | [ami-902304f5](https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#launchInstanceWizard:ami=ami-902304f5)
us-west-1 | HVM | [ami-4a73542a](https://us-west-1.console.aws.amazon.com/ec2/home?region=us-west-1#launchInstanceWizard:ami=ami-4a73542a)
us-west-2 | HVM | [ami-7caa341c](https://us-west-2.console.aws.amazon.com/ec2/home?region=us-west-2#launchInstanceWizard:ami=ami-7caa341c)
ap-south-1 | HVM | [ami-f68cf099](https://ap-south-1.console.aws.amazon.com/ec2/home?region=ap-south-1#launchInstanceWizard:ami=ami-f68cf099)
eu-west-2 | HVM | [ami-86e7f0e2](https://eu-west-2.console.aws.amazon.com/ec2/home?region=eu-west-2#launchInstanceWizard:ami=ami-86e7f0e2)
eu-west-1 | HVM | [ami-13f8e875](https://eu-west-1.console.aws.amazon.com/ec2/home?region=eu-west-1#launchInstanceWizard:ami=ami-13f8e875)
ap-northeast-2 | HVM | [ami-22e33f4c](https://ap-northeast-2.console.aws.amazon.com/ec2/home?region=ap-northeast-2#launchInstanceWizard:ami=ami-22e33f4c)
ap-northeast-1 | HVM | [ami-29e4e44e](https://ap-northeast-1.console.aws.amazon.com/ec2/home?region=ap-northeast-1#launchInstanceWizard:ami=ami-29e4e44e)
sa-east-1 | HVM | [ami-a196ffcd](https://sa-east-1.console.aws.amazon.com/ec2/home?region=sa-east-1#launchInstanceWizard:ami=ami-a196ffcd)
ca-central-1 | HVM | [ami-dc2a96b8](https://ca-central-1.console.aws.amazon.com/ec2/home?region=ca-central-1#launchInstanceWizard:ami=ami-dc2a96b8)
ap-southeast-1 | HVM | [ami-d5f575b6](https://ap-southeast-1.console.aws.amazon.com/ec2/home?region=ap-southeast-1#launchInstanceWizard:ami=ami-d5f575b6)
ap-southeast-2 | HVM | [ami-c2e2f5a1](https://ap-southeast-2.console.aws.amazon.com/ec2/home?region=ap-southeast-2#launchInstanceWizard:ami=ami-c2e2f5a1)
eu-central-1 | HVM | [ami-7d31eb12](https://eu-central-1.console.aws.amazon.com/ec2/home?region=eu-central-1#launchInstanceWizard:ami=ami-7d31eb12)
us-east-1 | HVM | [ami-3e732428](https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#launchInstanceWizard:ami=ami-3e732428)
us-east-2 | HVM | [ami-820f29e7](https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#launchInstanceWizard:ami=ami-820f29e7)
us-west-1 | HVM | [ami-d2edceb2](https://us-west-1.console.aws.amazon.com/ec2/home?region=us-west-1#launchInstanceWizard:ami=ami-d2edceb2)
us-west-2 | HVM | [ami-6d1a760d](https://us-west-2.console.aws.amazon.com/ec2/home?region=us-west-2#launchInstanceWizard:ami=ami-6d1a760d)
Additionally, images are available with support for Amazon EC2 Container Service (ECS) [here](https://docs.rancher.com/os/amazon-ecs/#amazon-ecs-enabled-amis).
### Google Compute Engine

View File

@@ -125,11 +125,15 @@ func WriteFiles(cfg *rancherConfig.CloudConfig, container string) {
}
func applyPreConsole(cfg *rancherConfig.CloudConfig) {
if _, err := os.Stat(resizeStamp); os.IsNotExist(err) && cfg.Rancher.ResizeDevice != "" {
if err := resizeDevice(cfg); err == nil {
os.Create(resizeStamp)
if cfg.Rancher.ResizeDevice != "" {
if _, err := os.Stat(resizeStamp); os.IsNotExist(err) {
if err := resizeDevice(cfg); err == nil {
os.Create(resizeStamp)
} else {
log.Errorf("Failed to resize %s: %s", cfg.Rancher.ResizeDevice, err)
}
} else {
log.Errorf("Failed to resize %s: %s", cfg.Rancher.ResizeDevice, err)
log.Infof("Skipped resizing %s because %s exists", cfg.Rancher.ResizeDevice, resizeStamp)
}
}

View File

@@ -72,7 +72,7 @@ func saveCloudConfig() error {
network.ApplyNetworkConfig(cfg)
log.Debugf("datasources that will be consided: %#v", cfg.Rancher.CloudInit.Datasources)
dss := getDatasources(cfg)
dss := getDatasources(cfg.Rancher.CloudInit.Datasources)
if len(dss) == 0 {
log.Errorf("currentDatasource - none found")
return nil
@@ -216,10 +216,10 @@ func fetchAndSave(ds datasource.Datasource) error {
// getDatasources creates a slice of possible Datasources for cloudinit based
// on the different source command-line flags.
func getDatasources(cfg *rancherConfig.CloudConfig) []datasource.Datasource {
func getDatasources(datasources []string) []datasource.Datasource {
dss := make([]datasource.Datasource, 0, 5)
for _, ds := range cfg.Rancher.CloudInit.Datasources {
for _, ds := range datasources {
parts := strings.SplitN(ds, ":", 2)
root := ""
@@ -228,6 +228,8 @@ func getDatasources(cfg *rancherConfig.CloudConfig) []datasource.Datasource {
}
switch parts[0] {
case "*":
dss = append(dss, getDatasources([]string{"configdrive", "ec2", "digitalocean", "packet", "gce"})...)
case "ec2":
dss = append(dss, ec2.NewDatasource(root))
case "file":
@@ -243,9 +245,10 @@ func getDatasources(cfg *rancherConfig.CloudConfig) []datasource.Datasource {
dss = append(dss, proccmdline.NewDatasource())
}
case "configdrive":
if root != "" {
dss = append(dss, configdrive.NewDatasource(root))
if root == "" {
root = "/media/config-2"
}
dss = append(dss, configdrive.NewDatasource(root))
case "digitalocean":
// TODO: should we enableDoLinkLocal() - to avoid the need for the other kernel/oem options?
dss = append(dss, digitalocean.NewDatasource(root))

View File

@@ -45,10 +45,9 @@ func bootstrapAction(c *cli.Context) error {
waitForRoot(cfg)
}
autoformatDevices := cfg.Rancher.State.Autoformat
log.Debugf("bootstrapAction: Autoformat(%v)", cfg.Rancher.State.Autoformat)
if len(autoformatDevices) > 0 {
if err := autoformat(autoformatDevices); err != nil {
if len(cfg.Rancher.State.Autoformat) > 0 {
log.Infof("bootstrap container: Autoformat(%v) as %s", cfg.Rancher.State.Autoformat, "ext4")
if err := autoformat(cfg.Rancher.State.Autoformat); err != nil {
log.Errorf("Failed to run autoformat: %v", err)
}
}

View File

@@ -164,7 +164,7 @@ func generateRespawnConf(cmdline string) string {
if strings.Contains(cmdline, fmt.Sprintf("rancher.autologin=%s", tty)) {
respawnConf.WriteString(" --autologin rancher")
}
respawnConf.WriteString(fmt.Sprintf(" 115200 %s\n", tty))
respawnConf.WriteString(fmt.Sprintf(" --noclear %s linux\n", tty))
}
for _, tty := range []string{"ttyS0", "ttyS1", "ttyS2", "ttyS3", "ttyAMA0"} {
@@ -176,7 +176,7 @@ func generateRespawnConf(cmdline string) string {
if strings.Contains(cmdline, fmt.Sprintf("rancher.autologin=%s", tty)) {
respawnConf.WriteString(" --autologin rancher")
}
respawnConf.WriteString(fmt.Sprintf(" 115200 %s\n", tty))
respawnConf.WriteString(fmt.Sprintf(" %s\n", tty))
}
respawnConf.WriteString("/usr/sbin/sshd -D")

View File

@@ -78,19 +78,6 @@ func writeFiles(cfg *config.CloudConfig) error {
}
func setupCommandSymlinks() {
for _, powerOperation := range []string{
"/sbin/poweroff",
"/sbin/shutdown",
"/sbin/reboot",
"/sbin/halt",
"/usr/sbin/poweroff",
"/usr/sbin/shutdown",
"/usr/sbin/reboot",
"/usr/sbin/halt",
} {
os.Remove(powerOperation)
}
for _, link := range []symlink{
{config.RosBin, "/usr/bin/cloud-init-execute"},
{config.RosBin, "/usr/bin/cloud-init-save"},
@@ -99,11 +86,16 @@ func setupCommandSymlinks() {
{config.RosBin, "/usr/bin/system-docker"},
{config.RosBin, "/usr/sbin/netconf"},
{config.RosBin, "/usr/sbin/wait-for-docker"},
{config.RosBin, "/usr/sbin/poweroff"},
{config.RosBin, "/usr/sbin/reboot"},
{config.RosBin, "/usr/sbin/halt"},
{config.RosBin, "/usr/sbin/shutdown"},
{config.RosBin, "/sbin/poweroff"},
{config.RosBin, "/sbin/reboot"},
{config.RosBin, "/sbin/halt"},
{config.RosBin, "/sbin/shutdown"},
} {
os.Remove(link.newname)
if err := os.Symlink(link.oldname, link.newname); err != nil {
log.Error(err)
}

View File

@@ -51,7 +51,6 @@
<li><a href="{{site.baseurl}}/os/configuration/adding-kernel-parameters/">Adding kernel parameters</a></li>
<li><a href="{{site.baseurl}}/os/configuration/loading-kernel-modules/">Loading kernel modules</a></li>
<li><a href="{{site.baseurl}}/os/configuration/kernel-modules-kernel-headers/">Install kernel modules that require kernel headers</a></li>
<li><a href="{{site.baseurl}}/os/configuration/dkms/">DKMS</a></li>
</ul>
</li>
<li>

View File

@@ -66,18 +66,18 @@ Latest Release: [v1.0.0](https://github.com/rancher/os/releases/tag/v1.0.0)
Region | Type | AMI
---|--- | ---
ap-south-1 | HVM - ECS enabled | [ami-52493b3d](https://ap-south-1.console.aws.amazon.com/ec2/home?region=ap-south-1#launchInstanceWizard:ami=ami-52493b3d)
eu-west-2 | HVM - ECS enabled | [ami-2c958148](https://eu-west-2.console.aws.amazon.com/ec2/home?region=eu-west-2#launchInstanceWizard:ami=ami-2c958148)
eu-west-1 | HVM - ECS enabled | [ami-74cbcb12](https://eu-west-1.console.aws.amazon.com/ec2/home?region=eu-west-1#launchInstanceWizard:ami=ami-74cbcb12)
ap-northeast-2 | HVM - ECS enabled | [ami-ba74a6d4](https://ap-northeast-2.console.aws.amazon.com/ec2/home?region=ap-northeast-2#launchInstanceWizard:ami=ami-ba74a6d4)
ap-northeast-1 | HVM - ECS enabled | [ami-199ab07e](https://ap-northeast-1.console.aws.amazon.com/ec2/home?region=ap-northeast-1#launchInstanceWizard:ami=ami-199ab07e)
sa-east-1 | HVM - ECS enabled | [ami-86cca1ea](https://sa-east-1.console.aws.amazon.com/ec2/home?region=sa-east-1#launchInstanceWizard:ami=ami-86cca1ea)
ca-central-1 | HVM - ECS enabled | [ami-3eb20e5a](https://ca-central-1.console.aws.amazon.com/ec2/home?region=ca-central-1#launchInstanceWizard:ami=ami-3eb20e5a)
ap-southeast-1 | HVM - ECS enabled | [ami-a0863dc3](https://ap-southeast-1.console.aws.amazon.com/ec2/home?region=ap-southeast-1#launchInstanceWizard:ami=ami-a0863dc3)
ap-southeast-2 | HVM - ECS enabled | [ami-15dad276](https://ap-southeast-2.console.aws.amazon.com/ec2/home?region=ap-southeast-2#launchInstanceWizard:ami=ami-15dad276)
eu-central-1 | HVM - ECS enabled | [ami-fb0ad694](https://eu-central-1.console.aws.amazon.com/ec2/home?region=eu-central-1#launchInstanceWizard:ami=ami-fb0ad694)
us-east-1 | HVM - ECS enabled | [ami-e1a7c2f7](https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#launchInstanceWizard:ami=ami-e1a7c2f7)
us-east-2 | HVM - ECS enabled | [ami-9f2304fa](https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#launchInstanceWizard:ami=ami-9f2304fa)
us-west-1 | HVM - ECS enabled | [ami-ff72559f](https://us-west-1.console.aws.amazon.com/ec2/home?region=us-west-1#launchInstanceWizard:ami=ami-ff72559f)
us-west-2 | HVM - ECS enabled | [ami-24a83644](https://us-west-2.console.aws.amazon.com/ec2/home?region=us-west-2#launchInstanceWizard:ami=ami-24a83644)
ap-south-1 | HVM - ECS enabled | [ami-0090ec6f](https://ap-south-1.console.aws.amazon.com/ec2/home?region=ap-south-1#launchInstanceWizard:ami=ami-0090ec6f)
eu-west-2 | HVM - ECS enabled | [ami-61fbec05](https://eu-west-2.console.aws.amazon.com/ec2/home?region=eu-west-2#launchInstanceWizard:ami=ami-61fbec05)
eu-west-1 | HVM - ECS enabled | [ami-50f2e236](https://eu-west-1.console.aws.amazon.com/ec2/home?region=eu-west-1#launchInstanceWizard:ami=ami-50f2e236)
ap-northeast-2 | HVM - ECS enabled | [ami-fbe33f95](https://ap-northeast-2.console.aws.amazon.com/ec2/home?region=ap-northeast-2#launchInstanceWizard:ami=ami-fbe33f95)
ap-northeast-1 | HVM - ECS enabled | [ami-fce2e29b](https://ap-northeast-1.console.aws.amazon.com/ec2/home?region=ap-northeast-1#launchInstanceWizard:ami=ami-fce2e29b)
sa-east-1 | HVM - ECS enabled | [ami-bf97fed3](https://sa-east-1.console.aws.amazon.com/ec2/home?region=sa-east-1#launchInstanceWizard:ami=ami-bf97fed3)
ca-central-1 | HVM - ECS enabled | [ami-65209c01](https://ca-central-1.console.aws.amazon.com/ec2/home?region=ca-central-1#launchInstanceWizard:ami=ami-65209c01)
ap-southeast-1 | HVM - ECS enabled | [ami-75f87816](https://ap-southeast-1.console.aws.amazon.com/ec2/home?region=ap-southeast-1#launchInstanceWizard:ami=ami-75f87816)
ap-southeast-2 | HVM - ECS enabled | [ami-2deff84e](https://ap-southeast-2.console.aws.amazon.com/ec2/home?region=ap-southeast-2#launchInstanceWizard:ami=ami-2deff84e)
eu-central-1 | HVM - ECS enabled | [ami-0a30ea65](https://eu-central-1.console.aws.amazon.com/ec2/home?region=eu-central-1#launchInstanceWizard:ami=ami-0a30ea65)
us-east-1 | HVM - ECS enabled | [ami-60742376](https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#launchInstanceWizard:ami=ami-60742376)
us-east-2 | HVM - ECS enabled | [ami-1b0e287e](https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#launchInstanceWizard:ami=ami-1b0e287e)
us-west-1 | HVM - ECS enabled | [ami-45efcc25](https://us-west-1.console.aws.amazon.com/ec2/home?region=us-west-1#launchInstanceWizard:ami=ami-45efcc25)
us-west-2 | HVM - ECS enabled | [ami-811b77e1](https://us-west-2.console.aws.amazon.com/ec2/home?region=us-west-2#launchInstanceWizard:ami=ami-811b77e1)

View File

@@ -28,7 +28,7 @@ You can also customize Docker after it's been started using `ros config`.
$ sudo ros config set rancher.docker.storage_driver overlay
```
#### Valid Keys for Docker
#### User Docker settings
Many of the standard Docker daemon arguments can be placed under the `rancher.docker` key. The command needed to start the Docker daemon will be generated based on these arguments. The following arguments are currently supported.
@@ -77,7 +77,7 @@ rancher:
storage_driver: overlay
```
#### Valid Keys for System Docker
#### System Docker settings
All daemon arguments shown in the first table are also available to System Docker. The following are also supported.
@@ -85,3 +85,40 @@ Key | Value | Default | Description
---|---|---| ---
`extra_args` | List of Strings | `[]` | Arbitrary daemon arguments, appended to the generated command
`environment` | List of Strings (optional) | `[]` |
### Using a pull through registry mirror
There are 3 Docker engines that can be configured to use the pull-through Docker Hub registry mirror cache:
```
#cloud-config
rancher:
bootstrap_docker:
registry_mirror: "http://10.10.10.23:5555"
docker:
registry_mirror: "http://10.10.10.23:5555"
system_docker:
registry_mirror: "http://10.10.10.23:5555"
```
`bootstrap_docker` is used to prepare and initial network and pull any cloud-config options that can be used to configure the final network configuration and System-docker - its very unlikely to pull any images.
A successful pull through mirror cache request by System-docker looks like:
```
[root@rancher-dev rancher]# system-docker pull alpine
Using default tag: latest
DEBU[0201] Calling GET /v1.23/info
> WARN[0201] Could not get operating system name: Error opening /usr/lib/os-release: open /usr/lib/os-release: no such file or directory
WARN[0201] Could not get operating system name: Error opening /usr/lib/os-release: open /usr/lib/os-release: no such file or directory
DEBU[0201] Calling POST /v1.23/images/create?fromImage=alpine%3Alatest
DEBU[0201] hostDir: /etc/docker/certs.d/10.10.10.23:5555
DEBU[0201] Trying to pull alpine from http://10.10.10.23:5555/ v2
DEBU[0204] Pulling ref from V2 registry: alpine:latest
DEBU[0204] pulling blob "sha256:2aecc7e1714b6fad58d13aedb0639011b37b86f743ba7b6a52d82bd03014b78e" latest: Pulling from library/alpine
DEBU[0204] Downloaded 2aecc7e1714b to tempfile /var/lib/system-docker/tmp/GetImageBlob281102233 2aecc7e1714b: Extracting 1.99 MB/1.99 MB
DEBU[0204] Untar time: 0.161064213s
DEBU[0204] Applied tar sha256:3fb66f713c9fa9debcdaa58bb9858bd04c17350d9614b7a250ec0ee527319e59 to 841c99a5995007d7a66b922be9bafdd38f8090af17295b4a44436ef433a2aecc7e1714b: Pull complete
Digest: sha256:0b94d1d1b5eb130dd0253374552445b39470653fb1a1ec2d81490948876e462c
Status: Downloaded newer image for alpine:latest
```

View File

@@ -7,7 +7,7 @@ layout: os-default
## Resizing a Device Partition
---
The `resize_device` cloud config option can be used to automatically extend the first partition to fill the size of it's device.
The `resize_device` cloud config option can be used to automatically extend the first partition (assuming its `ext4`) to fill the size of it's device.
Once the partition has been resized to fill the device, a `/var/lib/rancher/resizefs.done` file will be written to prevent the resize tools from being run again. If you need it to run again, delete that file and reboot.

View File

@@ -91,7 +91,7 @@ To run this container in System Docker use the following command:
```
$ sudo system-docker run -d --net=host --name busydash husseingalal/busydash
```
In the commad, we used `--net=host` to tell System Docker not to containerize the container's networking, and use the hosts networking instead. After running the container, you can see the monitoring server by accessing `http://<IP_OF_MACHINE`.
In the commad, we used `--net=host` to tell System Docker not to containerize the container's networking, and use the hosts networking instead. After running the container, you can see the monitoring server by accessing `http://<IP_OF_MACHINE>`.
![System Docker Container]({{site.baseurl}}/img/os/Rancher_busydash.png)

View File

@@ -51,10 +51,10 @@ When this service is run, the `EXTRA_CMDLINE` will be set.
Valid cloud-init datasources for RancherOS.
| type | default |
|---|---|
| ec2 | DefaultAddress |
|---|---|--|
| ec2 | ec2's DefaultAddress |
| file | path |
| cmdline | |
| cmdline | /media/config-2 |
| configdrive | |
| digitalocean | DefaultAddress |
| ec2 | DefaultAddress |
@@ -62,6 +62,7 @@ Valid cloud-init datasources for RancherOS.
| gce | |
| packet | DefaultAddress |
| url | url |
| * | This will add ["configdrive", "ec2", "digitalocean", "packet", "gce"] into the list of datasources to try |
### Cloud-Config

View File

@@ -14,16 +14,23 @@ rancher:
state:
fstype: auto
dev: LABEL=RANCHER_STATE
autoformat:
- /dev/sda
- /dev/vda
```
### Autoformat
You can specify a list of devices to check to format on boot. If the state partition is already found, RancherOS will not try to auto format a partition. By default, auto-formatting is off.
You can specify a list of devices to check to format on boot. If the state partition is already found, RancherOS will not try to auto format a partition. By default, auto-formatting is off.
RancherOS will autoformat the partition to ext4 if the device specified in `autoformat`:
RancherOS will autoformat the partition to `ext4` (_not_ what is set in `fstype`) if the device specified in `autoformat`:
* Contains a boot2docker magic string
* Starts with 1 megabyte of zeros and `rancher.state.formatzero` is true
```yaml
#cloud-config
rancher:
state:
autoformat:
- /dev/sda
- /dev/vda
```

View File

@@ -58,7 +58,6 @@ func stopDocker(c chan interface{}) error {
func bootstrap(cfg *config.CloudConfig) error {
log.Info("Launching Bootstrap Docker")
log.Infof("bootstrap container: Autoformat(%v)", cfg.Rancher.State.Autoformat)
c, err := startDocker(cfg)
if err != nil {

View File

@@ -402,11 +402,6 @@ func applyInterfaceConfig(link netlink.Link, netConf InterfaceConfig) error {
addrMap := make(map[string]bool)
for _, address := range addresses {
addrMap[address] = true
log.Infof("Applying %s to %s", address, link.Attrs().Name)
err := applyAddress(address, link, netConf)
if err != nil {
log.Errorf("Failed to apply address %s to %s: %v", address, link.Attrs().Name, err)
}
}
for _, addr := range existingAddrs {
if _, ok := addrMap[addr.IPNet.String()]; !ok {
@@ -419,6 +414,13 @@ func applyInterfaceConfig(link netlink.Link, netConf InterfaceConfig) error {
}
}
}
for _, address := range addresses {
log.Infof("Applying %s to %s", address, link.Attrs().Name)
err := applyAddress(address, link, netConf)
if err != nil {
log.Errorf("Failed to apply address %s to %s: %v", address, link.Attrs().Name, err)
}
}
// TODO: can we set to default?
if netConf.MTU > 0 {

View File

@@ -1 +1 @@
APPEND rancher.autologin=tty1 rancher.autologin=ttyS0 console=tty0 console=ttyS0 printk.devkmsg=on ${APPEND}
APPEND rancher.autologin=tty1 rancher.autologin=ttyS0 console=tty0 rancher.autologin=ttyS1 rancher.console=ttyS1 console=ttyS0 printk.devkmsg=on ${APPEND}

View File

@@ -0,0 +1 @@
dist

View File

@@ -0,0 +1,2 @@
dist
rootfs_arm64.tar.gz

View File

@@ -0,0 +1,28 @@
FROM rancher/os-debianconsole-base
# FROM amd64=debian:jessie arm64=aarch64/debian:jessie arm=armhf/debian:jessie
ENV DAPPER_RUN_ARGS --privileged
ENV DAPPER_OUTPUT dist
RUN apt-get update -y
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates curl dosfstools tree zip
RUN mkdir -p /source/assets
# RancherOS for ARM
#RUN curl -fL https://releases.rancher.com/os/latest/rootfs_arm64.tar.gz > /source/assets/rootfs_arm64.tar.gz
COPY rootfs_arm64.tar.gz /source/assets/rootfs_arm64.tar.gz
ENV URL=https://github.com/DieterReuter/rpi64-kernel/releases/download
ENV VER=v20170303-160601
RUN curl -fL ${URL}/${VER}/4.9.13-bee42-v8.tar.gz > /source/assets/kernel.tar.gz
RUN curl -fL ${URL}/${VER}/bootfiles.tar.gz > /source/assets/bootfiles.tar.gz
RUN curl -fL https://github.com/DieterReuter/rpi-bootloader/releases/download/v20170303-133934/rpi-bootloader.tar.gz > /source/assets/rpi-bootfiles.tar.gz
#ENV RPI_URL=https://github.com/raspberrypi/firmware/raw/master/boot
#RUN curl -fL ${RPI_URL}/bootcode.bin > /source/assets/bootcode.bin
#RUN curl -fL ${RPI_URL}/fixup.dat > /source/assets/fixup.dat
#RUN curl -fL ${RPI_URL}/start.elf > /source/assets/start.elf
WORKDIR /source
CMD ["./scripts/build.sh"]

View File

@@ -0,0 +1,11 @@
RaspberryPi 3 Image (ARMv8 | AARCH64 | ARM64)
=============================================
Build by running `dapper` in this folder and the build will produce `./dist/rancheros-raspberry-pi64.zip`.
This image is compatible with the Raspberry Pi 3, since it is the only ARMv8 device in the Raspberry Pi family at the moment.
Build Requirements
==================
This build uses local loopback devices and thus requires to run as a privileged container. So please keep the setting `ENV DAPPER_RUN_ARGS --privileged` from `Dockerfile.dapper` for now. The build is running quite fast and has been tested on OS X with boot2docker.

View File

@@ -0,0 +1,83 @@
#!/bin/bash
set -e -x
cd $(dirname $0)/..
# create build directory for assembling our image filesystem
mkdir -p build/{boot,root,basefs} dist
cp assets/*.tar.gz build/
#---build SD card image---
# size of root and boot partion (in MByte)
IMAGE_TOTAL_SIZE=500
BOOT_PARTITION_START=2048
BOOT_PARTITION_SIZE=25
#---don't change here---
BOOT_PARTITION_OFFSET="$((BOOT_PARTITION_START*512))"
BOOT_PARTITION_BYTES="$((BOOT_PARTITION_SIZE*1024*1024))"
BOOT_PARTITION_SECTORS="$((BOOT_PARTITION_SIZE*1024*2))"
ROOT_PARTITION_START="$((BOOT_PARTITION_START+BOOT_PARTITION_SECTORS))"
ROOT_PARTITION_OFFSET="$((ROOT_PARTITION_START*512))"
#---don't change here---
# create image file with two partitions (FAT32, EXT4)
dd if=/dev/zero of=build/run.img bs=1MiB count=$IMAGE_TOTAL_SIZE
echo -e "o\nn\np\n1\n${BOOT_PARTITION_START}\n+${BOOT_PARTITION_SECTORS}\nt\nc\nn\np\n2\n${ROOT_PARTITION_START}\n\nw\n" | fdisk build/run.img
fdisk -l build/run.img
ls -al build/run.img
# partition #1 - Type= c W95 FAT32 (LBA)
losetup
losetup -f
losetup -d /dev/loop0 || /bin/true
losetup --offset $BOOT_PARTITION_OFFSET --sizelimit $BOOT_PARTITION_BYTES /dev/loop0 build/run.img
mkfs.vfat -n RancherOS /dev/loop0
losetup -d /dev/loop0
# partition #2 - Type=83 Linux
losetup -d /dev/loop1 || /bin/true
losetup --offset $ROOT_PARTITION_OFFSET /dev/loop1 build/run.img
mkfs.ext4 -O ^has_journal -b 4096 -L rootfs /dev/loop1
losetup -d /dev/loop1
# mount partitions as loopback devices
mount -t ext4 -o loop=/dev/loop1,offset=$ROOT_PARTITION_OFFSET build/run.img build/root
mkdir -p build/root/boot
mount -t vfat -o loop=/dev/loop0,offset=$BOOT_PARTITION_OFFSET build/run.img build/root/boot
echo "RancherOS: boot partition" > build/root/boot/boot.txt
echo "RancherOS: root partition" > build/root/root.txt
# unpack and cleanup the basefs
#- doing this on a local folder keeps our resulting image clean (no dirty blocks from a delete)
mkdir -p build/basefs
tar -C build/basefs -zxvf build/kernel.tar.gz
tar -C build/basefs -zxvf build/rpi-bootfiles.tar.gz
tar -C build/basefs -zxvf build/bootfiles.tar.gz
# remove RPi1 kernel, we only support RPi2 and RPi3 in ARMv7 mode
rm -fr build/basefs/boot/kernel.img
rm -fr build/basefs/lib/modules/{4.4.27+,4.4.27-hypriotos+}
# populate kernel, bootloader and RancherOS rootfs
cp -R build/basefs/* build/root
tar -xf assets/rootfs_arm64.tar.gz -C build/root
echo "+dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 cgroup-enable=memory swapaccount=1 elevator=deadline rootwait console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty0 rancher.password=rancher rancher.autologin=ttyAMA0 rw init=/init" > build/root/boot/cmdline.txt
# enable serial console mode for rpi3
echo "enable_uart=1" > build/root/boot/config.txt
# show details
tree -a -L 3 build/root
df -h
# unmount partitions (loopback devices will be removed automatically)
umount build/root/boot
umount build/root
# package, compress and export image file
mv build/run.img build/rancheros-raspberry-pi64.img
zip dist/rancheros-raspberry-pi64.zip build/rancheros-raspberry-pi64.img
ls -alh dist
# cleanup build environment
rm -fr build

View File

@@ -1,8 +1,12 @@
FROM ubuntu:16.04
# FROM arm64=aarch64/ubuntu:16.04 arm=armhf/ubuntu:16.04
# get the apt-cacher proxy set
ARG APTPROXY=
RUN apt-get update \
RUN echo "Acquire::http { Proxy \"$APTPROXY\"; };" >> /etc/apt/apt.conf.d/01proxy \
&& cat /etc/apt/apt.conf.d/01proxy \
&& apt-get update \
&& apt-get install -yq build-essential autoconf libtool gawk alien fakeroot \
zlib1g-dev uuid-dev libattr1-dev libblkid-dev libselinux-dev libudev-dev libdevmapper-dev \
module-init-tools \
@@ -30,7 +34,7 @@ RUN mkdir -p /source/dist \
########## Dapper Configuration #####################
ENV DAPPER_ENV VERSION DEV_BUILD RUNTEST
ENV DAPPER_ENV VERSION DEV_BUILD RUNTEST APTPROXY
#ENV DAPPER_DOCKER_SOCKET true
ENV DAPPER_SOURCE /source
ENV DAPPER_OUTPUT ./dist

View File

@@ -22,6 +22,10 @@ while [ "$#" -gt 0 ]; do
QIND=0
REBUILD=0
;;
--resizehd)
shift 1
RESIZEHD=$1
;;
--pxe)
BOOT_PXE=1
;;
@@ -116,6 +120,9 @@ while [ "$#" -gt 0 ]; do
# use the bios console, not serial (lets you see syslinux)
CONSOLEDISPLAY=1
;;
--netconsole)
NETCONSOLE=1
;;
--installed)
./scripts/create-installed
INSTALLED=1
@@ -158,6 +165,7 @@ if [ "$APPEND_INIT" != "" ]; then
fi
if [ "$BOOT_PXE" == "1" ]; then
KERNEL_ARGS="console=tty1 rancher.console=tty1 rancher.autologin=tty1 ${KERNEL_ARGS}"
set -ex
PIXIECORE=$(which pixiecore)
sudo -E $PIXIECORE boot \
@@ -198,6 +206,10 @@ if [ "$QEMU" == "1" ] || [ "$BOOT_ISO" == "1" ] || [ "$BOOT_HD" == "1" ]; then
fi
fi
fi
else
if [ "$RESIZEHD" != "" ]; then
qemu-img resize ${HD} ${RESIZEHD}
fi
fi
if [ "$SECOND_DRIVE" == "1" ]; then
@@ -238,8 +250,10 @@ if [ "$QIND" != "1" ]; then
CLOUD_CONFIG_DISK="-cdrom ${BASE}/state/configdrive.iso"
;;
fat)
echo "TODO: implement a vfat formated qemu img & copy the config files into it"
exit 1
truncate --size 2M ${BASE}/state/configdrive.img
mkfs.vfat -n config-2 ${BASE}/state/configdrive.img
mcopy -osi ${BASE}/state/configdrive.img ${CCROOT}/* ::
CLOUD_CONFIG_DISK="-hdb ${BASE}/state/configdrive.img"
;;
*)
CLOUD_CONFIG_DISK="-fsdev local,security_model=passthrough,readonly,id=fsdev0,path=${CCROOT} \
@@ -251,15 +265,19 @@ if [ "$QIND" != "1" ]; then
HOME=${HOME:-/}
fi
# default serial console
DISPLAY_OPTS="-nographic -serial mon:stdio -display none"
if [ "$CONSOLEDISPLAY" == "1" ]; then
DISPLAY_OPTS="-curses"
else
# default
DISPLAY_OPTS="-nographic -serial mon:stdio -display none"
fi
if [ "$NETCONSOLE" == "1" ]; then
# put ttyS1 on port 4444
DISPLAY_OPTS="${DISPLAY_OPTS} -serial tcp::4444,server"
KERNEL_ARGS="rancher.console=ttyS1 rancher.autologin=ttyS1 ${KERNEL_ARGS}"
fi
if [ "$QEMU" == "1" ]; then
if [ "$INSTALLED" == "1" ]; then
# kernel args only works when using -kernel
KERNEL_ARGS=""
@@ -307,7 +325,8 @@ elif [ "$BOOT_ISO" == "1" ] ||
$(eval "${hd["$ARCH"]} ${HD}") \
${SECOND_DRIVE_ENABLE} \
-smp 1 \
${ISO_OPTS}
${ISO_OPTS} \
"${@}"
elif [ "$QIND" == "1" ]; then
NAME=${NAME:-ros-qind}

View File

@@ -48,4 +48,8 @@ REBUILD=1
QEMUARCH=${qemuarch["${ARCH}"]}
TTYCONS=${ttycons["${ARCH}"]}
DEFAULT_KERNEL_ARGS="printk.devkmsg=on rancher.debug=true rancher.password=rancher console=${TTYCONS} rancher.autologin=${TTYCONS}"
if [ "$ENGINE_REGISTRY_MIRROR" != "" ]; then
REGISTRY_MIRROR="rancher.bootstrap_docker.registry_mirror=${ENGINE_REGISTRY_MIRROR} rancher.system_docker.registry_mirror=${ENGINE_REGISTRY_MIRROR} rancher.docker.registry_mirror=${ENGINE_REGISTRY_MIRROR}"
fi
DEFAULT_KERNEL_ARGS="printk.devkmsg=on rancher.debug=true rancher.password=rancher console=${TTYCONS} rancher.autologin=${TTYCONS} ${REGISTRY_MIRROR} "

View File

@@ -28,3 +28,13 @@ func (s *QemuSuite) TestIsoCloudConfig(c *C) {
s.CheckCall(c, `ls .ssh/authorized_keys`)
}
func (s *QemuSuite) TestFatCloudConfig(c *C) {
runArgs := []string{
"--fresh",
"--cloud-config-fat",
}
s.RunQemuWith(c, runArgs...)
s.CheckCall(c, `ls .ssh/authorized_keys`)
}

View File

@@ -1,7 +1,11 @@
package integration
import . "gopkg.in/check.v1"
import "fmt"
import (
. "gopkg.in/check.v1"
"fmt"
"strings"
)
func (s *QemuSuite) TestElideCmdLine(c *C) {
extra := "cc.hostname=nope rancher.password=three"
@@ -15,11 +19,10 @@ func (s *QemuSuite) TestElideCmdLine(c *C) {
s.RunQemuWith(c, runArgs...)
s.CheckOutput(c, "nope\n", Equals, "hostname")
s.CheckOutput(c,
"printk.devkmsg=on rancher.debug=true rancher.password=rancher console=ttyS0 rancher.autologin=ttyS0 cc.something=yes rancher.password=two rancher.state.dev=LABEL=RANCHER_STATE rancher.state.autoformat=[/dev/sda,/dev/vda] rancher.rm_usr -- \n",
Equals,
"cat /proc/cmdline",
)
cmdline := s.CheckOutput(c, "", Not(Equals), "cat /proc/cmdline",)
if strings.Contains(cmdline, extra) {
c.Errorf("/proc/cmdline (%s) contains info that should be elided (%s)", cmdline, extra)
}
s.CheckOutput(c,
fmt.Sprintf("/init %s\n", extra),
Equals,

View File

@@ -9,6 +9,8 @@ import (
"testing"
"time"
"github.com/gbazil/telnet"
. "gopkg.in/check.v1"
)
@@ -41,6 +43,7 @@ type QemuSuite struct {
runCommand string
sshCommand string
qemuCmd *exec.Cmd
netConsole telnet.Telnet
}
func (s *QemuSuite) TearDownTest(c *C) {
@@ -54,6 +57,9 @@ func (s *QemuSuite) RunQemuWith(c *C, additionalArgs ...string) error {
err := s.runQemu(c, additionalArgs...)
c.Assert(err, IsNil)
err = s.WaitForSSH()
c.Assert(err, IsNil)
return err
}
@@ -82,6 +88,71 @@ func (s *QemuSuite) RunQemuInstalled(c *C, additionalArgs ...string) error {
return err
}
// RunQemuWithNetConsole requires user to specify all the `scripts/run` arguments
func (s *QemuSuite) RunQemuWithNetConsole(c *C, additionalArgs ...string) error {
runArgs := []string{
"--netconsole",
}
runArgs = append(runArgs, additionalArgs...)
err := s.runQemu(c, runArgs...)
c.Assert(err, IsNil)
time.Sleep(500 * time.Millisecond)
// start telnet, and wait for prompt
for i := 0; i < 20; i++ {
s.netConsole, err = telnet.DialTimeout("127.0.0.1:4444", 5*time.Second)
if err == nil {
fmt.Printf("t%d SUCCEEDED\n", i)
break
}
fmt.Printf("t%d", i)
time.Sleep(500 * time.Millisecond)
}
c.Assert(err, IsNil)
for i := 0; i < 20; i++ {
time.Sleep(1 * time.Second)
res := s.NetCall("uname")
if strings.Contains(res, "Linux") {
fmt.Printf("W%d SUCCEEDED(%s)\n", i, res)
break
}
}
s.NetCall("ip a")
s.NetCall("cat /proc/cmdline")
return err
}
func (s *QemuSuite) NetCall(cmd string) string {
s.netConsole.Write(cmd + "\n")
r, err := s.netConsole.Read("\n")
fmt.Printf("cmd> %s", r)
result := ""
r = ""
for err == nil {
r, err = s.netConsole.Read("\n")
fmt.Printf("\t%s", r)
result = result + r
}
fmt.Printf("\n")
// Note, if the result contains something like "+ cmd\n", you may have set -xe on
return result
}
func (s *QemuSuite) NetCheckCall(c *C, additionalArgs ...string) {
out := s.NetCall(strings.Join(additionalArgs, " "))
c.Assert(out, Not(Equals), "")
}
func (s *QemuSuite) NetCheckOutput(c *C, result string, check Checker, additionalArgs ...string) string {
out := s.NetCall(strings.Join(additionalArgs, " "))
out = strings.Replace(out, "\r", "", -1)
c.Assert(out, check, result)
return out
}
func (s *QemuSuite) runQemu(c *C, args ...string) error {
c.Assert(s.qemuCmd, IsNil) // can't run 2 qemu's at once (yet)
s.qemuCmd = exec.Command(s.runCommand, args...)
@@ -94,7 +165,7 @@ func (s *QemuSuite) runQemu(c *C, args ...string) error {
}
fmt.Printf("--- %s: starting qemu %s, %v\n", c.TestName(), s.runCommand, args)
return s.WaitForSSH()
return nil
}
func (s *QemuSuite) WaitForSSH() error {
@@ -171,12 +242,14 @@ func (s *QemuSuite) CheckOutputContains(c *C, result string, additionalArgs ...s
}
func (s *QemuSuite) Stop(c *C) {
//s.MakeCall("sudo halt")
//time.Sleep(2000 * time.Millisecond)
fmt.Printf("%s: stopping qemu\n", c.TestName())
//s.MakeCall("sudo poweroff")
time.Sleep(1000 * time.Millisecond)
//c.Assert(s.WaitForSSH(), IsNil)
//fmt.Println("%s: stopping qemu", c.TestName())
fmt.Printf("%s: stopping qemu 2\n", c.TestName())
c.Assert(s.qemuCmd.Process.Kill(), IsNil)
fmt.Printf("%s: stopping qemu 3\n", c.TestName())
s.qemuCmd.Process.Wait()
//time.Sleep(time.Millisecond * 1000)
s.qemuCmd = nil

View File

@@ -2,6 +2,7 @@ package integration
import (
"fmt"
"strings"
"time"
. "gopkg.in/check.v1"
@@ -117,3 +118,156 @@ sync
s.CheckOutput(c, version, Equals, "sudo ros -v")
s.Stop(c)
}
func (s *QemuSuite) TestAutoResize(c *C) {
runArgs := []string{
"--iso",
"--fresh",
}
version := ""
disk := "/dev/vda1\n"
size := ""
{
s.RunQemuWith(c, runArgs...)
version = s.CheckOutput(c, version, Not(Equals), "sudo ros -v")
fmt.Printf("installing %s", version)
s.CheckCall(c, `
set -ex
echo "ssh_authorized_keys:" > config.yml
echo " - $(cat /home/rancher/.ssh/authorized_keys)" >> config.yml
sudo ros install --force --no-reboot --device /dev/vda -c config.yml --append "rancher.resize_device=/dev/vda"
sync
`)
time.Sleep(500 * time.Millisecond)
s.CheckCall(c, "sudo mount "+strings.TrimSpace(disk)+" /mnt")
size = s.CheckOutput(c, size, Not(Equals), "df -h | grep "+strings.TrimSpace(disk)+" | head -n1 | sed 's/ \\+/;/g' | cut -d ';' -f 2")
s.Stop(c)
}
// ./scripts/run --no-format --append "rancher.debug=true"
runArgs = []string{
"--boothd",
"--resizehd", "+20G",
}
s.RunQemuWith(c, runArgs...)
s.CheckOutput(c, version, Equals, "sudo ros -v")
s.CheckOutput(c, disk, Equals, "blkid | cut -f 1 -d ' ' | sed 's/://'")
s.CheckOutput(c, size, Not(Equals), "df -h | grep "+strings.TrimSpace(disk)+" | head -n1 | sed 's/ \\+/;/g' | cut -d ';' -f 2")
s.Stop(c)
}
func (s *QemuSuite) KillsMyServerTestInstalledDhcp(c *C) {
// ./scripts/run --no-format --append "rancher.debug=true" --iso --fresh
runArgs := []string{
"--iso",
"--fresh",
// "-net", "nic,vlan=0,model=virtio",
// "-net", "user,vlan=0",
// "-net", "nic,vlan=0,model=virtio",
// "-net", "user,vlan=0",
}
version := ""
{
s.RunQemuWith(c, runArgs...)
s.MakeCall("ip a")
version = s.CheckOutput(c, version, Not(Equals), "sudo ros -v")
fmt.Printf("installing %s", version)
s.CheckCall(c, `
echo "ssh_authorized_keys:" > config.yml
echo " - $(cat /home/rancher/.ssh/authorized_keys)" >> config.yml
echo "rancher:" >> config.yml
echo " network:" >> config.yml
echo " interfaces:" >> config.yml
echo " eth2:" >> config.yml
echo " dhcp: true" >> config.yml
echo " eth1:" >> config.yml
echo " address: 10.0.2.253/24" >> config.yml
echo " dhcp: false" >> config.yml
echo " gateway: 10.0.2.1" >> config.yml
echo " mtu: 1500" >> config.yml
ip a
echo "==================="
cat config.yml | sudo ros config merge
sudo ros service stop network
sleep 1
sudo ros service start network
sleep 1
ip a
echo "==================="
sudo ros install --force --no-reboot --device /dev/vda -c config.yml -a "console=ttyS0 rancher.console=ttyS0 rancher.autologin=ttyS0 rancher.console=ttyS1 rancher.autologin=ttyS1 rancher.debug=true"
sync
`)
time.Sleep(500 * time.Millisecond)
s.Stop(c)
}
runArgs = []string{
"--boothd",
"-net", "nic,vlan=0,model=virtio",
"-net", "user,vlan=0",
"-net", "nic,vlan=0,model=virtio",
"-net", "user,vlan=0",
}
s.RunQemuWithNetConsole(c, runArgs...)
s.NetCheckOutput(c, version, Equals, "sudo ros -v")
s.NetCheckOutput(c, "", Not(Equals), "sh", "-c", "ip a show eth1 | grep 10.0.2..253")
s.Stop(c)
}
func (s *QemuSuite) TestConfigDhcp(c *C) {
runArgs := []string{
"--iso",
"--fresh",
"-net", "nic,vlan=0,model=virtio",
"-net", "user,vlan=0",
"-net", "nic,vlan=0,model=virtio",
"-net", "user,vlan=0",
}
version := ""
{
s.RunQemuWithNetConsole(c, runArgs...)
s.NetCall("ip a")
version = s.NetCheckOutput(c, version, Not(Equals), "sudo ros -v")
fmt.Printf("installing %s", version)
s.NetCheckCall(c, `
echo "ssh_authorized_keys:" > config.yml
echo " - $(cat /home/rancher/.ssh/authorized_keys)" >> config.yml
echo "rancher:" >> config.yml
echo " network:" >> config.yml
echo " interfaces:" >> config.yml
echo " eth2:" >> config.yml
echo " dhcp: true" >> config.yml
echo " eth1:" >> config.yml
echo " address: 10.0.2.253/24" >> config.yml
echo " dhcp: false" >> config.yml
echo " gateway: 10.0.2.1" >> config.yml
echo " mtu: 1500" >> config.yml
ip a
echo "==================="
cat config.yml | sudo ros config merge
sudo ros service stop network
sleep 1
sudo ros service start network
sleep 1
echo "==================="
sudo system-docker logs network
echo "==================="
ip a
`)
s.NetCheckOutput(c, version, Equals, "sudo ros -v")
s.NetCheckOutput(c, "", Not(Equals), "sh", "-c", "\"ip a show eth1 | grep 10.0.2.253\"")
s.Stop(c)
}
}

View File

@@ -59,3 +59,4 @@ golang.org/x/sys eb2c74142fd19a79b3f237334c7384d5167b1b46 https://github.com/gol
google.golang.org/grpc ab0be5212fb225475f2087566eded7da5d727960 https://github.com/grpc/grpc-go.git
gopkg.in/fsnotify.v1 v1.2.0
github.com/fatih/structs dc3312cb1a4513a366c4c9e622ad55c32df12ed3
github.com/gbazil/telnet ba7da85c947a39063cddb0ffbff20b6bbbe9222f

21
vendor/github.com/gbazil/telnet/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2016 Vasily Suvorov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

9
vendor/github.com/gbazil/telnet/README.md generated vendored Normal file
View File

@@ -0,0 +1,9 @@
# telnet
[&copy; Vasily Suvorov 2016](http://bazil.pro)
#### DESCRIPTION
Package telnet provides very simple interface for interacting with telnet devices from golang's routines.
[![GoDoc](https://godoc.org/github.com/gbazil/telnet?status.svg)](https://godoc.org/github.com/gbazil/telnet)

81
vendor/github.com/gbazil/telnet/telnet.go generated vendored Normal file
View File

@@ -0,0 +1,81 @@
// Package telnet provides very simple interface for interacting with telnet devices from go routines.
package telnet
import (
"bufio"
"bytes"
"net"
"strings"
"time"
)
// Telnet presents struct with net.Conn interface for telnet protocol plus buffered reader and timeout setup
type Telnet struct {
conn net.Conn
reader *bufio.Reader
timeout time.Duration
}
// Dial constructs connection to a telnet device. Address string must be in format: "ip:port" (e.g. "127.0.0.1:23").
// Default timeout is set to 5 seconds.
func Dial(addr string) (t Telnet, err error) {
t.conn, err = net.Dial("tcp", addr)
if err == nil {
t.reader = bufio.NewReader(t.conn)
t.timeout = time.Second * 5 // default
}
return
}
// DialTimeout acts like Dial but takes a specific timeout (in nanoseconds).
func DialTimeout(addr string, timeout time.Duration) (t Telnet, err error) {
t.conn, err = net.DialTimeout("tcp", addr, timeout)
if err == nil {
t.reader = bufio.NewReader(t.conn)
t.timeout = timeout
}
return
}
// Read reads all data into string from telnet device until it meets the expected or stops on timeout.
func (t Telnet) Read(expect string) (str string, err error) {
var buf bytes.Buffer
t.conn.SetReadDeadline(time.Now().Add(t.timeout))
for {
b, e := t.reader.ReadByte()
if e != nil {
err = e
break
}
if b == 255 {
t.reader.Discard(2)
} else {
buf.WriteByte(b)
}
if strings.Contains(buf.String(), expect) {
str = buf.String()
break
}
}
return
}
// Write writes string (command or data) to telnet device. Do not forget add LF to end of string!
func (t Telnet) Write(s string) (i int, err error) {
t.conn.SetWriteDeadline(time.Now().Add(t.timeout))
i, err = t.conn.Write([]byte(s))
return
}
// SetTimeout changes default or start timeout for all interactions
func (t Telnet) SetTimeout(timeout time.Duration) {
t.timeout = timeout
}