Skip to content

Commit

Permalink
Initial Linuxkit setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ernoaapa committed Nov 24, 2017
1 parent eb54894 commit 7f6edbb
Show file tree
Hide file tree
Showing 6 changed files with 188 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

# Downloaded images
images

# Linuxkit
*-cmdline
*-initrd.img
*-kernel
*-state/
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2017 Erno Aapa

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.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# ElliotOS
ElliotOS is minimal Linux Operating System, built with [Linuxkit](https://github.com/linuxkit/linuxkit), which contains only minimal components to run [Elliot](https://github.com/ernoaapa/elliot).

- [Linux kernel](https://github.com/linuxkit/linuxkit/tree/master/kernel)
- [containerd](https://github.com/containerd/containerd) - Container runtime
- [runc](https://github.com/opencontainers/runc) - Run containers based on OCI specification
- [elliotd](https://github.com/ernoaapa/elliot) - Primary node agent which manages containers based on specs

## Run locally
### Prerequisites
- [Moby](https://github.com/moby/moby)
- [Linuxkit](https://github.com/linuxkit/linuxkit)

### Build
```
moby build linuxkit.yml
```

### Run
```shell
sudo linuxkit run hyperkit -cpus 4 -mem "1024" -disk size=10G -networking vmnet linuxkit
```
9 changes: 9 additions & 0 deletions banner.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

______ _ _ _ _
| ____| | (_) | |
| |__ | | |_ ___ | |_
| __| | | | |/ _ \| __|
| |____| | | | (_) | |_
|______|_|_|_|\___/ \__|


52 changes: 52 additions & 0 deletions docs/build-in-packet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Build in Packet
Notes how to build ElliotOS in Packet ARM based server.

1. Start new server in Packet
- Type A2
- Ubuntu 16.04 LTS
- Amsterdam

2. SSH to the server

3. Install Go
```shell
sudo add-apt-repository -y ppa:gophers/archive
sudo apt update
sudo apt-get install -y git golang-1.9-go
ln -s /usr/lib/go-1.9/bin/go /usr/local/bin/go
```

4. Install Moby & Linuxkit
```shell
go get -u github.com/moby/tool/cmd/moby
go get -u github.com/linuxkit/linuxkit/src/cmd/linuxkit
```

5. Install Docker
```shell
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88

sudo add-apt-repository "deb https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

sudo apt-get update
sudo apt-get install -y docker-ce
```

6. Clone repository
```shell
# TODO
```

7. Build RasperryPI image
```shell
export PATH="$PATH:/root/go/bin"
moby build -format rpi3 linuxkit.yml
```

8. Download image

```shell
scp root@<ip>:./linuxkit.tar .
```
89 changes: 89 additions & 0 deletions linuxkit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
kernel:
image: linuxkit/kernel:4.9.62
cmdline: "console=tty0 console=ttyS0 console=ttyAMA0"
init:
- linuxkit/init:42a92119e1ca10380e0d33e26c0cbcf85b9b3558
- linuxkit/runc:1b0741d07949c0acc444cd6a04ee7f833443579d
- linuxkit/containerd:bfb61cc1d26c39cd4b2bc08f7a9963fefa0ef3bf
- linuxkit/ca-certificates:af4880e78edc28743f7c5e262678c67c6add4c26
onboot:
- name: sysctl
image: linuxkit/sysctl:a9ad57ed738a31ea9380cd73236866c312b35489

# https://github.com/linuxkit/linuxkit/blob/master/docs/platform-rpi3.md#networking
- name: netdev
image: linuxkit/modprobe:2d153653d1111877a8f53704ef85063a44182ade
command: ["modprobe", "smsc95xx"]

- name: dhcpcd
image: linuxkit/dhcpcd:48831507404049660b960e4055f544917d90378e
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
- name: format
image: linuxkit/format:be811ded880af37a916f23bc9ddb274026ccc514
- name: mount
image: linuxkit/mount:ef2e2106212b2d333b548821191f04da984ef48f
command: ["/usr/bin/mountie", "/var/lib"]
services:
- name: getty
image: linuxkit/getty:6af22c32c98536a79230eef000e9abd06b037faa
env:
# Makes the terminal open without password prompt
- INSECURE=true
- name: ntpd
image: linuxkit/openntpd:07a80c3e3e816658318ac027e1253ff9a228b8de
- name: dhcpcd
image: linuxkit/dhcpcd:48831507404049660b960e4055f544917d90378e
# - name: sshd
# image: linuxkit/sshd:b7f21ef1b13300a994e35eac3644e4f84f0ada8a
# capabilities:
# - all
# binds:
# - /etc/resolv.conf:/etc/resolv.conf
# - /usr/bin/runc:/usr/bin/runc
# - /usr/bin/ctr:/usr/bin/ctr # ctr for debugging
# - /containers:/containers # ctr requires access to be able to manage containers
# - /var/lib/volumes:/volumes # The directory for pod volumes
# - /run/containerd:/run/containerd # need access to sockets
# - /var/log:/var/log # To be able to run 'ctr t attach' to view logs
# - /run/containerd/containerd.sock:/run/containerd/containerd.sock
# - /tmp:/tmp

- name: discovery
image: eaapa/elliot-discovery:93771fd
command: ["/elliot-discovery", "--debug", "--expose", "5000"]
net: host
binds:
- /etc/machine-id:/etc/machine-id
- name: elliotd
image: eaapa/elliotd:93771fd
command: ["/elliotd", "--debug", "--listen", "0.0.0.0:5000"]
capabilities:
- all
net: host
pid: host
runtime:
mkdir: ["/var/lib/volumes"]
binds:
- /containers:/containers
- /var/lib/volumes:/var/lib/volumes
- /var/lib/containerd:/var/lib/containerd
- /run/containerd:/run/containerd
- /etc/resolv.conf:/etc/resolv.conf
- /etc/machine-id:/etc/machine-id
- /var/log:/var/log # To be able to serve default containers logs through api
- /tmp:/tmp # To be able to read temporary fifo log files
files:
- path: root/.ssh/authorized_keys
source: /root/.ssh/authorized_keys
mode: "0600"
optional: true
- path: /etc/hostname
contents: raspi-abcde2e2f1e1
- path: /etc/issue
source: ./banner.txt
- path: /etc/machine-id
contents: "104CECBC-6037-5FCF-AF75-80EB7040CD22"
mode: "0600"
trust:
org:
- linuxkit

0 comments on commit 7f6edbb

Please sign in to comment.