Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
kind.yaml
.vagrant
!kubernetes/kind/configs/edge-agent-andres/kind.yaml
.vagrant
*.log
11 changes: 11 additions & 0 deletions coredns/Corefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.:53 {
forward . 8.8.8.8 9.9.9.9
log
errors
}

portainer.container:53 {
file /root/portainer.container.db
log
errors
}
8 changes: 8 additions & 0 deletions coredns/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

build() {
local img=${1:-ubuntu-debug}
docker build --no-cache -t "$img" -f ubuntu-debug.Dockerfile .
}

build $1
4 changes: 4 additions & 0 deletions coredns/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

# docker run -d --rm --name coredns -p 53:53/udp -v ./Corefile:/etc/coredns/Corefile coredns/coredns
docker run -d --name coredns --volume=./:/root/ -p 53:53/udp coredns/coredns -conf /root/Corefile
3 changes: 3 additions & 0 deletions coredns/portainer.container.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
portainer.container. IN SOA dns.portainer.container. mail.portainer.container. 2015082541 7200 3600 1209600 3600
dns.portainer.container. IN A 192.168.1.20
portainer.container. IN A 192.168.1.20
3 changes: 3 additions & 0 deletions coredns/ubuntu-debug.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM ubuntu

RUN apt update && apt upgrade -y && apt install -y net-tools dnsutils iputils-ping curl
1 change: 1 addition & 0 deletions coreos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.ova
53 changes: 53 additions & 0 deletions coreos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Documentation link
https://docs.fedoraproject.org/en-US/fedora-coreos/provisioning-virtualbox/

# Download VBox OVA
https://fedoraproject.org/coreos/download/?stream=stable
choose the OVA file

# Create Butane config
Generate a password hash with
```bash
docker run -it --rm quay.io/coreos/mkpasswd --method=yescrypt
```

Create file `example.bu`
```yaml
variant: fcos
version: 1.4.0
passwd:
users:
- name: core
password_hash: $y$j9T$I0QL6S6wHufJVFPyShadl/$FD7cmIqPdnmcNa2wNNekI4XgejTCbxRhyspmWOfclFA
storage:
files:
- path: /etc/vconsole.conf
mode: 0644
contents:
inline: KEYMAP=fr
```
Replace the password hash with what was previously generated (the example uses `password` hash)
Change your keymap if needed

# Generate Ignition config
```bash
docker run -i --rm quay.io/coreos/butane:release --pretty --strict < example.bu > example.ign
```
# Following commands with use
VM_NAME=coreos

# Create the VM
VBoxManage import --vsys 0 --vmname "coreos" fedora-coreos-38.20230609.3.0-virtualbox.x86_64.ova

# Insert Ignition config to VM
VBoxManage guestproperty set "coreos" /Ignition/Config "$(cat example.ign)"

# Start VM
VBoxManage startvm "coreos"

# Disable SELinux
sudo sed -i -e 's/SELINUX=/SELINUX=disabled #/g' /etc/selinux/config
sudo systemctl reboot

# Change keyboard layout
sudo localectl set-keymap fr
12 changes: 12 additions & 0 deletions coreos/example.bu
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
variant: fcos
version: 1.4.0
passwd:
users:
- name: core
password_hash: $y$j9T$I0QL6S6wHufJVFPyShadl/$FD7cmIqPdnmcNa2wNNekI4XgejTCbxRhyspmWOfclFA
storage:
files:
- path: /etc/vconsole.conf
mode: 0644
contents:
inline: KEYMAP=fr
25 changes: 25 additions & 0 deletions coreos/example.ign
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"ignition": {
"version": "3.3.0"
},
"passwd": {
"users": [
{
"name": "core",
"passwordHash": "$y$j9T$I0QL6S6wHufJVFPyShadl/$FD7cmIqPdnmcNa2wNNekI4XgejTCbxRhyspmWOfclFA"
}
]
},
"storage": {
"files": [
{
"path": "/etc/vconsole.conf",
"contents": {
"compression": "",
"source": "data:,KEYMAP%3Dfr"
},
"mode": 420
}
]
}
}
61 changes: 61 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Development

## Docker

### Requirements

