github.com/tooploox/oya@v0.0.21-0.20230524103240-1cda1861aad6/TUTORIAL.md (about) 1 # Oya tutorial 2 3 ## What is Oya 4 5 Oya lets you bootstrap CI/CD for your project using ready-made packs supporting various workflows and CI/CD tools. 6 7 ## Install Oya and its dependencies 8 9 curl https://raw.githubusercontent/bilus/oya/master/scripts/setup.sh | bash 10 11 ## Our application 12 13 The application we will work with is a Hello world of HTTP servers written in Golang. 14 15 To get you quickly started, simply clone the following repository: TODO 16 17 It contains `hello/main.go` with the source code of the HTTP server. 18 19 ## Deploying it to GKE 20 21 I'll show you how to deploy the Hello world app as a Docker container running on the Google Kubernetes Engine (TODO: One-sentence explanation). 22 23 The first step is initializing the repository: 24 25 oya init 26 27 All it does is generate an empty Oyafile in the root directory. 28 29 Let's dockerize our app using an Oya pack that makes it easy. First, install the pack: 30 31 oya get github.com/tooploox/oya/packs/docker [--alias docker] 32 33 Then, generate the assets necessary to put the application into a Docker image: 34 35 oya generate docker hello 36 37 The command invokes an Oya generator named "docker" passing it the path to the Hello world application as an argument. The command will generate a few files: 38 39 hello/ 40 Oyafile 41 Dockerfile 42 43 Oyafile contains Oya configuration, Dockerfile contains the instructions of how to build the Docker image. 44 45 > In general syntax of the `generate` Oya command is: `oya generate <generator> <args>`. You can list the available generators like so: `oya generate list`. 46 47 Let's build the image: 48 49 oya run docker.build 50 51 oya docker build 52 53 > If you run this command in the root directory, it'll build docker images for all applications you used the `oya generate docker` command on. In our case, it's just the Hello world app. You can also run it in a specific app's directory. 54 55 HERE NEXT 56 57 We need to tell Oya this is what we want to do: 58 59 oya get github.com/tooploox/oya/packs/gke 60 61 The command installs the gke pack. We'll also need the docker pack to simplify putting our app in a docker container: 62 63 oya get github.com/tooploox/oya/packs/docker 64 65 Let's generate code necessary to deploy our app in a docker container: 66 67 cd hello 68 oya generate g 69 70 ## Adding CI/CD