-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #248 from threefoldtech/sshinit-update
updating ssh-init script
- Loading branch information
Showing
12 changed files
with
48 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
FROM centos:8 | ||
FROM quay.io/centos/centos:stream9 | ||
|
||
RUN yum install -y openssh-server && yum clean all | ||
|
||
COPY entrypoint.sh / | ||
RUN chmod +x /entrypoint.sh | ||
RUN rm -f /run/nologin | ||
RUN /bin/echo -e "LANG=\"en_US.UTF-8\"">/etc/default/local | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM ubuntu:22.04 | ||
|
||
RUN apt update && \ | ||
apt -y install wget openssh-server | ||
|
||
RUN wget -O /sbin/zinit https://github.com/threefoldtech/zinit/releases/download/v0.2.5/zinit && \ | ||
chmod +x /sbin/zinit | ||
|
||
COPY zinit /etc/zinit | ||
COPY start.sh /start.sh | ||
|
||
RUN chmod +x /sbin/zinit && chmod +x /start.sh | ||
ENTRYPOINT ["zinit", "init"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,17 @@ | ||
# Creating Minimal Ubuntu Jammy FLIST : A Step-by-Step Guide | ||
|
||
## Automated Process | ||
|
||
**Script Name**: `ubuntu22-flist-builder.sh` | ||
|
||
This script automates the setup, configuration, archiving, and uploading of an Ubuntu system ready for use as an FLIST. | ||
# Development Guide for Ubuntu:22.04 image | ||
## This guide will take you through steps for pulling & running ubuntu:22.04 image | ||
|
||
### Pull the image | ||
```bash | ||
chmod +x ubuntu22-flist-builder.sh | ||
./ubuntu22-flist-builder.sh ${your_api_key_here} | ||
``` | ||
|
||
## Manual Process | ||
|
||
### Install arch-install-scripts package to use arch-chroot | ||
``` | ||
sudo apt install arch-install-scripts -y | ||
``` | ||
|
||
### Setup and Bootstrap | ||
``` | ||
mkdir ubuntu-jammy | ||
sudo debootstrap jammy ubuntu-jammy http://archive.ubuntu.com/ubuntu | ||
``` | ||
#### Enter the new environment using arch-chroot. | ||
``` | ||
arch-chroot ubuntu-jammy/ | ||
``` | ||
|
||
### Configure the system PATH and networking settings, then update the package repository and install necessary packages. | ||
``` | ||
export PATH=/usr/local/sbin/:/usr/local/bin/:/usr/sbin/:/usr/bin/:/sbin:/bin | ||
rm /etc/resolv.conf | ||
echo 'nameserver 1.1.1.1' > /etc/resolv.conf | ||
apt-get update | ||
apt-get install cloud-init openssh-server curl initramfs-tools -y | ||
docker pull threefolddev/ubuntu:22.04 | ||
``` | ||
|
||
### Cloud-init and Kernel Modules | ||
#### Prepare the system for cloud environments using cloud-init and install additional kernel modules. | ||
``` | ||
cloud-init clean | ||
apt-get install linux-modules-extra-5.15.0-25-generic -y | ||
echo 'fs-virtiofs' >> /etc/initramfs-tools/modules | ||
update-initramfs -c -k all | ||
apt-get clean | ||
``` | ||
|
||
### Clean up | ||
``` | ||
rm -rf ubuntu-jammy/dev/* | ||
``` | ||
|
||
### Kernel Extraction | ||
``` | ||
sudo ./extract-vmlinux ubuntu-jammy/boot/vmlinuz | sudo tee ubuntu-jammy/boot/vmlinuz-5.15.0-25-generic.elf > /dev/null | ||
sudo mv ubuntu-jammy/boot/vmlinuz-5.15.0-25-generic.elf ubuntu-jammy/boot/vmlinuz-5.15.0-25-generic | ||
``` | ||
|
||
### Create a compressed archive of the configured system for uploading to hub. | ||
``` | ||
tar -czf ubuntu-jammy.tar.gz -C ubuntu-jammy . | ||
### Build the image | ||
```bash | ||
docker build -t threefolddev/ubuntu:22.04 . | ||
``` | ||
|
||
### Uploading flist | ||
#### From the hub you can generate api key to use | ||
``` | ||
clsecret="$API_KEY" | ||
curl -X Post -H "Authorization: Bearer ${clsecret}" -F "file=@ubuntu-jammy.tar.gz" https://hub.grid.tf/api/flist/me/upload | ||
### RUN the image | ||
```bash | ||
sudo docker run -d --name <container_name> threefolddev/ubuntu:22.04 | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
mkdir -p /var/run/sshd | ||
mkdir -p /root/.ssh | ||
touch /root/.ssh/authorized_keys | ||
|
||
chmod 700 /root/.ssh | ||
chmod 600 /root/.ssh/authorized_keys |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
exec: bash /start.sh | ||
log: stdout | ||
oneshot: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
exec: bash -c "/usr/sbin/sshd -D" | ||
after: | ||
- ssh-init |