- [docker-machine](https://docs.docker.com/machine/install-machine/)

You may find a preconfigured package for your distribution with apt/yum/yay/pacman/...
If not, follow the manual instruction on the last released version
https://github.com/docker/machine/releases/tag/v0.16.2

- ~~[docker-machine-ipconfig](https://github.com/fivestars/docker-machine-ipconfig)~~
- You can find a copy of the script in `./docker-machine/` folder

- Virtualbox


### Important notice / Troobleshooting

If you are dealing with the following error using `docker-machine` (or similar error using `vagrant`) and latest versions of `Virtualbox`

```
Error creating machine: Error in driver during machine creation: Error setting up host only network on machine start: /usr/bin/VBoxManage hostonlyif ipconfig vboxnet5 --ip 192.168.99.1 --netmask 255.255.255.0 failed:
VBoxManage: error: Code E_ACCESSDENIED (0x80070005) - Access denied (extended info not available)
VBoxManage: error: Context: "EnableStaticIPConfig(Bstr(pszIp).raw(), Bstr(pszNetmask).raw())" at line 242 of file VBoxManageHostonly.cpp
```
Either add the following in `/etc/vbox/networks.conf` (sudo needed)
```
* 192.168.99.1/24
```
or create your VMs with
```
docker-machine create xxx --virtualbox-hostonly-cidr "192.168.60.1/24"
```
According to https://www.virtualbox.org/manual/ch06.html#network_hostonly

> On Linux, Mac OS X and Solaris Oracle VM VirtualBox will only allow IP addresses in 192.168.56.0/21 range to be assigned to host-only adapters.

So basically IPs between `192.168.56.0` and `192.168.63.255`

### Notes

Alias `docker-machine` to `dm` and `docker-machine-ipconfig` to `dmip`. These aliases will be used in this README for simplicity.

### Basic command

1. `dm create <name>`: create a machine with name `<name>`
2. `dm ls`: list all existing machines with their state / driver / url / swarm status / docker version / errors (if any)
3. `dm rm <name>`: delete machine with name `<name>`
4. `dm`: will print help and all available commands

### Advanced commands

1. `dm create your-machine-name --virtualbox-boot2docker-url https://github.com/boot2docker/boot2docker/releases/download/v<DOCKER_VERSION>/boot2docker.iso`
Create a machine with a specific version of docker

Example for docker 18.09.3
`dm create your-machine-name --virtualbox-boot2docker-url https://github.com/boot2docker/boot2docker/releases/download/v18.09.3/boot2docker.iso`

Boot2docker ISOs supporting various docker versions can be found at https://github.com/troyxmccall/boot2docker
60 changes: 60 additions & 0 deletions docker/deploy-portainer-in-dm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash

function usage() {
cat <<EOF
Usage: portainer_ci PORTAINER_CI_IMAGE [port 9000 binding] [port 9443 binding] [port 8000 binding]

Example:
portainer_ci portainerci/portainer-ee:develop
will start 'portainerci/portainer-ee:develop running at localhost:9000 / localhost:9443'
EOF
}

VM="test-automation"

function create() {
docker-machine rm -f ${VM}
sleep 5
docker-machine create ${VM}
}

function portainer_ci() {
local PORTAINER_CI_IMAGE=$1
local P9000=${2:-9000}
local P9443=${3:-9443}
local P8000=${4:-8000}
docker-machine ssh ${VM} "docker pull ${PORTAINER_CI_IMAGE}"
docker-machine ssh ${VM} "docker run -d -p ${P9000}:9000 -p ${P9443}:9443 -p ${P8000}:8000 --name portainerci_${P9000} -v /var/run/docker.sock:/var/run/docker.sock -v portainerci_${P9000}_data:/data ${PORTAINER_CI_IMAGE} --log-level=DEBUG"
local IP=$(docker-machine ls --filter name=${VM} -f "{{.URL}}")
local IP_9000=$(echo ${IP} | awk -v port=${P9000} '{sub(/tcp/,"http")sub(/:[0-9].*/,":"port)}1')
local IP_9443=$(echo ${IP} | awk -v port=${P9443} '{sub(/tcp/,"https")sub(/:[0-9].*/,":"port)}1')
echo "Container running at ${IP_9000} | ${IP_9443}"
}

function portainer_ci_clean() {
P9000=${1:-9000}
echo "Cleaning portainerci container"
docker-machine ssh ${VM} "docker rm -f portainerci_${P9000}"
echo "cleaning portainerci volume"
docker-machine ssh ${VM} "docker volume rm portainerci_${P9000}_data"
echo "Done"
}

case $1 in
create)
create
;;
deploy)
if [[ $# == 2 ]]; then
portainer_ci $2
else
usage
fi
;;
clean)
portainer_ci_clean
;;
*)
usage
;;
esac
Loading