blob: b8b24202958d2b9b6f5c7f67770dabdde17e79d9 [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:
giolekvac32dd312020-12-17 15:50:12 +04005* Python - Used by Bazel: https://www.python.org/downloads/
6* Bazel - Build tool of the: https://docs.bazel.build/versions/3.7.0/install.html
giolekva1d806492020-12-16 14:13:38 +04007* Docker - To build container images: https://docs.docker.com/get-docker/
giolekvaa71e6182020-12-09 14:26:42 +04008* k3d - To create local Kubernetes cluster for development environment: https://k3d.io/#installation
9* kubectl - To interacto with the cluster: https://kubectl.docs.kubernetes.io/installation/kubectl/
10* Helm - To package and distributes both PCloud core services and applications running on it: https://helm.sh/docs/intro/install/
11
12Each of these tools provide multiple ways of installing them, choose the one which best suits you and your Host OS.
giolekvac32dd312020-12-17 15:50:12 +040013To check if requirements are met please run:
14```shell
15> ./dev/check_requirements.sh
16```
giolekvaa71e6182020-12-09 14:26:42 +040017
giolekva1d806492020-12-16 14:13:38 +040018# Development Instructions
19
giolekvaa71e6182020-12-09 14:26:42 +040020## Installing PCloud
21PCloud installation is two step process:
giolekvae5221bc2020-12-16 14:34:23 +040022```shell
giolekva1d806492020-12-16 14:13:38 +040023> ./dev/create_dev_cluster.sh # creates local Kubernetes cluster
24> ./dev/install_core_services.sh # installs PCloud core services
giolekvae5221bc2020-12-16 14:34:23 +040025```
giolekva1d806492020-12-16 14:13:38 +040026
27## Installing applications
28Under 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.
29Let's see what that looks like for rpuppy application:
giolekvae5221bc2020-12-16 14:34:23 +040030```shell
giolekva1d806492020-12-16 14:13:38 +040031> bazel run //apps/rpuppy:push_to_dev # builds and pushes container image to localhost:30500 container registry, which is running inside PCloud cluster
32> 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 +040033```
giolekva1d806492020-12-16 14:13:38 +040034
35## Redeploying core services
36To 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 +040037```shell
giolekva1d806492020-12-16 14:13:38 +040038> bazel run //core/api:push_to_dev # builds and pushes container image to localhost:30500 container registry, which is running inside PCloud cluster
39> kubectl -n pcloud rollout restart deployment/api
giolekvae5221bc2020-12-16 14:34:23 +040040```
giolekva1d806492020-12-16 14:13:38 +040041
42Reflecting changes in the chart configuration requires reinstallation of the chart itself:
giolekvae5221bc2020-12-16 14:34:23 +040043```shell
giolekva1d806492020-12-16 14:13:38 +040044> bazel build //core/api:chart # creates chart tarball
45> bazel run //core/api:uninstall # uninstalls old Helm Chart from the cluster
46> bazel run //core/api:install # installs new Helm Chart to the cluster
giolekvae5221bc2020-12-16 14:34:23 +040047```