blob: b858ebeb85d4ed24e2e50e4dbf90478a7191149c [file] [log] [blame] [view]
giolekvaa71e6182020-12-09 14:26:42 +04001# Development Environment
2
3## Prerequisites
4PCloud uses following tools to build and deploy it's packages:
giolekva1d806492020-12-16 14:13:38 +04005* Docker - To build container images: https://docs.docker.com/get-docker/
giolekvaa71e6182020-12-09 14:26:42 +04006* k3d - To create local Kubernetes cluster for development environment: https://k3d.io/#installation
7* kubectl - To interacto with the cluster: https://kubectl.docs.kubernetes.io/installation/kubectl/
8* Helm - To package and distributes both PCloud core services and applications running on it: https://helm.sh/docs/intro/install/
9
10Each of these tools provide multiple ways of installing them, choose the one which best suits you and your Host OS.
11
giolekva1d806492020-12-16 14:13:38 +040012# Development Instructions
13
giolekvaa71e6182020-12-09 14:26:42 +040014## Installing PCloud
15PCloud installation is two step process:
giolekvae5221bc2020-12-16 14:34:23 +040016```shell
giolekva1d806492020-12-16 14:13:38 +040017> ./dev/create_dev_cluster.sh # creates local Kubernetes cluster
18> ./dev/install_core_services.sh # installs PCloud core services
giolekvae5221bc2020-12-16 14:34:23 +040019```
giolekva1d806492020-12-16 14:13:38 +040020
21## Installing applications
22Under apps/ directory one can find number of sample application for PCloud. Installing any of those requires building container image, creating Helm Chart tarball and uploading it to Application Manager.
23Let's see what that looks like for rpuppy application:
giolekvae5221bc2020-12-16 14:34:23 +040024```shell
giolekva1d806492020-12-16 14:13:38 +040025> bazel run //apps/rpuppy:push_to_dev # builds and pushes container image to localhost:30500 container registry, which is running inside PCloud cluster
26> bazel build //apps/rpuppy:chart # creates Helm Chart tartball which can be found at bazel-bin/apps/rpuppy/chart.tar.gz
giolekvae5221bc2020-12-16 14:34:23 +040027```
giolekva1d806492020-12-16 14:13:38 +040028
29## Redeploying core services
30To redeploy one of the core services after making changes in it you have to rebuild container images and restart the running service. Let's see what that looks like for API Service:
giolekvae5221bc2020-12-16 14:34:23 +040031```shell
giolekva1d806492020-12-16 14:13:38 +040032> bazel run //core/api:push_to_dev # builds and pushes container image to localhost:30500 container registry, which is running inside PCloud cluster
33> kubectl -n pcloud rollout restart deployment/api
giolekvae5221bc2020-12-16 14:34:23 +040034```
giolekva1d806492020-12-16 14:13:38 +040035
36Reflecting changes in the chart configuration requires reinstallation of the chart itself:
giolekvae5221bc2020-12-16 14:34:23 +040037```shell
giolekva1d806492020-12-16 14:13:38 +040038> bazel build //core/api:chart # creates chart tarball
39> bazel run //core/api:uninstall # uninstalls old Helm Chart from the cluster
40> bazel run //core/api:install # installs new Helm Chart to the cluster
giolekvae5221bc2020-12-16 14:34:23 +040041```