This is an automated email from the ASF dual-hosted git repository.
bsalzano pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/openserverless.git
The following commit(s) were added to refs/heads/main by this push:
new 99d81f2 sync to latest branches (#130)
99d81f2 is described below
commit 99d81f2d671a23cc30913a040a62e6e78200ef13
Author: Michele Sciabarra <[email protected]>
AuthorDate: Tue Jun 17 09:43:32 2025 +0200
sync to latest branches (#130)
* update branches
* renaming to bash_aliases
* update
* bug fixed
---
.gitignore | 3 +-
README.md | 101 ++++++++++++++++++++----------
aliases => bash_aliases | 3 +-
cloud-init.yaml | 118 ++++++++++++++++++++++-------------
devel/images/standalone/Dockerfile | 3 -
devel/images/standalone/Taskfile.yml | 28 ---------
devel/olaris | 2 +-
devel/olaris-operator | 2 +-
operator | 2 +-
runtimes | 2 +-
site | 2 +-
task | 2 +-
testing | 2 +-
13 files changed, 155 insertions(+), 115 deletions(-)
diff --git a/.gitignore b/.gitignore
index d94034b..528156f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
.attic/
.vscode/
.idea/
-**/.DS_Store
\ No newline at end of file
+**/.DS_Store
+network-cache/
diff --git a/README.md b/README.md
index 148c7de..cb182f4 100644
--- a/README.md
+++ b/README.md
@@ -2,35 +2,27 @@
Welcome to [Apache OpenServerless](https://openserverless.apache.org), an
incubating project at the [Apache Software Foundation](https://www.apache.org)
-- If you want to **install** Apache OpenServerless go
[here](https://openserverless.apache.org/docs/installation/).
+- If you want to **install** Apache OpenServerless in cloud go
[here](https://openserverless.apache.org/docs/installation/).
- If you want to **understand** what this project is check the [original
proposal](https://cwiki.apache.org/confluence/display/INCUBATOR/OpenServerlessProposal).
- If you want to **contribute** to the project, read on this README to setup a
**development** environment.
- If you want to **chat** with us, join [our Discord
server](https://bit.ly/openserverless-discord).
+- If you want to **locally install** open serverless for test or development,
read on.
-## Development Environment Overview
+## Test Environment Overview
Apache OpenServerless is a complex project with lots of dependencies. It also
needs a Kubernetes cluster to be executed, tested and developed on.
-You may setup the environment by yourself, but it can take a lot of time so we
prepared a procedure to setup quickly a ready-to-use development environment
which runs the same on Windows, Linux and Mac.
-
-Our development environment uses a virtual machine based on Ubuntu 24.04. The
virtual environemnt is initialized with a [cloud-init](https://cloud-init.io/)
script we provide.
-
-The script installs [k3s](https://k3s.io/) as Kubernetes engine and
[nix](https://nixos.org/download/#download-nix) to setup development
environments. The project includes multiple subprojects, each one with a
different set of dependencies so we use [direnv](https://direnv.net/) to
automatically activate the right tools when you open a terminal.
-
-To create a virtual machine in your workstation we use
[multipass](https://multipass.run/). As an IDE we use
[VSCode](https://code.visualstudio.com/) as it allows [Remote
Development](https://code.visualstudio.com/docs/remote/remote-overview) within
the virtual machine, and we provide a workspace for it.
+To quickly create a development enviromnemt we use a virtual machine in your
workstation created with [multipass](https://multipass.run/).
You need a virtual machine with at least 8GB of memory and 4 VCPU so your
development workstation probably needs at least 16GB and 6 VCPU. Your mileage
may vary.
-*NOTE*: of course you can operate variations. It should be relatively easy to
run the development virtual machine in a cloud provider using the provided
cloud-init script. Basically all the cloud providers allows to build a VM using
cloud-init.
-We do not provide instructions how to setup on the various cloud provider
(yet).
-
-You can even setup the development environment by yourself without using the
virtual machine, and use a different IDE, but adapting the configuration for
your IDE is up to you and could be very time-consuming. Our development
environment is the result of a few years of fine tuning, so we do not expect it
will be easy to change.
+Read on how to create a test environment.
## Install Multipass
Here we describe how to setup the development virtual machine on Linux, Mac
and Windows using multipass. First, install multipass.
-- On Mac, if you already have [brew](https://brew.sh/), installing it is as
easy as to type `brew install multipass`.
+- On Mac, if you already have [brew](https://brew.sh/), installing it is as
easy as to type `brew install --cask multipass`.
- On Linux, if you already have [snap](https://snapcraft.io/), installing it
is as easy as type `sudo snap install multipass`.
@@ -47,28 +39,73 @@ The steps and the commands to install the development VM
are the same in Linux,
Once you have `multipass` installed, open a terminal or powershell and type
the following command:
```
-multipass launch -nopenserverless -c4 -d20g -m8g --cloud-init
https://raw.githubusercontent.com/apache/openserverless/main/cloud-init.yaml
+multipass launch -nopsv -c4 -d20g -m16g --cloud-init
https://raw.githubusercontent.com/apache/openserverless/main/cloud-init.yaml
```
-Now wait until the installation is complete and you see messages like `status:
done` or `Launched: openserverless` (message can be different depending on
multipass version effectively installed).
+Wait until the vm is launched and you see messages like `Launched:
openserverless` (message can be different depending on multipass version
effectively installed).
+
+Complete the installation with the following command:
```
-multipass exec "openserverless" -- sudo cloud-init status --wait
+multipass exec opsv ./waitready
```
-Finally check if Kubernetes (k3s) is up and running in the VM:
+Your VM is ready.
+
+## (Optional) Configure Kubectl access
+
+If you need administrative access to the vm, copy the `.kube/config` file
inside the VM locally, then check if you have access:
```
-multipass exec openserverless sudo k3s kubectl get nodes
+mkdir $HOME/.kube
+# warning this overwrites an exiting kube config
+multipass exec opsv "cat .kube/config" >$HOME/.kube/config
+# you need kubectl installed
+kubectl get nodes
```
You should see something like this:
```
NAME STATUS ROLES AGE VERSION
-openserverless Ready control-plane,master 4h58m v1.29.6+k3s1
+opsv Ready control-plane,master 4h58m v1.29.6+k3s1
```
+# Development Environment Overview
+
+If you only want to test OpenServerless, stop here. You should have a working
environment.
+
+The rest of this readme describes how to create a development enviroment
within the vm.
+
+You need to setup the test environment with multipass before going on with the
Development Environment.
+
+As an IDE we use [VSCode](https://code.visualstudio.com/) as it allows [Remote
Development](https://code.visualstudio.com/docs/remote/remote-overview) within
the virtual machine, and we provide a workspace for it.
+
+You may setup the environment by yourself, but it can take a lot of time so we
prepared a procedure to setup quickly a ready-to-use development environment
which runs the same on Windows, Linux and Mac.
+
+Our development environment uses a virtual machine based on Ubuntu 24.04. The
virtual environemnt is initialized with a [cloud-init](https://cloud-init.io/)
script we provide.
+
+The script installs [k3s](https://k3s.io/) as Kubernetes engine and
[nix](https://nixos.org/download/#download-nix) to setup development
environments. The project includes multiple subprojects, each one with a
different set of dependencies so we use [direnv](https://direnv.net/) to
automatically activate the right tools when you open a terminal.
+
+*NOTE*: of course you can operate variations. It should be relatively easy to
run the development virtual machine in a cloud provider using the provided
cloud-init script. Basically all the cloud providers allows to build a VM using
cloud-init.
+We do not provide instructions how to setup on the various cloud provider
(yet).
+
+You can even setup the development environment by yourself without using the
virtual machine, and use a different IDE, but adapting the configuration for
your IDE is up to you and could be very time-consuming. Our development
environment is the result of a few years of fine tuning, so we do not expect it
will be easy to change.
+
+## Install openserverless and tools in the VM
+
+By default the vm is only for testing, there is no development code inside.
+
+If you are a developer, fefore accessing the VM use this command to dowload
the soucre code and tools you need to for development:
+
+```
+multipass exec opsv ./i-am-a-developer
+```
+
+You may need to wait a little bit before everything is ready.
+
+Once everything is ready, read on to configure access to the vm using VSCode.
+
## Configure SSH access for VSCode
To access the virtual machine from VSCode you need to setup a ssh key and
create a configuration. Open a terminal (powershell on Windows) and follow
those steps:
@@ -78,28 +115,28 @@ To access the virtual machine from VSCode you need to
setup a ssh key and create
2. Copy the key in the virtual machine to allow no password access:
```
-multipass transfer $HOME/.ssh/id_rsa.pub openserverless:
-multipass exec openserverless -- bash -c "cat id_rsa.pub | tee -a
.ssh/authorized_keys"
+multipass transfer $HOME/.ssh/id_rsa.pub opsv:
+multipass exec opsv -- bash -c "cat id_rsa.pub | tee -a .ssh/authorized_keys"
```
-3. Create a configuration named `openserverless` to easily access it.
+3. Create a configuration named `opsv` to easily access it.
First type `multipass list`. You will see something like this:
```
Name State IPv4 Image
-openserverless Running 10.6.73.253 Ubuntu 24.04 LTS
+opsv Running 10.6.73.253 Ubuntu 24.04 LTS
10.42.0.0
10.42.0.1
```
-Take note of the `<IP>` in the `openserverless line` (in this case
`10.6.73.253` but your value can be different)
+Take note of the `<IP>` in the `opsv` line (in this example `10.6.73.253` but
your value can be different)
Use an editor to add to the file `~/.ssh/config` the following:
```
-Host openserverless
- Hostname <IP>
+Host opsv
+ Hostname <IP>
User ubuntu
IdentityFile ~/.ssh/id_rsa
```
@@ -107,7 +144,7 @@ Host openserverless
4. Check you have access without password:
```
-ssh openserverless
+ssh opsv
```
Once you accessed the VM configure git with your username and email:
@@ -127,7 +164,7 @@ git config --global user.email "<your-email>"
4. Type F1 then "Connect" (or click on the `><` symbol in the corner to the
left at the bottom) and select "Remote-SSH: Connect Current Windows to Host"
-5. Click on `openserverless` then select Linux if requested
+5. Click on `opsv` then select Linux if requested
6. Click on the menu bar on `File` then `Openworkspace from file`, then select
the `openserverless` folder and open one of the workspaces. Currently:
@@ -135,8 +172,7 @@ git config --global user.email "<your-email>"
- `openserverless-operator.code-workspace`: for the Operator alone
- `openserverless.code-workspace`: for the root with the Operator and the site
-
- Select `Linux` and then `Trust the authors` if requested.
+Select `Linux` and then `Trust the authors` if requested.
## Access to the subprojects
@@ -174,5 +210,6 @@ If you do not want to keep the VM anymore, ensure you have
backed up all your fi
For multipass, use the following commands to cleanup:
```
-multipass delete openserverless --purge
+multipass delete opsv --purge
```
+
diff --git a/aliases b/bash_aliases
similarity index 97%
rename from aliases
rename to bash_aliases
index 5549d90..009d306 100644
--- a/aliases
+++ b/bash_aliases
@@ -17,7 +17,7 @@
# under the License.
#
-alias va="vi ~/openserverless/aliases ; source ~/openserverless/aliases"
+alias va="vi ~/.bash_aliases ; source ~/.bash_aliases"
# prompt
parse_git_branch() {
@@ -115,3 +115,4 @@ alias ttt='task -d ../..'
alias dtag="date +%y%m%d%H"
alias lenv='export $(xargs <.env)'
alias nssh="ssh -oStrictHostKeyChecking=no"
+alias gr="grep -nr"
\ No newline at end of file
diff --git a/cloud-init.yaml b/cloud-init.yaml
index 653a380..4b543da 100644
--- a/cloud-init.yaml
+++ b/cloud-init.yaml
@@ -1,54 +1,86 @@
#cloud-config
apt_update: true
apt_upgrade: true
+packages:
+ - at
+
users:
- name: ubuntu
uid: 1000
groups: sudo
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
+
+write_files:
+ - path: /etc/cloud-init.sh
+ permissions: '0755'
+ owner: root:root
+ content: |
+ echo "OPS_CLOUD_INIT_VER=3" >>/etc/environment
+ IP="$(ip -o -4 addr | awk '$2 ~/en/ { print $4}' | cut -d/ -f1)"
+ # install k3s, direnv, task
+ curl -sfL https://get.k3s.io | sh -
+ # set home and user
+ USR="$(getent passwd 1000 | awk -F: '{print $1}')"
+ HOME="/home/$USR"
+ # copy authkey if there is a root one
+ mkdir -p /home/$USR/.ssh
+ if test -e /root/.ssh/authorized_keys
+ then cat /root/.ssh/authorized_keys >>/home/$USR/.ssh/authorized_keys
+ fi
+ # access k3s
+ mkdir -p "$HOME/.kube"
+ cat /etc/rancher/k3s/k3s.yaml "$HOME/.kube/config" | sed -e 's!server:
https://127.0.0.1:!server: https://'$IP':!' >"$HOME/.kube/config"
+ echo "export KUBECONFIG=/home/$USR/.kube/config" >>$HOME/.bashrc
+ chown -Rvf "$USR" /home/$USR
+ echo "== DONE =="
+
+ - path: /home/ubuntu/waitready
+ permissions: '0755'
+ owner: ubuntu:ubuntu
+ defer: true
+ content: |
+ #!/bin/bash
+ sudo cloud-init status --wait
+ tail -f /tmp/cloud-init.log | while read line
+ do echo "$line"
+ if [[ "$line" == *"== DONE =="* ]]
+ then exit 0
+ fi
+ done
+
+ - path: /home/ubuntu/i-am-a-developer
+ permissions: '0755'
+ defer: true
+ owner: ubuntu:ubuntu
+ content: |
+ # get openserverless sources
+ cd $HOME
+ # install task and skywalking-eyes
+ sudo snap install task --classic
+ sudo snap install go --classic
+ go install github.com/apache/skywalking-eyes/cmd/license-eye@latest
+ echo "export PATH=\$PATH:\$HOME/go/bin" >> .bashrc
+ # install direnv and nix
+ curl -sL https://nixos.org/nix/install | sh
+ source .profile
+ curl -sL https://direnv.net/install.sh | sudo bash
+ echo 'eval "$(direnv hook bash)"' >> .bashrc
+ source .bashrc
+ # setup openserverless
+ git clone https://github.com/apache/openserverless.git
--recurse-submodules
+ cd openserverless
+ bash sync-branch.sh
+ bash direnv-init.sh
+ # TODO add a .git-hooks directory with hooks
+ #git config core.hooksPath .git-hooks
+
runcmd:
- |
- # install k3s, direnv, task
- curl -sfL https://get.k3s.io | sh -
- curl -sfL https://direnv.net/install.sh | bash
- snap install task --classic
- cd /tmp
- curl
https://dlcdn.apache.org/skywalking/eyes/0.6.0/skywalking-license-eye-0.6.0-bin.tgz
| tar xzvf -
- mv skywalking-license-eye-0.6.0-bin/bin/linux/license-eye
/usr/bin/license-eye
- rm -Rvf skywalking-license-eye-0.6.0-bin
- echo "OPS_CLOUD_INIT_VER=2" >>/etc/environment
- - |
- # set home and user
- USR="$(getent passwd 1000 | awk -F: '{print $1}')"
- HOME="/home/$USR"
- # copy authkey if there is a root one
- if test -e /root/.ssh/authorized_keys
- then mkdir -p /home/$USR/.ssh
- cat /root/.ssh/authorized_keys >>/home/$USR/.ssh/authorized_keys
- fi
- # access k3s
- mkdir -p "$HOME/.kube"
- cp /etc/rancher/k3s/k3s.yaml "$HOME/.kube/config"
- echo "export KUBECONFIG=/home/$USR/.kube/config" >>$HOME/.bashrc
- # use direnv for autoinit
- echo 'eval "$(direnv hook bash)"' >>$HOME/.bashrc
- # install nix
- curl -L https://nixos.org/nix/install | sudo -u "$USR" sh
- # get openserverless sources
- cd $HOME
- # add z.sh
- curl "https://raw.githubusercontent.com/rupa/z/master/z.sh" -o
"$HOME/.z.sh"
- echo "source $HOME/.z.sh" >> $HOME/.bashrc
- # add aliases
- echo "source $HOME/openserverless/aliases" >>$HOME/.bashrc
- # change owner to everything
- chown -Rvf "$USR" "$HOME"
- # allow direnv for submodules
- sudo -u $USR git clone https://github.com/apache/openserverless
--recurse-submodules
- cd $HOME/openserverless
- sudo -u $USR bash sync-branch.sh
- sudo -i -H -u $USR bash "$HOME/openserverless/direnv-init.sh"
- # install license-eye and a git-hook
- sudo -u $USR git config core.hooksPath .git-hooks
-
+ cd /home/ubuntu
+ # add z.sh and .aliases
+ curl -sL "https://raw.githubusercontent.com/rupa/z/master/z.sh" -o ".z.sh"
+ curl -sL
https://raw.githubusercontent.com/sciabarracom/openserverless/refs/heads/main/bash_aliases
-o ".bash_aliases"
+ echo 'source $HOME/.z.sh' >> .bashrc
+ chown ubuntu:ubuntu .z.sh .bashrc .bash_aliases
+ echo -e '#!/bin/bash\n/etc/cloud-init.sh 2>&1 >/tmp/cloud-init.log\n' | at
now
diff --git a/devel/images/standalone/Dockerfile
b/devel/images/standalone/Dockerfile
deleted file mode 100644
index 0b2debc..0000000
--- a/devel/images/standalone/Dockerfile
+++ /dev/null
@@ -1,3 +0,0 @@
-FROM openjdk:11
-ADD openwhisk-standalone.jar /openwhisk-standalone.jar
-
diff --git a/devel/images/standalone/Taskfile.yml
b/devel/images/standalone/Taskfile.yml
deleted file mode 100644
index 0cec354..0000000
--- a/devel/images/standalone/Taskfile.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-version: 3
-
-vars:
- STANDALONE: "openwhisk/standalone:7ef091c"
- IMAGE: "ghcr.io/sciabarracom/standalone:2506121330"
-
-tasks:
-
- default:
- desc: "build"
- cmds:
- - task: extract
- - >
- docker build
- -t "{{.IMAGE}}" .
-
- extract:
- desc: "Extract the tarball"
- cmds:
- - |
- docker run --rm --privileged tonistiigi/binfmt --install all
- docker pull --platform=linux/amd64 "{{.STANDALONE}}"
- docker create --name=standalone --platform=linux/amd64
"{{.STANDALONE}}"
- docker cp standalone:/openwhisk-standalone.jar .
- docker rm standalone
- status:
- - test -e openwhisk-standalone.jar
-
diff --git a/devel/olaris b/devel/olaris
index 0711f71..6388332 160000
--- a/devel/olaris
+++ b/devel/olaris
@@ -1 +1 @@
-Subproject commit 0711f71d52991aa51554a3dd2a2e8894927e86d0
+Subproject commit 6388332ea80713df0aa8d9f10e82598735840d80
diff --git a/devel/olaris-operator b/devel/olaris-operator
index 3e5d58a..ec4d1da 160000
--- a/devel/olaris-operator
+++ b/devel/olaris-operator
@@ -1 +1 @@
-Subproject commit 3e5d58af3c76df02594b291cf18ee3667e9e4ccf
+Subproject commit ec4d1dafe236a3840b1d4fdf83a07ab6a4800586
diff --git a/operator b/operator
index 856f9b1..cc71248 160000
--- a/operator
+++ b/operator
@@ -1 +1 @@
-Subproject commit 856f9b1c419ea03cdda83776b79694990565591b
+Subproject commit cc71248fefb806c52cf82fa50047eb2759930363
diff --git a/runtimes b/runtimes
index 22410e7..b1c2ce7 160000
--- a/runtimes
+++ b/runtimes
@@ -1 +1 @@
-Subproject commit 22410e7bf600e0c1447711a1cdd32ab33c656c0a
+Subproject commit b1c2ce7b63e5cec138d1b4ab95986df28cd30132
diff --git a/site b/site
index 77cae7d..7412617 160000
--- a/site
+++ b/site
@@ -1 +1 @@
-Subproject commit 77cae7d7f8dbbc35ca4faf22a49b48bac47961bb
+Subproject commit 7412617826529eed78ab06dda43ff0bc6af47396
diff --git a/task b/task
index bdad54c..9df941d 160000
--- a/task
+++ b/task
@@ -1 +1 @@
-Subproject commit bdad54c73d0457243e22d0fcf5eb992c585c9fee
+Subproject commit 9df941d74c5f19003467546c807688b3cdf5ec3c
diff --git a/testing b/testing
index bc70c6f..ca50a34 160000
--- a/testing
+++ b/testing
@@ -1 +1 @@
-Subproject commit bc70c6f19d8bdc589b71e0b1c69b754a2442b674
+Subproject commit ca50a340d7b2d94517b928a1ac59f666148f3de7