├── rails ├── log │ └── .keep ├── tmp │ └── .keep ├── vendor │ └── .keep ├── lib │ ├── assets │ │ └── .keep │ └── tasks │ │ └── .keep ├── storage │ └── .keep ├── test │ ├── models │ │ ├── .keep │ │ └── article_test.rb │ ├── system │ │ └── .keep │ ├── controllers │ │ ├── .keep │ │ ├── articles_controller_test.rb │ │ └── welcome_controller_test.rb │ ├── fixtures │ │ ├── .keep │ │ ├── files │ │ │ └── .keep │ │ └── articles.yml │ ├── helpers │ │ └── .keep │ ├── integration │ │ └── .keep │ ├── mailers │ │ └── .keep │ ├── application_system_test_case.rb │ └── test_helper.rb ├── public │ ├── favicon.ico │ ├── apple-touch-icon.png │ ├── apple-touch-icon-precomposed.png │ ├── robots.txt │ ├── 500.html │ ├── 422.html │ └── 404.html ├── .ruby-version ├── app │ ├── assets │ │ ├── images │ │ │ └── .keep │ │ ├── javascripts │ │ │ ├── channels │ │ │ │ └── .keep │ │ │ ├── articles.coffee │ │ │ ├── welcome.coffee │ │ │ ├── cable.js │ │ │ └── application.js │ │ ├── config │ │ │ └── manifest.js │ │ └── stylesheets │ │ │ ├── articles.scss │ │ │ ├── welcome.scss │ │ │ └── application.css │ ├── models │ │ ├── concerns │ │ │ └── .keep │ │ ├── application_record.rb │ │ └── article.rb │ ├── controllers │ │ ├── concerns │ │ │ └── .keep │ │ ├── application_controller.rb │ │ ├── welcome_controller.rb │ │ └── articles_controller.rb │ ├── views │ │ ├── layouts │ │ │ ├── mailer.text.erb │ │ │ ├── mailer.html.erb │ │ │ └── application.html.erb │ │ ├── welcome │ │ │ └── index.html.erb │ │ └── articles │ │ │ ├── edit.html.erb │ │ │ ├── new.html.erb │ │ │ ├── show.html.erb │ │ │ ├── index.html.erb │ │ │ └── _form.html.erb │ ├── helpers │ │ ├── welcome_helper.rb │ │ ├── articles_helper.rb │ │ └── application_helper.rb │ ├── jobs │ │ └── application_job.rb │ ├── channels │ │ └── application_cable │ │ │ ├── channel.rb │ │ │ └── connection.rb │ └── mailers │ │ └── application_mailer.rb ├── package.json ├── config │ ├── routes.rb │ ├── spring.rb │ ├── environment.rb │ ├── initializers │ │ ├── mime_types.rb │ │ ├── filter_parameter_logging.rb │ │ ├── application_controller_renderer.rb │ │ ├── cookies_serializer.rb │ │ ├── backtrace_silencers.rb │ │ ├── wrap_parameters.rb │ │ ├── assets.rb │ │ ├── inflections.rb │ │ └── content_security_policy.rb │ ├── boot.rb │ ├── cable.yml │ ├── credentials.yml.enc │ ├── database.yml │ ├── application.rb │ ├── locales │ │ └── en.yml │ ├── storage.yml │ ├── puma.rb │ └── environments │ │ ├── test.rb │ │ ├── development.rb │ │ └── production.rb ├── bin │ ├── bundle │ ├── rake │ ├── rails │ ├── yarn │ ├── spring │ ├── update │ └── setup ├── config.ru ├── Rakefile ├── okteto.yml ├── db │ ├── migrate │ │ └── 20190605024043_create_articles.rb │ ├── seeds.rb │ └── schema.rb ├── Dockerfile ├── .dockerignore ├── k8s.yml ├── .gitignore ├── .stignore ├── Gemfile ├── README.md └── Gemfile.lock ├── helm ├── .dockerignore ├── requirements.txt ├── chart │ ├── Chart.yaml │ ├── values.yaml │ ├── .helmignore │ └── templates │ │ ├── service.yaml │ │ ├── _helpers.tpl │ │ └── deployment.yaml ├── okteto.yml ├── README.md ├── templates │ └── index.html ├── app.py └── static │ └── stylesheets │ └── style.css ├── php ├── .stignore ├── api │ └── hello.php ├── src │ ├── index.html │ └── index.js ├── dist │ └── index.html ├── webpack.config.prod.js ├── webpack.config.dev.js ├── okteto.yml ├── webpack.config.js ├── package.json ├── manifests │ ├── configmap.yaml │ ├── php.yaml │ └── web.yaml └── README.md ├── coder ├── requirements.txt ├── manifests │ ├── redis-service.yaml │ ├── vote-service.yaml │ ├── vote-deployment.yaml │ └── redis-stafulset.yaml ├── okteto.yml ├── README.md ├── Dockerfile ├── templates │ └── index.html ├── app.py └── static │ └── stylesheets │ └── style.css ├── jib ├── .stignore ├── .gitignore ├── okteto.yml ├── manifests │ ├── service.yaml │ └── deployment.yaml ├── src │ └── main │ │ └── java │ │ └── hello │ │ ├── Application.java │ │ └── HelloController.java ├── build.gradle └── README.md ├── .gitignore ├── .mlc_config.json ├── CODEOWNERS ├── .github ├── CODEOWNERS └── workflows │ └── linkchecker.yaml ├── README.md └── LICENSE /rails/log/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rails/tmp/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rails/vendor/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rails/lib/assets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rails/lib/tasks/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rails/storage/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rails/test/models/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rails/test/system/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /helm/.dockerignore: -------------------------------------------------------------------------------- 1 | okteto.yml -------------------------------------------------------------------------------- /rails/public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rails/test/controllers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rails/test/fixtures/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rails/test/helpers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rails/test/integration/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rails/test/mailers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /helm/requirements.txt: -------------------------------------------------------------------------------- 1 | Flask 2 | -------------------------------------------------------------------------------- /php/.stignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | -------------------------------------------------------------------------------- /rails/.ruby-version: -------------------------------------------------------------------------------- 1 | ruby-2.6.2 -------------------------------------------------------------------------------- /rails/app/assets/images/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rails/app/models/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rails/public/apple-touch-icon.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rails/test/fixtures/files/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rails/app/controllers/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /coder/requirements.txt: -------------------------------------------------------------------------------- 1 | Flask 2 | Redis 3 | -------------------------------------------------------------------------------- /rails/app/assets/javascripts/channels/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /php/api/hello.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /jib/.stignore: -------------------------------------------------------------------------------- 1 | /.gradle 2 | /build 3 | /.classpath 4 | /.settings -------------------------------------------------------------------------------- /rails/app/helpers/welcome_helper.rb: -------------------------------------------------------------------------------- 1 | module WelcomeHelper 2 | end 3 | -------------------------------------------------------------------------------- /jib/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | .gradle 3 | *.class 4 | .classpath 5 | .settings -------------------------------------------------------------------------------- /rails/app/helpers/articles_helper.rb: -------------------------------------------------------------------------------- 1 | module ArticlesHelper 2 | end 3 | -------------------------------------------------------------------------------- /rails/app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /rails/app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | end 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | golang/__debug_bin 3 | php/dist/main.js 4 | yarn-error.log 5 | .project -------------------------------------------------------------------------------- /rails/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "blog", 3 | "private": true, 4 | "dependencies": {} 5 | } 6 | -------------------------------------------------------------------------------- /rails/app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | end 3 | -------------------------------------------------------------------------------- /rails/app/views/welcome/index.html.erb: -------------------------------------------------------------------------------- 1 |

Hello, Rails!

2 | <%= link_to 'My Blog', controller: 'articles' %> -------------------------------------------------------------------------------- /helm/chart/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | appVersion: "1.0" 3 | description: A voting app 4 | name: vote 5 | version: 0.1.0 6 | -------------------------------------------------------------------------------- /rails/app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | self.abstract_class = true 3 | end 4 | -------------------------------------------------------------------------------- /rails/public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | -------------------------------------------------------------------------------- /rails/app/controllers/welcome_controller.rb: -------------------------------------------------------------------------------- 1 | class WelcomeController < ApplicationController 2 | def index 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /rails/app/models/article.rb: -------------------------------------------------------------------------------- 1 | class Article < ApplicationRecord 2 | validates :title, presence: true, length: { minimum: 5 } 3 | end 4 | -------------------------------------------------------------------------------- /rails/app/views/articles/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Edit article

2 | 3 | <%= render 'form' %> 4 | 5 | <%= link_to 'Back', articles_path %> -------------------------------------------------------------------------------- /rails/app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Channel < ActionCable::Channel::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /php/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Getting Started 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /rails/app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../javascripts .js 3 | //= link_directory ../stylesheets .css 4 | -------------------------------------------------------------------------------- /rails/app/views/articles/new.html.erb: -------------------------------------------------------------------------------- 1 | 2 |

New article

3 | 4 | <%= render 'form' %> 5 | 6 | <%= link_to 'Back', articles_path %> 7 | -------------------------------------------------------------------------------- /rails/config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | get 'welcome/index' 3 | resources :articles 4 | root 'welcome#index' 5 | end 6 | -------------------------------------------------------------------------------- /rails/app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Connection < ActionCable::Connection::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /rails/bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /rails/app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | class ApplicationMailer < ActionMailer::Base 2 | default from: 'from@example.com' 3 | layout 'mailer' 4 | end 5 | -------------------------------------------------------------------------------- /rails/config/spring.rb: -------------------------------------------------------------------------------- 1 | %w[ 2 | .ruby-version 3 | .rbenv-vars 4 | tmp/restart.txt 5 | tmp/caching-dev.txt 6 | ].each { |path| Spring.watch(path) } 7 | -------------------------------------------------------------------------------- /rails/config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative 'config/environment' 4 | 5 | run Rails.application 6 | -------------------------------------------------------------------------------- /rails/config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative 'application' 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /rails/test/models/article_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ArticleTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /php/dist/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Getting Started 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /rails/config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /.mlc_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "ignorePatterns": [ 3 | { 4 | "pattern": ".*localhost.*" 5 | } 6 | ], 7 | "aliveStatusCodes": [ 8 | 200, 9 | 403 10 | ] 11 | } -------------------------------------------------------------------------------- /rails/test/controllers/articles_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ArticlesControllerTest < ActionDispatch::IntegrationTest 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /jib/okteto.yml: -------------------------------------------------------------------------------- 1 | dev: 2 | java-dev: 3 | image: ghcr.io/okteto/gradle:latest 4 | command: ["bash"] 5 | services: 6 | - name: hello 7 | sync: 8 | - build/classes/java/main:/app/classes 9 | -------------------------------------------------------------------------------- /php/src/index.js: -------------------------------------------------------------------------------- 1 | function component() { 2 | const element = document.createElement('div'); 3 | element.innerHTML = 'Hello webpack'; 4 | return element; 5 | } 6 | 7 | document.body.appendChild(component()); -------------------------------------------------------------------------------- /php/webpack.config.prod.js: -------------------------------------------------------------------------------- 1 | const merge = require('webpack-merge'); 2 | const baseConfig = require('./webpack.config.js'); 3 | 4 | module.exports = merge(require('./webpack.config.js'), { 5 | mode: 'production' 6 | }); -------------------------------------------------------------------------------- /rails/test/application_system_test_case.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class ApplicationSystemTestCase < ActionDispatch::SystemTestCase 4 | driven_by :selenium, using: :chrome, screen_size: [1400, 1400] 5 | end 6 | -------------------------------------------------------------------------------- /rails/app/assets/stylesheets/articles.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Articles controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /rails/app/assets/stylesheets/welcome.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Welcome controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /php/webpack.config.dev.js: -------------------------------------------------------------------------------- 1 | const merge = require('webpack-merge'); 2 | const baseConfig = require('./webpack.config.js'); 3 | 4 | module.exports = merge(require('./webpack.config.js'), { 5 | mode: 'development', 6 | watch: true 7 | }); -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Lines starting with '#' are comments. 2 | # Each line is a file pattern followed by one or more owners. 3 | # See https://blog.github.com/2017-07-06-introducing-code-owners/ for details 4 | * @pchico83 @rberrelleza @rlamana -------------------------------------------------------------------------------- /rails/config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | require 'bootsnap/setup' # Speed up boot time by caching expensive operations. 5 | -------------------------------------------------------------------------------- /rails/test/fixtures/articles.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | title: MyString 5 | text: MyText 6 | 7 | two: 8 | title: MyString 9 | text: MyText 10 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Lines starting with '#' are comments. 2 | # Each line is a file pattern followed by one or more owners. 3 | # See https://blog.github.com/2017-07-06-introducing-code-owners/ for details 4 | * @pchico83 @rberrelleza @rlamana 5 | -------------------------------------------------------------------------------- /rails/config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: async 6 | 7 | production: 8 | adapter: redis 9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> 10 | channel_prefix: blog_production 11 | -------------------------------------------------------------------------------- /rails/config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /rails/Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require_relative 'config/application' 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /rails/app/assets/javascripts/articles.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /rails/app/assets/javascripts/welcome.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /rails/okteto.yml: -------------------------------------------------------------------------------- 1 | build: 2 | blog: 3 | context: . 4 | 5 | deploy: 6 | - envsubst < k8s.yml | kubectl apply -f - 7 | 8 | dev: 9 | blog: 10 | sync: 11 | - .:/usr/src/app 12 | forward: 13 | - 8080:8080 14 | command: bash 15 | -------------------------------------------------------------------------------- /rails/bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | require_relative '../config/boot' 8 | require 'rake' 9 | Rake.application.run 10 | -------------------------------------------------------------------------------- /rails/test/controllers/welcome_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class WelcomeControllerTest < ActionDispatch::IntegrationTest 4 | test "should get index" do 5 | get welcome_index_url 6 | assert_response :success 7 | end 8 | 9 | end 10 | -------------------------------------------------------------------------------- /rails/db/migrate/20190605024043_create_articles.rb: -------------------------------------------------------------------------------- 1 | class CreateArticles < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :articles do |t| 4 | t.string :title 5 | t.text :text 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /jib/manifests/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: hello 5 | annotations: 6 | dev.okteto.com/auto-ingress: "true" 7 | spec: 8 | type: ClusterIP 9 | ports: 10 | - name: "hello" 11 | port: 8080 12 | selector: 13 | app: hello -------------------------------------------------------------------------------- /coder/manifests/redis-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: redis 5 | labels: 6 | app.kubernetes.io/instance: coder 7 | spec: 8 | type: ClusterIP 9 | ports: 10 | - name: "redis" 11 | port: 6379 12 | selector: 13 | app: redis 14 | -------------------------------------------------------------------------------- /rails/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:2.6.2 2 | 3 | WORKDIR /usr/src/app 4 | 5 | RUN apt-get update && \ 6 | apt-get install -y sqlite3 7 | 8 | COPY Gemfile* ./ 9 | RUN bundler install 10 | COPY . ./ 11 | EXPOSE 8080 12 | CMD ["sh", "-c", "rails db:migrate && rails server -p=8080 -b=0.0.0.0"] -------------------------------------------------------------------------------- /rails/app/views/articles/show.html.erb: -------------------------------------------------------------------------------- 1 |

2 | Title: 3 | <%= @article.title %> 4 |

5 | 6 |

7 | Text: 8 | <%= @article.text %> 9 |

10 | 11 | <%= link_to 'Edit', edit_article_path(@article) %> | 12 | <%= link_to 'Back', articles_path %> -------------------------------------------------------------------------------- /helm/okteto.yml: -------------------------------------------------------------------------------- 1 | dev: 2 | vote: 3 | selector: 4 | app.kubernetes.io/name: vote 5 | command: ["python", "app.py"] 6 | workdir: /src 7 | environment: 8 | - FLASK_ENV=development 9 | forward: 10 | - 8080:8080 11 | persistentVolume: 12 | enabled: false -------------------------------------------------------------------------------- /rails/config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # ActiveSupport::Reloader.to_prepare do 4 | # ApplicationController.renderer.defaults.merge!( 5 | # http_host: 'example.org', 6 | # https: false 7 | # ) 8 | # end 9 | -------------------------------------------------------------------------------- /rails/config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Specify a serializer for the signed and encrypted cookie jars. 4 | # Valid options are :json, :marshal, and :hybrid. 5 | Rails.application.config.action_dispatch.cookies_serializer = :json 6 | -------------------------------------------------------------------------------- /rails/bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | APP_PATH = File.expand_path('../config/application', __dir__) 8 | require_relative '../config/boot' 9 | require 'rails/commands' 10 | -------------------------------------------------------------------------------- /rails/app/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /helm/chart/values.yaml: -------------------------------------------------------------------------------- 1 | # Default values for mychart. 2 | # This is a YAML-formatted file. 3 | # Declare variables to be passed into your templates. 4 | 5 | replicaCount: 1 6 | 7 | image: 8 | repository: ghcr.io/okteto/vote 9 | tag: "latest" 10 | pullPolicy: IfNotPresent 11 | 12 | service: 13 | type: NodePort 14 | port: 8080 15 | -------------------------------------------------------------------------------- /coder/manifests/vote-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: vote 5 | labels: 6 | app.kubernetes.io/instance: coder 7 | annotations: 8 | dev.okteto.com/auto-ingress: "true" 9 | spec: 10 | type: ClusterIP 11 | ports: 12 | - name: "vote" 13 | port: 8080 14 | selector: 15 | app: vote 16 | -------------------------------------------------------------------------------- /rails/test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV['RAILS_ENV'] ||= 'test' 2 | require_relative '../config/environment' 3 | require 'rails/test_help' 4 | 5 | class ActiveSupport::TestCase 6 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 7 | fixtures :all 8 | 9 | # Add more helper methods to be used by all tests here... 10 | end 11 | -------------------------------------------------------------------------------- /rails/bin/yarn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_ROOT = File.expand_path('..', __dir__) 3 | Dir.chdir(APP_ROOT) do 4 | begin 5 | exec "yarnpkg", *ARGV 6 | rescue Errno::ENOENT 7 | $stderr.puts "Yarn executable was not detected in the system." 8 | $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" 9 | exit 1 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /coder/okteto.yml: -------------------------------------------------------------------------------- 1 | dev: 2 | vote: 3 | image: ghcr.io/okteto/coder-python:dev 4 | workdir: /home/coder/project 5 | command: ["dumb-init", "code-server", "--auth", "none", "--port", "8081", "--host", "0.0.0.0"] 6 | environment: 7 | - FLASK_ENV=development 8 | forward: 9 | - 8081:8081 10 | - 8080:8080 11 | persistentVolume: 12 | enabled: false -------------------------------------------------------------------------------- /jib/src/main/java/hello/Application.java: -------------------------------------------------------------------------------- 1 | package hello; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | } -------------------------------------------------------------------------------- /php/okteto.yml: -------------------------------------------------------------------------------- 1 | dev: 2 | shell: 3 | autocreate: true 4 | image: ghcr.io/okteto/dev:latest 5 | command: bash 6 | sync: 7 | - .:/usr/src/app 8 | forward: 9 | - 8080:web:80 10 | services: 11 | - name: php 12 | sync: 13 | - api:/app 14 | - name: web 15 | sync: 16 | - dist:/usr/share/nginx/html 17 | 18 | -------------------------------------------------------------------------------- /php/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const HtmlWebpackPlugin = require('html-webpack-plugin'); 3 | 4 | module.exports = { 5 | entry: './src/index.js', 6 | output: { 7 | filename: 'main.js', 8 | path: path.resolve(__dirname, 'dist') 9 | }, 10 | plugins: [ 11 | new HtmlWebpackPlugin({ 12 | template: './src/index.html' 13 | }) 14 | ], 15 | }; -------------------------------------------------------------------------------- /jib/src/main/java/hello/HelloController.java: -------------------------------------------------------------------------------- 1 | package hello; 2 | 3 | import org.springframework.web.bind.annotation.RestController; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @RequestMapping("/") 10 | public String index() { 11 | return "Greetings from Kubernetes!"; 12 | } 13 | } -------------------------------------------------------------------------------- /rails/db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) 7 | # Character.create(name: 'Luke', movie: movies.first) 8 | -------------------------------------------------------------------------------- /helm/README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Okteto and Helm 2 | 3 | This example shows how to leverage [Okteto](https://github.com/okteto/okteto) to develop the Voting App directly in the cloud. The Voting App is deployed using a Helm chart. 4 | 5 | This is the application used for the [Develop Helm Applications directly in Kubernetes](https://okteto.com/blog/develop-helm-applications-directly-in-your-kubernetes-cluster/) blog post. 6 | -------------------------------------------------------------------------------- /coder/README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Okteto and Coder 2 | 3 | This example shows how to leverage [Okteto](https://github.com/okteto/okteto) to develop a Python Sample App directly in the cloud using [Coder](https://coder.com/). The Python Sample App is deployed using raw Kubernetes manifests. 4 | 5 | This is the application used for the [Run Coder directly in Kubernetes](https://okteto.com/blog/run-coder-directly-in-kubernetes/) blog post. 6 | -------------------------------------------------------------------------------- /coder/manifests/vote-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: vote 5 | labels: 6 | app.kubernetes.io/instance: coder 7 | spec: 8 | replicas: 1 9 | selector: 10 | matchLabels: 11 | app: vote 12 | template: 13 | metadata: 14 | labels: 15 | app: vote 16 | spec: 17 | containers: 18 | - image: ghcr.io/okteto/vote:redis 19 | name: vote 20 | -------------------------------------------------------------------------------- /coder/manifests/redis-stafulset.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: StatefulSet 3 | metadata: 4 | name: redis 5 | labels: 6 | app.kubernetes.io/instance: coder 7 | spec: 8 | replicas: 1 9 | selector: 10 | matchLabels: 11 | app: redis 12 | serviceName: redis 13 | template: 14 | metadata: 15 | labels: 16 | app: redis 17 | spec: 18 | containers: 19 | - image: redis 20 | name: redis 21 | -------------------------------------------------------------------------------- /helm/chart/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *~ 18 | # Various IDEs 19 | .project 20 | .idea/ 21 | *.tmproj 22 | -------------------------------------------------------------------------------- /rails/app/assets/javascripts/cable.js: -------------------------------------------------------------------------------- 1 | // Action Cable provides the framework to deal with WebSockets in Rails. 2 | // You can generate new channels where WebSocket features live using the `rails generate channel` command. 3 | // 4 | //= require action_cable 5 | //= require_self 6 | //= require_tree ./channels 7 | 8 | (function() { 9 | this.App || (this.App = {}); 10 | 11 | App.cable = ActionCable.createConsumer(); 12 | 13 | }).call(this); 14 | -------------------------------------------------------------------------------- /rails/app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Blog 5 | <%= csrf_meta_tags %> 6 | <%= csp_meta_tag %> 7 | 8 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 9 | <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> 10 | 11 | 12 | 13 | <%= yield %> 14 | 15 | 16 | -------------------------------------------------------------------------------- /rails/config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /rails/config/credentials.yml.enc: -------------------------------------------------------------------------------- 1 | JeUhqwiH527LEAaZWNm5xa+smU1RwoQ1xypKbNwqcA8HD9LyCU+DNwxEA3jgdBlH5uDkF2ZXUA18zRbb787tcWV+d+SIBQUoNnh9yEJCEkQBNgM1RNsdPqu7fiVhysJHqPt58+dhlauEzixC8eSb799KvR7SatCPbZvPGKFPF4YeWp4VMFYbSHitl5L1IATnlCWpICy3QGyAwwCyARiiUMR7/qI/lhctcRwUyIkTceYmJm9Vlsjdn5xqNTafvFKOcHCSVuLoYMZ5PM9agem+GNStsZPFTfhvX7PhEV5jb5LXwO23eyQ0rRI146z44ezGb2Hn2FhljGnTfaz/K795lFBd0v9/tkklUTO1JcHVpw2FP1OfwtnMzlkVIQyfo1XUQHop6aZ2ca4Z1rOXQovsFG4CSb5kRP1SblUL--WTwQiWnBMGVsK0H0--yAUr7OUyP/qtiX0sZLFiaQ== -------------------------------------------------------------------------------- /rails/.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore bundler config. 2 | /.bundle 3 | 4 | # Ignore the default SQLite database. 5 | /db/*.sqlite3 6 | /db/*.sqlite3-journal 7 | 8 | # Ignore all logfiles and tempfiles. 9 | /log/* 10 | /tmp/* 11 | !/log/.keep 12 | !/tmp/.keep 13 | 14 | # Ignore uploaded files in development 15 | /storage/* 16 | !/storage/.keep 17 | 18 | /node_modules 19 | /yarn-error.log 20 | 21 | /public/assets 22 | .byebug_history 23 | 24 | # Ignore master key for decrypting credentials and more. 25 | /config/master.key 26 | 27 | manifest 28 | -------------------------------------------------------------------------------- /.github/workflows/linkchecker.yaml: -------------------------------------------------------------------------------- 1 | name: Check for Broken Markdown links 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - master 7 | schedule: 8 | # Run every Monday at 00:00 9 | - cron: "0 0 * * 1" 10 | 11 | jobs: 12 | markdown-link-check: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@master 16 | - uses: gaurav-nelson/github-action-markdown-link-check@v1 17 | with: 18 | use-quiet-mode: 'yes' 19 | use-verbose-mode: 'yes' 20 | config-file: '.mlc_config.json' -------------------------------------------------------------------------------- /jib/manifests/deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: hello 5 | spec: 6 | replicas: 1 7 | selector: 8 | matchLabels: 9 | app: hello 10 | template: 11 | metadata: 12 | labels: 13 | app: hello 14 | spec: 15 | securityContext: 16 | runAsUser: 1000 17 | runAsGroup: 1000 18 | fsGroup: 1000 19 | terminationGracePeriodSeconds: 0 20 | containers: 21 | - image: okteto/spring-boot-jib 22 | name: hello 23 | imagePullPolicy: Always -------------------------------------------------------------------------------- /rails/config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /jib/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | id 'eclipse' 4 | id 'idea' 5 | id 'org.springframework.boot' version '2.1.6.RELEASE' 6 | id 'io.spring.dependency-management' version '1.0.6.RELEASE' 7 | id 'com.google.cloud.tools.jib' version '1.4.0' 8 | } 9 | 10 | repositories { 11 | mavenCentral() 12 | } 13 | 14 | sourceCompatibility = 1.8 15 | targetCompatibility = 1.8 16 | 17 | jib.from.image = 'gcr.io/distroless/java' 18 | jib.to.image = 'okteto/spring-boot-jib' 19 | 20 | dependencies { 21 | compile('org.springframework.boot:spring-boot-starter-web') 22 | } -------------------------------------------------------------------------------- /rails/bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This file loads spring without using Bundler, in order to be fast. 4 | # It gets overwritten when you run the `spring binstub` command. 5 | 6 | unless defined?(Spring) 7 | require 'rubygems' 8 | require 'bundler' 9 | 10 | lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) 11 | spring = lockfile.specs.detect { |spec| spec.name == "spring" } 12 | if spring 13 | Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path 14 | gem 'spring', spring.version 15 | require 'spring/binstub' 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /php/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "okteto", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "private": true, 6 | "repository": "github.com/okteto/samples", 7 | "author": "Ramiro Berrelleza", 8 | "license": "MIT", 9 | "dependencies": { 10 | "webpack": "^4.41.3", 11 | "webpack-merge": "^4.2.2" 12 | }, 13 | "scripts": { 14 | "start": "yarn dev", 15 | "dev": "webpack --config=webpack.config.dev.js", 16 | "prod": "webpack --config=webpack.config.prod.js" 17 | }, 18 | "devDependencies": { 19 | "html-webpack-plugin": "^3.2.0", 20 | "webpack-cli": "^3.3.10" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /php/manifests/configmap.yaml: -------------------------------------------------------------------------------- 1 | kind: ConfigMap 2 | apiVersion: v1 3 | metadata: 4 | name: nginx-config 5 | labels: 6 | app.kubernetes.io/instance: php 7 | data: 8 | nginx.conf: | 9 | server { 10 | listen 80; 11 | index index.php index.html; 12 | server_name localhost; 13 | root /usr/share/nginx/html; 14 | 15 | location ~ \.php$ { 16 | include fastcgi_params; 17 | fastcgi_param REQUEST_METHOD $request_method; 18 | fastcgi_param SCRIPT_FILENAME /app/$fastcgi_script_name; 19 | fastcgi_pass php:9000; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /rails/k8s.yml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: blog 5 | spec: 6 | replicas: 1 7 | selector: 8 | matchLabels: 9 | app: blog 10 | template: 11 | metadata: 12 | labels: 13 | app: blog 14 | spec: 15 | terminationGracePeriodSeconds: 0 16 | containers: 17 | - image: ${OKTETO_BUILD_BLOG_IMAGE} 18 | name: blog 19 | 20 | --- 21 | 22 | apiVersion: v1 23 | kind: Service 24 | metadata: 25 | name: blog 26 | annotations: 27 | dev.okteto.com/auto-ingress: "true" 28 | spec: 29 | type: ClusterIP 30 | ports: 31 | - name: "blog" 32 | port: 8080 33 | selector: 34 | app: blog 35 | -------------------------------------------------------------------------------- /rails/app/views/articles/index.html.erb: -------------------------------------------------------------------------------- 1 |

Listing Articles

2 | <%= link_to 'New article', new_article_path %> 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | <% @articles.each do |article| %> 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | <% end %> 21 |
TitleText
<%= article.title %><%= article.text %><%= link_to 'Show', article_path(article) %><%= link_to 'Edit', edit_article_path(article) %><%= link_to 'Destroy', article_path(article), 17 | method: :delete, 18 | data: { confirm: 'Are you sure?' } %>
-------------------------------------------------------------------------------- /rails/config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path. 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | # Add Yarn node_modules folder to the asset load path. 9 | Rails.application.config.assets.paths << Rails.root.join('node_modules') 10 | 11 | # Precompile additional assets. 12 | # application.js, application.css, and all non-JS/CSS in the app/assets 13 | # folder are already added. 14 | # Rails.application.config.assets.precompile += %w( admin.js admin.css ) 15 | -------------------------------------------------------------------------------- /rails/config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | # 7 | default: &default 8 | adapter: sqlite3 9 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 10 | timeout: 5000 11 | 12 | development: 13 | <<: *default 14 | database: db/development.sqlite3 15 | 16 | # Warning: The database defined as "test" will be erased and 17 | # re-generated from your development database when you run "rake". 18 | # Do not set this db to the same as development or production. 19 | test: 20 | <<: *default 21 | database: db/test.sqlite3 22 | 23 | production: 24 | <<: *default 25 | database: db/production.sqlite3 26 | -------------------------------------------------------------------------------- /rails/config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /helm/chart/templates/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ include "mychart.fullname" . }} 5 | labels: 6 | app.kubernetes.io/name: {{ include "mychart.name" . }} 7 | helm.sh/chart: {{ include "mychart.chart" . }} 8 | app.kubernetes.io/instance: {{ .Release.Name }} 9 | app.kubernetes.io/managed-by: {{ .Release.Service }} 10 | annotations: 11 | dev.okteto.com/auto-ingress: "true" 12 | spec: 13 | type: {{ .Values.service.type }} 14 | ports: 15 | - port: {{ .Values.service.port }} 16 | targetPort: http 17 | protocol: TCP 18 | name: http 19 | selector: 20 | app.kubernetes.io/name: {{ include "mychart.name" . }} 21 | app.kubernetes.io/instance: {{ .Release.Name }} 22 | -------------------------------------------------------------------------------- /rails/config/application.rb: -------------------------------------------------------------------------------- 1 | require_relative 'boot' 2 | 3 | require 'rails/all' 4 | 5 | # Require the gems listed in Gemfile, including any gems 6 | # you've limited to :test, :development, or :production. 7 | Bundler.require(*Rails.groups) 8 | 9 | module Blog 10 | class Application < Rails::Application 11 | # Initialize configuration defaults for originally generated Rails version. 12 | config.load_defaults 5.2 13 | 14 | # Settings in config/environments/* take precedence over those specified here. 15 | # Application configuration can go into files in config/initializers 16 | # -- all .rb files in that directory are automatically loaded after loading 17 | # the framework and any gems in your application. 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /rails/app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's 6 | * vendor/assets/stylesheets directory can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS 10 | * files in this directory. Styles in this file should be added after the last require_* statement. 11 | * It is generally better to create a new file per style scope. 12 | * 13 | *= require_tree . 14 | *= require_self 15 | */ 16 | -------------------------------------------------------------------------------- /rails/app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's 5 | // vendor/assets/javascripts directory can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. JavaScript code in this file should be added after the last require_* statement. 9 | // 10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require rails-ujs 14 | //= require activestorage 15 | //= require turbolinks 16 | //= require_tree . 17 | -------------------------------------------------------------------------------- /rails/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | .bundle 9 | 10 | # Ignore the default SQLite database. 11 | *.sqlite3 12 | *.sqlite3-journal 13 | 14 | # Ignore all logfiles and tempfiles. 15 | /blog/log/* 16 | /blog/tmp/* 17 | !/blog/log/.keep 18 | !/blog/tmp/.keep 19 | 20 | # Ignore uploaded files in development 21 | /blog/storage/* 22 | !/blog/storage/.keep 23 | 24 | /blog/public/assets 25 | .byebug_history 26 | 27 | # Ignore master key for decrypting credentials and more. 28 | /blog/config/master.key 29 | -------------------------------------------------------------------------------- /rails/app/views/articles/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_with model: @article, local: true do |form| %> 2 | 3 | <% if @article.errors.any? %> 4 |
5 |

6 | <%= pluralize(@article.errors.count, "error") %> prohibited 7 | this article from being saved: 8 |

9 | 14 |
15 | <% end %> 16 | 17 |

18 | <%= form.label :title %>
19 | <%= form.text_field :title %> 20 |

21 | 22 |

23 | <%= form.label :text %>
24 | <%= form.text_area :text %> 25 |

26 | 27 |

28 | <%= form.submit %> 29 |

30 | 31 | <% end %> -------------------------------------------------------------------------------- /php/manifests/php.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: php 5 | labels: 6 | app.kubernetes.io/instance: php 7 | spec: 8 | replicas: 1 9 | selector: 10 | matchLabels: 11 | app: php 12 | template: 13 | metadata: 14 | labels: 15 | app: php 16 | spec: 17 | terminationGracePeriodSeconds: 0 18 | containers: 19 | - image: php:7-fpm 20 | imagePullPolicy: Always 21 | name: php 22 | workingDir: /app 23 | ports: 24 | - containerPort: 9000 25 | resources: 26 | requests: 27 | memory: "64Mi" 28 | cpu: "250m" 29 | limits: 30 | memory: "512Mi" 31 | cpu: "500m" 32 | 33 | --- 34 | 35 | apiVersion: v1 36 | kind: Service 37 | metadata: 38 | name: php 39 | spec: 40 | type: ClusterIP 41 | ports: 42 | - name: php 43 | port: 9000 44 | selector: 45 | app: php -------------------------------------------------------------------------------- /rails/bin/update: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'fileutils' 3 | include FileUtils 4 | 5 | # path to your application root. 6 | APP_ROOT = File.expand_path('..', __dir__) 7 | 8 | def system!(*args) 9 | system(*args) || abort("\n== Command #{args} failed ==") 10 | end 11 | 12 | chdir APP_ROOT do 13 | # This script is a way to update your development container automatically. 14 | # Add necessary update steps to this file. 15 | 16 | puts '== Installing dependencies ==' 17 | system! 'gem install bundler --conservative' 18 | system('bundle check') || system!('bundle install') 19 | 20 | # Install JavaScript dependencies if using Yarn 21 | # system('bin/yarn') 22 | 23 | puts "\n== Updating database ==" 24 | system! 'bin/rails db:migrate' 25 | 26 | puts "\n== Removing old logs and tempfiles ==" 27 | system! 'bin/rails log:clear tmp:clear' 28 | 29 | puts "\n== Restarting application server ==" 30 | system! 'bin/rails restart' 31 | end 32 | -------------------------------------------------------------------------------- /rails/config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # The following keys must be escaped otherwise they will not be retrieved by 20 | # the default I18n backend: 21 | # 22 | # true, false, on, off, yes, no 23 | # 24 | # Instead, surround them with single quotes. 25 | # 26 | # en: 27 | # 'true': 'foo' 28 | # 29 | # To learn more, please read the Rails Internationalization guide 30 | # available at http://guides.rubyonrails.org/i18n.html. 31 | 32 | en: 33 | hello: "Hello world" 34 | -------------------------------------------------------------------------------- /rails/db/schema.rb: -------------------------------------------------------------------------------- 1 | # This file is auto-generated from the current state of the database. Instead 2 | # of editing this file, please use the migrations feature of Active Record to 3 | # incrementally modify your database, and then regenerate this schema definition. 4 | # 5 | # Note that this schema.rb definition is the authoritative source for your 6 | # database schema. If you need to create the application database on another 7 | # system, you should be using db:schema:load, not running all the migrations 8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations 9 | # you'll amass, the slower it'll run and the greater likelihood for issues). 10 | # 11 | # It's strongly recommended that you check this file into your version control system. 12 | 13 | ActiveRecord::Schema.define(version: 2019_06_05_024043) do 14 | 15 | create_table "articles", force: :cascade do |t| 16 | t.string "title" 17 | t.text "text" 18 | t.datetime "created_at", null: false 19 | t.datetime "updated_at", null: false 20 | end 21 | 22 | end 23 | -------------------------------------------------------------------------------- /rails/bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'fileutils' 3 | include FileUtils 4 | 5 | # path to your application root. 6 | APP_ROOT = File.expand_path('..', __dir__) 7 | 8 | def system!(*args) 9 | system(*args) || abort("\n== Command #{args} failed ==") 10 | end 11 | 12 | chdir APP_ROOT do 13 | # This script is a starting point to setup your application. 14 | # Add necessary setup steps to this file. 15 | 16 | puts '== Installing dependencies ==' 17 | system! 'gem install bundler --conservative' 18 | system('bundle check') || system!('bundle install') 19 | 20 | # Install JavaScript dependencies if using Yarn 21 | # system('bin/yarn') 22 | 23 | # puts "\n== Copying sample files ==" 24 | # unless File.exist?('config/database.yml') 25 | # cp 'config/database.yml.sample', 'config/database.yml' 26 | # end 27 | 28 | puts "\n== Preparing database ==" 29 | system! 'bin/rails db:setup' 30 | 31 | puts "\n== Removing old logs and tempfiles ==" 32 | system! 'bin/rails log:clear tmp:clear' 33 | 34 | puts "\n== Restarting application server ==" 35 | system! 'bin/rails restart' 36 | end 37 | -------------------------------------------------------------------------------- /rails/app/controllers/articles_controller.rb: -------------------------------------------------------------------------------- 1 | class ArticlesController < ApplicationController 2 | def index 3 | @articles = Article.all 4 | end 5 | 6 | def show 7 | @article = Article.find(params[:id]) 8 | end 9 | 10 | def new 11 | @article = Article.new 12 | end 13 | 14 | def edit 15 | @article = Article.find(params[:id]) 16 | end 17 | 18 | def create 19 | @article = Article.new(article_params) 20 | 21 | if @article.save 22 | redirect_to @article 23 | else 24 | render 'new' 25 | end 26 | end 27 | 28 | def update 29 | @article = Article.find(params[:id]) 30 | 31 | if @article.update(article_params) 32 | redirect_to @article 33 | else 34 | render 'edit' 35 | end 36 | end 37 | 38 | def destroy 39 | @article = Article.find(params[:id]) 40 | @article.destroy 41 | 42 | redirect_to articles_path 43 | end 44 | 45 | private 46 | def article_params 47 | params.require(:article).permit(:title, :text) 48 | end 49 | end -------------------------------------------------------------------------------- /helm/chart/templates/_helpers.tpl: -------------------------------------------------------------------------------- 1 | {{/* vim: set filetype=mustache: */}} 2 | {{/* 3 | Expand the name of the chart. 4 | */}} 5 | {{- define "mychart.name" -}} 6 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} 7 | {{- end -}} 8 | 9 | {{/* 10 | Create a default fully qualified app name. 11 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). 12 | If release name contains chart name it will be used as a full name. 13 | */}} 14 | {{- define "mychart.fullname" -}} 15 | {{- if .Values.fullnameOverride -}} 16 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} 17 | {{- else -}} 18 | {{- $name := default .Chart.Name .Values.nameOverride -}} 19 | {{- if contains $name .Release.Name -}} 20 | {{- .Release.Name | trunc 63 | trimSuffix "-" -}} 21 | {{- else -}} 22 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} 23 | {{- end -}} 24 | {{- end -}} 25 | {{- end -}} 26 | 27 | {{/* 28 | Create chart name and version as used by the chart label. 29 | */}} 30 | {{- define "mychart.chart" -}} 31 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} 32 | {{- end -}} 33 | -------------------------------------------------------------------------------- /rails/config/initializers/content_security_policy.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Define an application-wide content security policy 4 | # For further information see the following documentation 5 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy 6 | 7 | # Rails.application.config.content_security_policy do |policy| 8 | # policy.default_src :self, :https 9 | # policy.font_src :self, :https, :data 10 | # policy.img_src :self, :https, :data 11 | # policy.object_src :none 12 | # policy.script_src :self, :https 13 | # policy.style_src :self, :https 14 | 15 | # # Specify URI for violation reports 16 | # # policy.report_uri "/csp-violation-report-endpoint" 17 | # end 18 | 19 | # If you are using UJS then enable automatic nonce generation 20 | # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } 21 | 22 | # Report CSP violations to a specified URI 23 | # For further information see the following documentation: 24 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only 25 | # Rails.application.config.content_security_policy_report_only = true 26 | -------------------------------------------------------------------------------- /rails/config/storage.yml: -------------------------------------------------------------------------------- 1 | test: 2 | service: Disk 3 | root: <%= Rails.root.join("tmp/storage") %> 4 | 5 | local: 6 | service: Disk 7 | root: <%= Rails.root.join("storage") %> 8 | 9 | # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) 10 | # amazon: 11 | # service: S3 12 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> 13 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> 14 | # region: us-east-1 15 | # bucket: your_own_bucket 16 | 17 | # Remember not to checkin your GCS keyfile to a repository 18 | # google: 19 | # service: GCS 20 | # project: your_project 21 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> 22 | # bucket: your_own_bucket 23 | 24 | # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) 25 | # microsoft: 26 | # service: AzureStorage 27 | # storage_account_name: your_account_name 28 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> 29 | # container: your_container_name 30 | 31 | # mirror: 32 | # service: Mirror 33 | # primary: local 34 | # mirrors: [ amazon, google, microsoft ] 35 | -------------------------------------------------------------------------------- /php/manifests/web.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: web 5 | labels: 6 | app.kubernetes.io/instance: php 7 | spec: 8 | replicas: 1 9 | selector: 10 | matchLabels: 11 | app: web 12 | template: 13 | metadata: 14 | labels: 15 | app: web 16 | spec: 17 | terminationGracePeriodSeconds: 0 18 | containers: 19 | - image: nginx:alpine 20 | imagePullPolicy: Always 21 | name: web 22 | ports: 23 | - containerPort: 80 24 | volumeMounts: 25 | - name: nginx-config 26 | mountPath: /etc/nginx/conf.d 27 | resources: 28 | requests: 29 | memory: "64Mi" 30 | cpu: "250m" 31 | limits: 32 | memory: "512Mi" 33 | cpu: "500m" 34 | # Load the configuration files for nginx 35 | volumes: 36 | - name: nginx-config 37 | configMap: 38 | name: nginx-config 39 | 40 | --- 41 | 42 | apiVersion: v1 43 | kind: Service 44 | metadata: 45 | name: web 46 | annotations: 47 | dev.okteto.com/auto-ingress: "true" 48 | spec: 49 | type: ClusterIP 50 | ports: 51 | - name: web 52 | port: 80 53 | selector: 54 | app: web -------------------------------------------------------------------------------- /coder/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM codercom/ubuntu-dev:latest as sail 2 | 3 | # Using official python runtime base image 4 | FROM codercom/code-server as dev 5 | 6 | WORKDIR /home/coder/project/ 7 | # copy vscode extension installer 8 | COPY --from=sail /usr/bin/installext /usr/bin/installext 9 | 10 | # install vscode extensions 11 | RUN installext vscodevim.vim 12 | RUN installext ms-python.python 13 | 14 | # install python 3.7 15 | RUN sudo apt-get -y update && sudo apt-get -y install python3.7 python3-pip 16 | RUN sudo ln /usr/bin/python3 /usr/bin/python 17 | RUN sudo ln /usr/bin/pip3 /usr/bin/pip 18 | 19 | # install pip requirements 20 | ADD --chown=coder:coder requirements.txt requirements.txt 21 | RUN pip install -r requirements.txt 22 | 23 | ################################################################################# 24 | 25 | # Using official python runtime base image 26 | FROM python:3-slim 27 | 28 | # Set the application directory 29 | WORKDIR /src 30 | 31 | RUN pip install --upgrade pip 32 | 33 | # Install our requirements.txt 34 | ADD requirements.txt requirements.txt 35 | RUN pip install -r requirements.txt 36 | 37 | # Copy our code from the current folder to /app inside the container 38 | ADD . /src 39 | 40 | # Make port 8080 available for links and/or publish 41 | EXPOSE 8080 42 | 43 | # Define our command to be run when launching the container 44 | CMD ["python", "app.py"] 45 | -------------------------------------------------------------------------------- /coder/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{option_a}} vs {{option_b}}! 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |

{{option_a}} vs {{option_b}}!

17 |
18 | 19 | 20 |
21 |

{{votes_a}} vs {{votes_b}}

22 |
23 |

Processed by {{namespace}}\{{hostname}}

24 |
25 |
26 |
27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /helm/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{option_a}} vs {{option_b}}! 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |

{{option_a}} vs {{option_b}}!

17 |
18 | 19 | 20 |
21 |

{{votes_a}} vs {{votes_b}}

22 |
23 |

Processed by {{namespace}}\{{hostname}}

24 |
25 |
26 |
27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /rails/.stignore: -------------------------------------------------------------------------------- 1 | /.git 2 | /*.gem 3 | /*.rbc 4 | /.config 5 | /coverage 6 | /InstalledFiles 7 | /pkg 8 | /spec/reports 9 | /spec/examples.txt 10 | /test/tmp 11 | /test/version_tmp 12 | /tmp 13 | 14 | # Used by dotenv library to load environment variables. 15 | # .env 16 | 17 | # Ignore Byebug command history file. 18 | /.byebug_history 19 | 20 | ## Specific to RubyMotion: 21 | /.dat* 22 | /.repl_history 23 | /build 24 | /*.bridgesupport 25 | /build-iPhoneOS 26 | /build-iPhoneSimulator 27 | 28 | ## Specific to RubyMotion (use of CocoaPods): 29 | # 30 | # We recommend against adding the Pods directory to your .gitignore. However 31 | # you should judge for yourself, the pros and cons are mentioned at: 32 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 33 | # 34 | # vendor/Pods/ 35 | 36 | ## Documentation cache and generated files: 37 | /.yardoc 38 | /_yardoc 39 | /doc 40 | /rdoc 41 | 42 | ## Environment normalization: 43 | /.bundle 44 | /vendor/bundle 45 | /lib/bundler/man 46 | 47 | # for a library or gem, you might want to ignore these files since the code is 48 | # intended to run in multiple environments; otherwise, check them in: 49 | # Gemfile.lock 50 | # .ruby-version 51 | # .ruby-gemset 52 | 53 | # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: 54 | /.rvmrc 55 | /manifests 56 | 57 | # Ignore the default SQLite database. 58 | /db/*.sqlite3 59 | /db/*.sqlite3-journal 60 | 61 | /tmp/* -------------------------------------------------------------------------------- /rails/config/puma.rb: -------------------------------------------------------------------------------- 1 | # Puma can serve each request in a thread from an internal thread pool. 2 | # The `threads` method setting takes two numbers: a minimum and maximum. 3 | # Any libraries that use thread pools should be configured to match 4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum 5 | # and maximum; this matches the default thread size of Active Record. 6 | # 7 | threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } 8 | threads threads_count, threads_count 9 | 10 | # Specifies the `bind` that Puma will listen on to receive requests; default is 0.0.0.0:8080. 11 | # 12 | bind 'tcp://0.0.0.0:8080' 13 | 14 | # Specifies the `environment` that Puma will run in. 15 | # 16 | environment ENV.fetch("RAILS_ENV") { "development" } 17 | 18 | # Specifies the number of `workers` to boot in clustered mode. 19 | # Workers are forked webserver processes. If using threads and workers together 20 | # the concurrency of the application would be max `threads` * `workers`. 21 | # Workers do not work on JRuby or Windows (both of which do not support 22 | # processes). 23 | # 24 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 25 | 26 | # Use the `preload_app!` method when specifying a `workers` number. 27 | # This directive tells Puma to first boot the application and load code 28 | # before forking the application. This takes advantage of Copy On Write 29 | # process behavior so workers use less memory. 30 | # 31 | # preload_app! 32 | 33 | # Allow puma to be restarted by `rails restart` command. 34 | plugin :tmp_restart 35 | -------------------------------------------------------------------------------- /helm/app.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template, request, make_response, g 2 | import os 3 | import socket 4 | import random 5 | import json 6 | import collections 7 | 8 | hostname = socket.gethostname() 9 | votes = collections.defaultdict(int) 10 | 11 | app = Flask(__name__) 12 | 13 | def getOptions(): 14 | option_a = 'Cats' 15 | option_b = 'Dogs' 16 | return option_a, option_b 17 | 18 | @app.route("/", methods=['POST','GET']) 19 | def hello(): 20 | vote = None 21 | option_a, option_b = getOptions() 22 | if request.method == 'POST': 23 | vote = request.form['vote'] 24 | vote = option_a if vote == "a" else option_b 25 | votes[vote] = votes[vote] + 1 26 | with open('/var/run/secrets/kubernetes.io/serviceaccount/namespace', 'r') as fp: 27 | namespace = fp.read() 28 | 29 | resp = make_response(render_template( 30 | 'index.html', 31 | option_a=option_a, 32 | option_b=option_b, 33 | hostname=hostname, 34 | namespace=namespace, 35 | votes_a=votes[option_a], 36 | votes_b=votes[option_b], 37 | )) 38 | return resp 39 | 40 | 41 | if __name__ == "__main__": 42 | extra_files = [] 43 | if "development" == os.getenv("FLASK_ENV"): 44 | app.jinja_env.auto_reload = True 45 | app.config['TEMPLATES_AUTO_RELOAD'] = True 46 | extra_files=[ 47 | "./static/stylesheets/style.css" 48 | ] 49 | 50 | app.run( 51 | host='0.0.0.0', 52 | port=8080, 53 | extra_files=extra_files 54 | ) 55 | -------------------------------------------------------------------------------- /helm/chart/templates/deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: {{ include "mychart.fullname" . }} 5 | labels: 6 | app.kubernetes.io/name: {{ include "mychart.name" . }} 7 | helm.sh/chart: {{ include "mychart.chart" . }} 8 | app.kubernetes.io/instance: {{ .Release.Name }} 9 | app.kubernetes.io/managed-by: {{ .Release.Service }} 10 | spec: 11 | replicas: {{ .Values.replicaCount }} 12 | selector: 13 | matchLabels: 14 | app.kubernetes.io/name: {{ include "mychart.name" . }} 15 | app.kubernetes.io/instance: {{ .Release.Name }} 16 | template: 17 | metadata: 18 | labels: 19 | app.kubernetes.io/name: {{ include "mychart.name" . }} 20 | app.kubernetes.io/instance: {{ .Release.Name }} 21 | spec: 22 | terminationGracePeriodSeconds: 0 23 | containers: 24 | - name: {{ .Chart.Name }} 25 | image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" 26 | imagePullPolicy: {{ .Values.image.pullPolicy }} 27 | ports: 28 | - name: http 29 | containerPort: 8080 30 | protocol: TCP 31 | livenessProbe: 32 | httpGet: 33 | path: / 34 | port: http 35 | readinessProbe: 36 | httpGet: 37 | path: / 38 | port: http 39 | resources: 40 | {{ toYaml .Values.resources | indent 12 }} 41 | {{- with .Values.nodeSelector }} 42 | nodeSelector: 43 | {{ toYaml . | indent 8 }} 44 | {{- end }} 45 | {{- with .Values.affinity }} 46 | affinity: 47 | {{ toYaml . | indent 8 }} 48 | {{- end }} 49 | {{- with .Values.tolerations }} 50 | tolerations: 51 | {{ toYaml . | indent 8 }} 52 | {{- end }} 53 | -------------------------------------------------------------------------------- /rails/public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /rails/public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

Maybe you tried to change something you didn't have access to.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /rails/public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

You may have mistyped the address or the page may have moved.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /rails/config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure public file server for tests with Cache-Control for performance. 16 | config.public_file_server.enabled = true 17 | config.public_file_server.headers = { 18 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}" 19 | } 20 | 21 | # Show full error reports and disable caching. 22 | config.consider_all_requests_local = true 23 | config.action_controller.perform_caching = false 24 | 25 | # Raise exceptions instead of rendering exception templates. 26 | config.action_dispatch.show_exceptions = false 27 | 28 | # Disable request forgery protection in test environment. 29 | config.action_controller.allow_forgery_protection = false 30 | 31 | # Store uploaded files on the local file system in a temporary directory 32 | config.active_storage.service = :test 33 | 34 | config.action_mailer.perform_caching = false 35 | 36 | # Tell Action Mailer not to deliver emails to the real world. 37 | # The :test delivery method accumulates sent emails in the 38 | # ActionMailer::Base.deliveries array. 39 | config.action_mailer.delivery_method = :test 40 | 41 | # Print deprecation notices to the stderr. 42 | config.active_support.deprecation = :stderr 43 | 44 | # Raises error for missing translations 45 | # config.action_view.raise_on_missing_translations = true 46 | end 47 | -------------------------------------------------------------------------------- /coder/app.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template, request, make_response, g 2 | from redis import Redis, RedisError 3 | 4 | import os 5 | import socket 6 | import random 7 | import json 8 | import collections 9 | 10 | hostname = socket.gethostname() 11 | 12 | redis = Redis(host="redis", db=0) 13 | app = Flask(__name__) 14 | 15 | def getOptions(): 16 | option_a = 'Cats' 17 | option_b = 'Dogs' 18 | return option_a, option_b 19 | 20 | @app.route("/", methods=['POST','GET']) 21 | def hello(): 22 | option_a, option_b = getOptions() 23 | 24 | try: 25 | votesA = int(redis.get(option_a) or 0) 26 | votesB = int(redis.get(option_b) or 0) 27 | except RedisError: 28 | votesA = "cannot connect to Redis, counter disabled" 29 | votesB = "cannot connect to Redis, counter disabled" 30 | 31 | if request.method == 'POST': 32 | try: 33 | vote = request.form['vote'] 34 | if vote == "a": 35 | votesA = redis.incr(option_a) 36 | else: 37 | votesB = redis.incr(option_b) 38 | except Exception as e: 39 | print(e) 40 | votesA = "An error occured" 41 | votesB = "An error occured" 42 | 43 | with open('/var/run/secrets/kubernetes.io/serviceaccount/namespace', 'r') as fp: 44 | namespace = fp.read() 45 | 46 | resp = make_response(render_template( 47 | 'index.html', 48 | option_a=option_a, 49 | option_b=option_b, 50 | hostname=hostname, 51 | namespace=namespace, 52 | votes_a=votesA, 53 | votes_b=votesB, 54 | )) 55 | return resp 56 | 57 | 58 | if __name__ == "__main__": 59 | extra_files = [] 60 | if "development" == os.getenv("FLASK_ENV"): 61 | app.jinja_env.auto_reload = True 62 | app.config['TEMPLATES_AUTO_RELOAD'] = True 63 | extra_files=[ 64 | "./static/stylesheets/style.css" 65 | ] 66 | 67 | app.run( 68 | host='0.0.0.0', 69 | port=8080, 70 | extra_files=extra_files 71 | ) 72 | -------------------------------------------------------------------------------- /rails/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 | 4 | ruby '2.6.2' 5 | 6 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 7 | gem 'rails', '~> 5.2.3' 8 | # Use sqlite3 as the database for Active Record 9 | gem 'sqlite3' 10 | # Use Puma as the app server 11 | gem 'puma', '~> 3.12' 12 | # Use SCSS for stylesheets 13 | gem 'sass-rails', '~> 5.0' 14 | # Use Uglifier as compressor for JavaScript assets 15 | gem 'uglifier', '>= 1.3.0' 16 | # See https://github.com/rails/execjs#readme for more supported runtimes 17 | gem 'mini_racer', platforms: :ruby 18 | 19 | # Use CoffeeScript for .coffee assets and views 20 | gem 'coffee-rails', '~> 4.2' 21 | # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 22 | gem 'turbolinks', '~> 5' 23 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 24 | gem 'jbuilder', '~> 2.5' 25 | # Use Redis adapter to run Action Cable in production 26 | # gem 'redis', '~> 4.0' 27 | # Use ActiveModel has_secure_password 28 | # gem 'bcrypt', '~> 3.1.7' 29 | 30 | # Use ActiveStorage variant 31 | # gem 'mini_magick', '~> 4.8' 32 | 33 | # Use Capistrano for deployment 34 | # gem 'capistrano-rails', group: :development 35 | 36 | # Reduces boot times through caching; required in config/boot.rb 37 | gem 'bootsnap', '>= 1.1.0', require: false 38 | 39 | group :development, :test do 40 | # Call 'byebug' anywhere in the code to stop execution and get a debugger console 41 | gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 42 | end 43 | 44 | group :development do 45 | # Access an interactive console on exception pages or by calling 'console' anywhere in the code. 46 | gem 'web-console', '>= 3.3.0' 47 | gem 'listen', '>= 3.0.5', '< 3.2' 48 | # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 49 | gem 'spring' 50 | gem 'spring-watcher-listen', '~> 2.0.0' 51 | end 52 | 53 | group :test do 54 | # Adds support for Capybara system testing and selenium driver 55 | gem 'capybara', '>= 2.15' 56 | gem 'selenium-webdriver' 57 | # Easy installation and use of chromedriver to run system tests with Chrome 58 | gem 'chromedriver-helper' 59 | end 60 | 61 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 62 | gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 63 | -------------------------------------------------------------------------------- /rails/config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development container your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports. 13 | config.consider_all_requests_local = true 14 | 15 | # Enable/disable caching. By default caching is disabled. 16 | # Run rails dev:cache to toggle caching. 17 | if Rails.root.join('tmp', 'caching-dev.txt').exist? 18 | config.action_controller.perform_caching = true 19 | 20 | config.cache_store = :memory_store 21 | config.public_file_server.headers = { 22 | 'Cache-Control' => "public, max-age=#{2.days.to_i}" 23 | } 24 | else 25 | config.action_controller.perform_caching = false 26 | 27 | config.cache_store = :null_store 28 | end 29 | 30 | # Store uploaded files on the local file system (see config/storage.yml for options) 31 | config.active_storage.service = :local 32 | 33 | # Don't care if the mailer can't send. 34 | config.action_mailer.raise_delivery_errors = false 35 | 36 | config.action_mailer.perform_caching = false 37 | 38 | # Print deprecation notices to the Rails logger. 39 | config.active_support.deprecation = :log 40 | 41 | # Raise an error on page load if there are pending migrations. 42 | config.active_record.migration_error = :page_load 43 | 44 | # Highlight code that triggered database queries in logs. 45 | config.active_record.verbose_query_logs = true 46 | 47 | # Debug mode disables concatenation and preprocessing of assets. 48 | # This option may cause significant delays in view rendering with a large 49 | # number of complex assets. 50 | config.assets.debug = true 51 | 52 | # Suppress logger output for asset requests. 53 | config.assets.quiet = true 54 | 55 | # Raises error for missing translations 56 | # config.action_view.raise_on_missing_translations = true 57 | 58 | # Use an evented file watcher to asynchronously detect changes in source code, 59 | # routes, locales, etc. This feature depends on the listen gem. 60 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker 61 | end 62 | -------------------------------------------------------------------------------- /coder/static/stylesheets/style.css: -------------------------------------------------------------------------------- 1 | @import url(//fonts.googleapis.com/css?family=Open+Sans:400,700,600); 2 | 3 | *{ 4 | box-sizing:border-box; 5 | } 6 | html,body{ 7 | margin: 0; 8 | padding: 0; 9 | background-color: #F7F8F9; 10 | height: 100vh; 11 | font-family: 'Open Sans'; 12 | } 13 | 14 | button{ 15 | border-radius: 0; 16 | width: 100%; 17 | height: 50%; 18 | } 19 | 20 | button[type="submit"] { 21 | -webkit-appearance:none; -webkit-border-radius:0; 22 | } 23 | 24 | button i{ 25 | float: right; 26 | padding-right: 30px; 27 | margin-top: 3px; 28 | } 29 | 30 | button.a{ 31 | background-color: #1aaaf8; 32 | } 33 | 34 | button.b{ 35 | background-color: #00cbca; 36 | } 37 | 38 | #tip{ 39 | text-align: left; 40 | color: #c0c9ce; 41 | font-size: 14px; 42 | } 43 | 44 | #hostname{ 45 | position: absolute; 46 | top: 50%; 47 | right: 0; 48 | left: 0; 49 | color: #8f9ea8; 50 | font-size: 24px; 51 | } 52 | 53 | #content-container{ 54 | z-index: 2; 55 | position: relative; 56 | margin: 0 auto; 57 | display: table; 58 | padding: 10px; 59 | max-width: 940px; 60 | height: 100%; 61 | } 62 | #content-container-center{ 63 | display: table-cell; 64 | text-align: center; 65 | } 66 | 67 | #content-container-center h3{ 68 | color: #254356; 69 | } 70 | 71 | #choice{ 72 | transition: all 300ms linear; 73 | line-height: 1.3em; 74 | display: inline; 75 | vertical-align: middle; 76 | font-size: 3em; 77 | } 78 | #choice a{ 79 | text-decoration:none; 80 | } 81 | #choice a:hover, #choice a:focus{ 82 | outline:0; 83 | text-decoration:underline; 84 | } 85 | 86 | #choice button{ 87 | display: block; 88 | height: 80px; 89 | width: 330px; 90 | border: none; 91 | color: white; 92 | text-transform: uppercase; 93 | font-size:18px; 94 | font-weight: 700; 95 | margin-top: 10px; 96 | margin-bottom: 10px; 97 | text-align: left; 98 | padding-left: 50px; 99 | } 100 | 101 | #choice button.a:hover{ 102 | background-color: #1488c6; 103 | } 104 | 105 | #choice button.b:hover{ 106 | background-color: #00a2a1; 107 | } 108 | 109 | #choice button.a:focus{ 110 | background-color: #1488c6; 111 | } 112 | 113 | #choice button.b:focus{ 114 | background-color: #00a2a1; 115 | } 116 | 117 | #background-stats{ 118 | z-index:1; 119 | height:100%; 120 | width:100%; 121 | position:absolute; 122 | } 123 | #background-stats div{ 124 | transition: width 400ms ease-in-out; 125 | display:inline-block; 126 | margin-bottom:-4px; 127 | width:50%; 128 | height:100%; 129 | } 130 | -------------------------------------------------------------------------------- /helm/static/stylesheets/style.css: -------------------------------------------------------------------------------- 1 | @import url(//fonts.googleapis.com/css?family=Open+Sans:400,700,600); 2 | 3 | *{ 4 | box-sizing:border-box; 5 | } 6 | html,body{ 7 | margin: 0; 8 | padding: 0; 9 | background-color: #F7F8F9; 10 | height: 100vh; 11 | font-family: 'Open Sans'; 12 | } 13 | 14 | button{ 15 | border-radius: 0; 16 | width: 100%; 17 | height: 50%; 18 | } 19 | 20 | button[type="submit"] { 21 | -webkit-appearance:none; -webkit-border-radius:0; 22 | } 23 | 24 | button i{ 25 | float: right; 26 | padding-right: 30px; 27 | margin-top: 3px; 28 | } 29 | 30 | button.a{ 31 | background-color: #1aaaf8; 32 | } 33 | 34 | button.b{ 35 | background-color: #00cbca; 36 | } 37 | 38 | #tip{ 39 | text-align: left; 40 | color: #c0c9ce; 41 | font-size: 14px; 42 | } 43 | 44 | #hostname{ 45 | position: absolute; 46 | top: 50%; 47 | right: 0; 48 | left: 0; 49 | color: #8f9ea8; 50 | font-size: 24px; 51 | } 52 | 53 | #content-container{ 54 | z-index: 2; 55 | position: relative; 56 | margin: 0 auto; 57 | display: table; 58 | padding: 10px; 59 | max-width: 940px; 60 | height: 100%; 61 | } 62 | #content-container-center{ 63 | display: table-cell; 64 | text-align: center; 65 | } 66 | 67 | #content-container-center h3{ 68 | color: #254356; 69 | } 70 | 71 | #choice{ 72 | transition: all 300ms linear; 73 | line-height: 1.3em; 74 | display: inline; 75 | vertical-align: middle; 76 | font-size: 3em; 77 | } 78 | #choice a{ 79 | text-decoration:none; 80 | } 81 | #choice a:hover, #choice a:focus{ 82 | outline:0; 83 | text-decoration:underline; 84 | } 85 | 86 | #choice button{ 87 | display: block; 88 | height: 80px; 89 | width: 330px; 90 | border: none; 91 | color: white; 92 | text-transform: uppercase; 93 | font-size:18px; 94 | font-weight: 700; 95 | margin-top: 10px; 96 | margin-bottom: 10px; 97 | text-align: left; 98 | padding-left: 50px; 99 | } 100 | 101 | #choice button.a:hover{ 102 | background-color: #1488c6; 103 | } 104 | 105 | #choice button.b:hover{ 106 | background-color: #00a2a1; 107 | } 108 | 109 | #choice button.a:focus{ 110 | background-color: #1488c6; 111 | } 112 | 113 | #choice button.b:focus{ 114 | background-color: #00a2a1; 115 | } 116 | 117 | #background-stats{ 118 | z-index:1; 119 | height:100%; 120 | width:100%; 121 | position:absolute; 122 | } 123 | #background-stats div{ 124 | transition: width 400ms ease-in-out; 125 | display:inline-block; 126 | margin-bottom:-4px; 127 | width:50%; 128 | height:100%; 129 | } 130 | -------------------------------------------------------------------------------- /rails/README.md: -------------------------------------------------------------------------------- 1 | # Ruby on Rails Sample App 2 | 3 | This example shows how to leverage [Okteto](https://github.com/okteto/okteto) to develop a Ruby on Rails Sample App directly in the cloud. The Ruby on Rails Sample App is deployed using raw Kubernetes manifests. 4 | 5 | Okteto works in any Kubernetes cluster by reading your local Kubernetes credentials. For a empowered experience, follow this [guide](https://okteto.com/docs/samples/ruby/) to deploy the Ruby on Rails Sample App in [Okteto Cloud](https://cloud.okteto.com), a free-trial Kubernetes cluster. 6 | 7 | ## Step 1: Install the Okteto CLI 8 | 9 | Install the Okteto CLI by following our [installation guides](https://www.okteto.com/docs/getting-started/). 10 | 11 | ## Step 2: Clone the Rails Sample App 12 | 13 | Clone the repository and go to the rails-kubectl folder. 14 | 15 | ```console 16 | $ git clone https://github.com/okteto/samples 17 | $ cd samples/ruby 18 | ``` 19 | 20 | ## Step 3: Cloud Native Development 21 | 22 | In order to activate your Cloud Native Development, execute: 23 | 24 | ```console 25 | $ okteto up 26 | ✓ Development container activated 27 | ✓ Files synchronized 28 | Namespace: cindy 29 | Name: blog 30 | Forward: 8080 -> 8080 31 | 32 | root@blog-545d954cd5-96fh2:/usr/src/app# 33 | ``` 34 | 35 | The `okteto up` command will start a development container that automatically synchronizes and applies your code changes without rebuilding containers. The development container already includes the ruby dev tools, and will automatically forward port 8080 to your local machine. 36 | 37 | Now execute the command below in the Okteto terminal. The command will start your service and reload it automatically after every successful change. 38 | 39 | ```console 40 | $ rails s 41 | ``` 42 | 43 | Once the server is running, browse to the application at http://localhost:8080 and you'll see an error message similar to this one in your browser: 44 | ```console 45 | Migrations are pending. To resolve this issue, run: bin/rails db:migrate RAILS_ENV=development 46 | ``` 47 | 48 | This is because we have a migration pending. Press `ctrl + c` and run the following commands from your terminal: 49 | 50 | ```console 51 | $ rails db:migrate 52 | $ rails s 53 | ``` 54 | 55 | Notice that even though you don't have the application running locally (and you don't have rails installed), the command still runs successfully. This is because okteto is running the command directly in your development container in the browser! 56 | 57 | Browse again to your application, it should load without any issues. At this point, you have a web application that can create, show, list, update and destroy articles. 58 | 59 | To keep testing the power of cloud native development, continue with the rest of the [getting started guide](https://guides.rubyonrails.org/getting_started.html#adding-a-second-model). Keep creating and editing files in your IDE. 60 | -------------------------------------------------------------------------------- /rails/config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # Eager load code on boot. This eager loads most of Rails and 8 | # your application in memory, allowing both threaded web servers 9 | # and those relying on copy on write to perform better. 10 | # Rake tasks automatically ignore this option for performance. 11 | config.eager_load = true 12 | 13 | # Full error reports are disabled and caching is turned on. 14 | config.consider_all_requests_local = false 15 | config.action_controller.perform_caching = true 16 | 17 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] 18 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). 19 | # config.require_master_key = true 20 | 21 | # Disable serving static files from the `/public` folder by default since 22 | # Apache or NGINX already handles this. 23 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? 24 | 25 | # Compress JavaScripts and CSS. 26 | config.assets.js_compressor = :uglifier 27 | # config.assets.css_compressor = :sass 28 | 29 | # Do not fallback to assets pipeline if a precompiled asset is missed. 30 | config.assets.compile = false 31 | 32 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 33 | 34 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 35 | # config.action_controller.asset_host = 'http://assets.example.com' 36 | 37 | # Specifies the header that your server uses for sending files. 38 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 39 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 40 | 41 | # Store uploaded files on the local file system (see config/storage.yml for options) 42 | config.active_storage.service = :local 43 | 44 | # Mount Action Cable outside main process or domain 45 | # config.action_cable.mount_path = nil 46 | # config.action_cable.url = 'wss://example.com/cable' 47 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] 48 | 49 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 50 | # config.force_ssl = true 51 | 52 | # Use the lowest log level to ensure availability of diagnostic information 53 | # when problems arise. 54 | config.log_level = :debug 55 | 56 | # Prepend all log lines with the following tags. 57 | config.log_tags = [ :request_id ] 58 | 59 | # Use a different cache store in production. 60 | # config.cache_store = :mem_cache_store 61 | 62 | # Use a real queuing backend for Active Job (and separate queues per environment) 63 | # config.active_job.queue_adapter = :resque 64 | # config.active_job.queue_name_prefix = "blog_#{Rails.env}" 65 | 66 | config.action_mailer.perform_caching = false 67 | 68 | # Ignore bad email addresses and do not raise email delivery errors. 69 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 70 | # config.action_mailer.raise_delivery_errors = false 71 | 72 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 73 | # the I18n.default_locale when a translation cannot be found). 74 | config.i18n.fallbacks = true 75 | 76 | # Send deprecation notices to registered listeners. 77 | config.active_support.deprecation = :notify 78 | 79 | # Use default logging formatter so that PID and timestamp are not suppressed. 80 | config.log_formatter = ::Logger::Formatter.new 81 | 82 | # Use a different logger for distributed setups. 83 | # require 'syslog/logger' 84 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') 85 | 86 | if ENV["RAILS_LOG_TO_STDOUT"].present? 87 | logger = ActiveSupport::Logger.new(STDOUT) 88 | logger.formatter = config.log_formatter 89 | config.logger = ActiveSupport::TaggedLogging.new(logger) 90 | end 91 | 92 | # Do not dump schema after migrations. 93 | config.active_record.dump_schema_after_migration = false 94 | end 95 | -------------------------------------------------------------------------------- /jib/README.md: -------------------------------------------------------------------------------- 1 | # JIB sample application 2 | 3 | This example shows how to leverage Okteto to develop a Java App directly in the cloud with JIB. The Java Sample App is deployed using raw Kubernetes manifests. It's based on [Baeldung's tutorial](https://www.baeldung.com/jib-dockerizing). 4 | 5 | While you're going through this guide, join the [conversation in Slack](https://kubernetes.slack.com/messages/CM1QMQGS0/)! If you don't already have a Kubernetes slack account, [sign up here](http://slack.k8s.io/). We'd love to hear from you 😄. 6 | 7 | ## Step 1: Install the Okteto CLI 8 | 9 | The Okteto CLI transforms your remote Kubernetes pods into development environments with all your dev tools available to build and test your applications. It also starts a bidirectional synchronization service between your local filesystem and your remote containers to avoid the build/push/redeploy cycle. See your changes live in the cloud in seconds! 10 | 11 | Install the Okteto CLI by running the following command in your local terminal: 12 | 13 | ```console 14 | $ curl https://get.okteto.com -sSfL | sh 15 | ``` 16 | 17 | The Okteto CLI works in any Kubernetes cluster. If you are interested in using your existing Kubernetes cluster, jump to step 4 of the guide. However, the Okteto CLI is deeper integrated with [Okteto Cloud](https://cloud.okteto.com), the hosted version of Okteto Enterprise. 18 | 19 | ## Step 2: Login from the Okteto CLI 20 | 21 | Run `okteto login` command to create and initialize [your Okteto account](https://cloud.okteto.com/#/?origin=docs). 22 | 23 | ```console 24 | $ okteto login 25 | ``` 26 | 27 | When you create an [Okteto Cloud](https://cloud.okteto.com) account, a kubernetes service account, namespace, and credentials will be automatically created for you in the [Okteto’s multi-tenant kubernetes cluster](https://cloud.okteto.com). These resources are configured automatically to include network policies, quotas, pod security policies, admission webhooks, roles, role bindings and limit ranges. This way, every developer has access to the Kubernetes cluster without interfering with other developer namespaces. 28 | 29 | ## Step 3: Switch Kubernetes namespaces and context 30 | 31 | Run the following command to activate your personal namespace: 32 | 33 | ```console 34 | $ okteto namespace 35 | ``` 36 | 37 | The `okteto namespace` command downloads your Kubernetes credentials from Okteto Cloud, adds them to your kubeconfig file, and sets it as the current context. Once you do this, you will have full access to your Kubernetes namespace with any Kubernetes tool. 38 | 39 | ## Step 4: Deploy the Sample Application 40 | 41 | Get a local version of the sample application by executing the following commands in your local terminal: 42 | 43 | ```console 44 | $ git clone https://github.com/okteto/samples 45 | $ cd samples/jib 46 | ``` 47 | 48 | In order to deploy the application, execute: 49 | 50 | ```console 51 | $ kubectl apply -f manifests 52 | ``` 53 | 54 | After a few seconds, check that the app is running. If you are using Okteto Cloud, the [Okteto Cloud UI](https://cloud.okteto.com) will show you the endpoint of your application. 55 | 56 | # Compile for dev mode 57 | 58 | In order to activate the development mode in the sample application, execute: 59 | 60 | ``` 61 | > okteto up 62 | ✓ Development container activated 63 | ✓ Files synchronized 64 | Namespace: pchico83 65 | Name: java-dev 66 | 67 | > gradle build 68 | Welcome to Gradle 5.1.1! 69 | 70 | Here are the highlights of this release: 71 | - Control which dependencies can be retrieved from which repositories 72 | - Production-ready configuration avoidance APIs 73 | 74 | For more details see https://docs.gradle.org/5.1.1/release-notes.html 75 | 76 | Starting a Gradle Daemon (subsequent builds will be faster) 77 | 78 | BUILD SUCCESSFUL in 1m 12s 79 | 2 actionable tasks: 2 executed 80 | okteto> gradle build 81 | 82 | BUILD SUCCESSFUL in 3s 83 | 2 actionable tasks: 2 up-to-date 84 | ``` 85 | 86 | Now the binaries are accessible by your application, but since our production image does not hot-reload code changes, we need to restart the app by executing: 87 | 88 | ``` 89 | > okteto restart 90 | ``` 91 | 92 | Check that the app is running ok. You can use the application endpoint generated by [Okteto Cloud](https://cloud.okteto.com) to validate it. 93 | 94 | Make a code change in `HelloController.java`, for example, to return the string *Greetings from Okteto!*, and execute again: 95 | 96 | ``` 97 | > gradle build 98 | > okteto restart 99 | ``` 100 | 101 | Check your application again and voilà! 102 | 103 | Your changes are online in a few seconds, no commit, docker build or push required! 104 | 105 | > As you can see, there is a `.stignore` file in the root folder to indicate folders not synchronized by Okteto. In this case, we are ignoring the `build` folder to avoid synchronizing binaries compiled in remote to our local filesystem. If you remove the `build` folder from the `.stignore` file, you could execute `gradle build` and `okteto restart` locally instead of using the Okteto Terminal (this might give your a deeper integration with your local IDE). 106 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Develop with Okteto 2 | 3 | This repository contains examples of how to develop applications directly in your Kubernetes cluster using [okteto](https://github.com/okteto/okteto), with different programming languages, frameworks and deployment tools. 4 | 5 | ## Programming Languages 6 | 7 | 1. [ASP.NET Core](https://github.com/okteto/aspnetcore-getting-started/) 8 | 2. [Deno](https://github.com/okteto/deno-getting-started) 9 | 3. [Golang](https://github.com/okteto/go-getting-started) 10 | 4. [Java Gradle](https://github.com/okteto/java-gradle-getting-started) 11 | 5. [Java Maven](https://github.com/okteto/java-maven-getting-started) 12 | 6. [Node](https://github.com/okteto/node-getting-started) 13 | 7. [PHP](https://github.com/okteto/php-getting-started) 14 | 8. [Python](https://github.com/okteto/python-getting-started) 15 | 9. [Ruby](https://github.com/okteto/ruby-getting-started) 16 | 10. [Rust](https://github.com/okteto/rust-getting-started) 17 | 11. [C](https://github.com/okteto/c-getting-started) 18 | 19 | ## Frameworks 20 | 21 | 1. [Django + Celery](https://github.com/okteto/math) 22 | 1. [Eleventy](https://github.com/okteto/eleventy-getting-started) 23 | 1. [Go + gRPC](https://github.com/okteto/grpc-in-okteto-cloud) 24 | 1. [Flask + CockroachDB](https://github.com/okteto/python-flask-cockroachdb) 25 | 1. [Python, fastapi and Celery](https://github.com/okteto/python-fastapi-celery) 26 | 1. [Grails](https://okteto.com/blog/develop-and-deploy-a-grails-application-in-okteto-cloud/) 27 | 1. [Node and Websockets](https://github.com/okteto/node-websocket) 28 | 1. [Multiple services with Node and React](https://github.com/okteto/movies) 29 | 1. [PHP + Webpack](php/README.md) 30 | 1. [React](https://okteto.com/blog/build-your-react-app-in-okteto-cloud/) 31 | 1. [React + Java Spring Boot (Maven) + MySQL](https://github.com/okteto/polling) 32 | 1. [Ruby on Rails](rails/README.md) 33 | 1. [Ruby on Rails + Sidekiq + Redis + PostgreSQL](https://github.com/okteto/chat) 34 | 1. [Clojure + Shadow CLJS](https://github.com/okteto/clojure-shadowcljs) 35 | 36 | ## Deployment Tools 37 | 38 | 1. [Helm](https://github.com/okteto/movies-with-helm) 39 | 1. [Docker Compose](https://github.com/okteto/movies-with-compose) 40 | 1. [Kustomize](https://github.com/okteto/polling) 41 | 1. [Github Actions](https://github.com/marketplace?type=actions&query=okteto+) 42 | 1. [Flux](https://okteto.com/blog/okteto-cloud-meets-gitops/) 43 | 44 | ## Serverless 45 | 46 | 1. [Cloud Run](https://okteto.com/blog/accelerate-serverless-development-with-cloud-run-and-okteto/) 47 | 1. [OpenFaaS with Golang](https://medium.com/okteto/how-to-develop-a-serverless-app-with-openfaas-and-okteto-d85435f0eca1) 48 | 1. [OpenFaaS with Node.js](https://github.com/okteto/openfaas-nodejs) 49 | 1. [OpenFaaS with Python](https://github.com/okteto/python-openfaas) 50 | 1. [Kubeless with Python](https://github.com/okteto/python-kubeless) 51 | 52 | ## Remote IDEs 53 | 54 | 1. [Coder in Kubernetes](coder/README.md) 55 | 1. [TensorFlow with Jupyter Notebooks](https://okteto.com/blog/deploy-jupyter-tensorflow-notebook-in-one-click/) 56 | 1. [VS Code Remote Development](https://okteto.com/blog/remote-kubernetes-development/) 57 | 1. [PyCharm Remote Development](https://okteto.com/blog/remote-development-environments-with-pycharm) 58 | 59 | ## Secrets 60 | 1. [Vault](https://github.com/okteto/go-vault-secrets) 61 | 1. [Okteto Pipeline with Secrets](https://github.com/okteto/pipeline-with-generated-secrets) 62 | 63 | ## Applications 64 | 1. [Movies: NodeJs + MongoDB](https://github.com/okteto/movies) 65 | 1. [Movies: Multirepo](https://github.com/okteto/movies-multi-repo) 66 | 1. [Guestbook: Go + Redis](https://github.com/okteto/go-guestbook) 67 | 1. [ToDO List: Go + Postgres](https://github.com/okteto/go-todo-list) 68 | 1. [Chaos Engineering with Litmus and Okteto Cloud](https://github.com/okteto/litmus-on-okteto) 69 | 1. [Polling App: React + Java Spring Boot (Maven) + MySQL](https://github.com/okteto/polling) 70 | 1. [Message Processing: Python + Flask + Kafka](https://github.com/okteto/kafka-stack) 71 | 1. [GraphQL: Node + Apollo Server](https://github.com/okteto/node-graphql-server) 72 | 73 | ## From the community 74 | 75 | 1. [Developing Like a Boss Series: AngularJS + Python + Spark](https://blogs.cisco.com/developer/devops-part-12) 76 | 1. [Develop and test your code directly in Kubernetes using Okteto and Civo Cloud](https://www.civo.com/learn/okteto-a-tool-to-develop-and-test-your-code-directly-in-kubernetes) 77 | 1. [OpenFaaS Deno HTTP function](https://github.com/austinrivas/openfaas_deno_func) 78 | 1. [OpenFaaS Rust HTTP function](https://github.com/austinrivas/openfaas_rust-warp_func) 79 | 1. [Micronaut Application to raffle prizes using a google sheet as backend](https://gitlab.com/groogle/mn-raffle) 80 | 1. [Shopware 6 in Okteto](https://github.com/shyim/shopware-6-okteto) 81 | 1. [Sinatra app](https://github.com/jjuarez/okteto-test) 82 | 1. [Spring Boot and IntelliJ](https://piotrminkowski.com/2020/06/15/development-on-kubernetes-with-okteto-and-spring-boot/) 83 | 1. [Run your own Chainlink Developer Node with Okteto](https://medium.com/@jeevanjotsinghvital/run-your-own-chainlink-developer-node-with-okteto-8adbc9a98664) 84 | 1. [Anonymize production data with Privacy Dynamics and use it safely in development](https://www.privacydynamics.io/post/pre-configured-development-environments-with-okteto/) 85 | 1. [Deploy Elasticsearch 8.x on Kubernetes with Okteto](https://www.pistocop.dev/posts/deploy_es_on_okteto/) 86 | 87 | Did we miss your favorite platform? Do you have a cool demo? [File an issue](https://github.com/okteto/samples/issues/new) with your request, or better yet, [send us a PR](https://github.com/okteto/samples/pulls)! 88 | -------------------------------------------------------------------------------- /rails/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actioncable (5.2.4.4) 5 | actionpack (= 5.2.4.4) 6 | nio4r (~> 2.0) 7 | websocket-driver (>= 0.6.1) 8 | actionmailer (5.2.4.4) 9 | actionpack (= 5.2.4.4) 10 | actionview (= 5.2.4.4) 11 | activejob (= 5.2.4.4) 12 | mail (~> 2.5, >= 2.5.4) 13 | rails-dom-testing (~> 2.0) 14 | actionpack (5.2.4.4) 15 | actionview (= 5.2.4.4) 16 | activesupport (= 5.2.4.4) 17 | rack (~> 2.0, >= 2.0.8) 18 | rack-test (>= 0.6.3) 19 | rails-dom-testing (~> 2.0) 20 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 21 | actionview (5.2.4.4) 22 | activesupport (= 5.2.4.4) 23 | builder (~> 3.1) 24 | erubi (~> 1.4) 25 | rails-dom-testing (~> 2.0) 26 | rails-html-sanitizer (~> 1.0, >= 1.0.3) 27 | activejob (5.2.4.4) 28 | activesupport (= 5.2.4.4) 29 | globalid (>= 0.3.6) 30 | activemodel (5.2.4.4) 31 | activesupport (= 5.2.4.4) 32 | activerecord (5.2.4.4) 33 | activemodel (= 5.2.4.4) 34 | activesupport (= 5.2.4.4) 35 | arel (>= 9.0) 36 | activestorage (5.2.4.4) 37 | actionpack (= 5.2.4.4) 38 | activerecord (= 5.2.4.4) 39 | marcel (~> 0.3.1) 40 | activesupport (5.2.4.4) 41 | concurrent-ruby (~> 1.0, >= 1.0.2) 42 | i18n (>= 0.7, < 2) 43 | minitest (~> 5.1) 44 | tzinfo (~> 1.1) 45 | addressable (2.7.0) 46 | public_suffix (>= 2.0.2, < 5.0) 47 | archive-zip (0.12.0) 48 | io-like (~> 0.3.0) 49 | arel (9.0.0) 50 | bindex (0.8.1) 51 | bootsnap (1.4.8) 52 | msgpack (~> 1.0) 53 | builder (3.2.4) 54 | byebug (11.1.3) 55 | capybara (3.33.0) 56 | addressable 57 | mini_mime (>= 0.1.3) 58 | nokogiri (~> 1.8) 59 | rack (>= 1.6.0) 60 | rack-test (>= 0.6.3) 61 | regexp_parser (~> 1.5) 62 | xpath (~> 3.2) 63 | childprocess (3.0.0) 64 | chromedriver-helper (2.1.1) 65 | archive-zip (~> 0.10) 66 | nokogiri (~> 1.8) 67 | coffee-rails (4.2.2) 68 | coffee-script (>= 2.2.0) 69 | railties (>= 4.0.0) 70 | coffee-script (2.4.1) 71 | coffee-script-source 72 | execjs 73 | coffee-script-source (1.12.2) 74 | concurrent-ruby (1.1.7) 75 | crass (1.0.6) 76 | erubi (1.9.0) 77 | execjs (2.7.0) 78 | ffi (1.13.1) 79 | globalid (0.4.2) 80 | activesupport (>= 4.2.0) 81 | i18n (1.8.5) 82 | concurrent-ruby (~> 1.0) 83 | io-like (0.3.1) 84 | jbuilder (2.10.1) 85 | activesupport (>= 5.0.0) 86 | libv8 (8.4.255.0) 87 | listen (3.1.5) 88 | rb-fsevent (~> 0.9, >= 0.9.4) 89 | rb-inotify (~> 0.9, >= 0.9.7) 90 | ruby_dep (~> 1.2) 91 | loofah (2.7.0) 92 | crass (~> 1.0.2) 93 | nokogiri (>= 1.5.9) 94 | mail (2.7.1) 95 | mini_mime (>= 0.1.1) 96 | marcel (0.3.3) 97 | mimemagic (~> 0.3.2) 98 | method_source (1.0.0) 99 | mimemagic (0.3.5) 100 | mini_mime (1.0.2) 101 | mini_portile2 (2.5.0) 102 | mini_racer (0.3.1) 103 | libv8 (~> 8.4.255) 104 | minitest (5.14.2) 105 | msgpack (1.3.3) 106 | nio4r (2.5.4) 107 | nokogiri (1.11.1) 108 | mini_portile2 (~> 2.5.0) 109 | racc (~> 1.4) 110 | public_suffix (4.0.6) 111 | puma (3.12.6) 112 | racc (1.5.2) 113 | rack (2.2.3) 114 | rack-test (1.1.0) 115 | rack (>= 1.0, < 3) 116 | rails (5.2.4.4) 117 | actioncable (= 5.2.4.4) 118 | actionmailer (= 5.2.4.4) 119 | actionpack (= 5.2.4.4) 120 | actionview (= 5.2.4.4) 121 | activejob (= 5.2.4.4) 122 | activemodel (= 5.2.4.4) 123 | activerecord (= 5.2.4.4) 124 | activestorage (= 5.2.4.4) 125 | activesupport (= 5.2.4.4) 126 | bundler (>= 1.3.0) 127 | railties (= 5.2.4.4) 128 | sprockets-rails (>= 2.0.0) 129 | rails-dom-testing (2.0.3) 130 | activesupport (>= 4.2.0) 131 | nokogiri (>= 1.6) 132 | rails-html-sanitizer (1.3.0) 133 | loofah (~> 2.3) 134 | railties (5.2.4.4) 135 | actionpack (= 5.2.4.4) 136 | activesupport (= 5.2.4.4) 137 | method_source 138 | rake (>= 0.8.7) 139 | thor (>= 0.19.0, < 2.0) 140 | rake (13.0.1) 141 | rb-fsevent (0.10.4) 142 | rb-inotify (0.10.1) 143 | ffi (~> 1.0) 144 | regexp_parser (1.8.1) 145 | ruby_dep (1.5.0) 146 | rubyzip (2.3.0) 147 | sass (3.7.4) 148 | sass-listen (~> 4.0.0) 149 | sass-listen (4.0.0) 150 | rb-fsevent (~> 0.9, >= 0.9.4) 151 | rb-inotify (~> 0.9, >= 0.9.7) 152 | sass-rails (5.1.0) 153 | railties (>= 5.2.0) 154 | sass (~> 3.1) 155 | sprockets (>= 2.8, < 4.0) 156 | sprockets-rails (>= 2.0, < 4.0) 157 | tilt (>= 1.1, < 3) 158 | selenium-webdriver (3.142.7) 159 | childprocess (>= 0.5, < 4.0) 160 | rubyzip (>= 1.2.2) 161 | spring (2.1.1) 162 | spring-watcher-listen (2.0.1) 163 | listen (>= 2.7, < 4.0) 164 | spring (>= 1.2, < 3.0) 165 | sprockets (3.7.2) 166 | concurrent-ruby (~> 1.0) 167 | rack (> 1, < 3) 168 | sprockets-rails (3.2.2) 169 | actionpack (>= 4.0) 170 | activesupport (>= 4.0) 171 | sprockets (>= 3.0.0) 172 | sqlite3 (1.4.2) 173 | thor (1.0.1) 174 | thread_safe (0.3.6) 175 | tilt (2.0.10) 176 | turbolinks (5.2.1) 177 | turbolinks-source (~> 5.2) 178 | turbolinks-source (5.2.0) 179 | tzinfo (1.2.7) 180 | thread_safe (~> 0.1) 181 | uglifier (4.2.0) 182 | execjs (>= 0.3.0, < 3) 183 | web-console (3.7.0) 184 | actionview (>= 5.0) 185 | activemodel (>= 5.0) 186 | bindex (>= 0.4.0) 187 | railties (>= 5.0) 188 | websocket-driver (0.7.3) 189 | websocket-extensions (>= 0.1.0) 190 | websocket-extensions (0.1.5) 191 | xpath (3.2.0) 192 | nokogiri (~> 1.8) 193 | 194 | PLATFORMS 195 | ruby 196 | 197 | DEPENDENCIES 198 | bootsnap (>= 1.1.0) 199 | byebug 200 | capybara (>= 2.15) 201 | chromedriver-helper 202 | coffee-rails (~> 4.2) 203 | jbuilder (~> 2.5) 204 | listen (>= 3.0.5, < 3.2) 205 | mini_racer 206 | puma (~> 3.12) 207 | rails (~> 5.2.3) 208 | sass-rails (~> 5.0) 209 | selenium-webdriver 210 | spring 211 | spring-watcher-listen (~> 2.0.0) 212 | sqlite3 213 | turbolinks (~> 5) 214 | tzinfo-data 215 | uglifier (>= 1.3.0) 216 | web-console (>= 3.3.0) 217 | 218 | RUBY VERSION 219 | ruby 2.6.2p47 220 | 221 | BUNDLED WITH 222 | 1.17.2 223 | -------------------------------------------------------------------------------- /php/README.md: -------------------------------------------------------------------------------- 1 | # PHP-FPM, Webpack and NGINX 2 | 3 | This example shows how to leverage [Okteto](https://github.com/okteto/okteto) to develop a PHP-FPM + Webpack application fronted by an NGINX instance. 4 | 5 | Okteto works in any Kubernetes cluster (local or remote) by reading your local Kubernetes credentials. 6 | 7 | ## Step 1: Install the Okteto CLI 8 | 9 | Install the Okteto CLI by following our [installation guides](https://www.okteto.com/docs/get-started/install-okteto-cli/). 10 | 11 | 12 | ## Step 2: Launch the app 13 | 14 | Clone the repository and go to the php folder. 15 | 16 | ```console 17 | $ git clone https://github.com/okteto/samples 18 | $ cd samples/php 19 | ``` 20 | 21 | The PHP-FPM + Webpack sample application consists of a php-fpm worker and an NGINX instance to serve Webpack-generate static files and proxy the PHP requests. 22 | Deploy the entire application by using the following command: 23 | 24 | ```console 25 | $ kubectl apply -f manifests 26 | configmap/nginx-config created 27 | deployment.extensions/php created 28 | service/php created 29 | deployment.extensions/web created 30 | service/web created 31 | ``` 32 | 33 | Check that all pods are ready. You can do it by running the command below: 34 | ``` 35 | $ kubectl get pod 36 | NAME READY STATUS RESTARTS AGE 37 | php-84d6bd7955-cwnvf 1/1 Running 0 104s 38 | web-6485689c6b-258m9 1/1 Running 0 47s 39 | ``` 40 | 41 | ## Step 3: Create your Okteto Environment 42 | 43 | In order to activate your Cloud Native Development, execute: 44 | 45 | ```console 46 | $ okteto up 47 | Deployment dev doesn't exist in namespace "cindy". Do you want to create a new one? [y/n]: y 48 | ✓ Files synchronized 49 | ✓ Development environment activated 50 | Namespace: cindy 51 | Name: shell 52 | 53 | Welcome to your development environment. Happy coding! 54 | okteto> 55 | ``` 56 | 57 | The `okteto up` command will start a remote development environment that automatically synchronizes and applies your code changes to the web and worker deployments without having to rebuild or redeploy (eliminating the **docker build/push/pull/redeploy** cycle). You can control how your development environment is created by modifying `okteto.yml`. 58 | 59 | Since our application is formed of multiple services, we decided to configure `okteto.yml` to create a multi-service remote development environment: 60 | 61 | ```yaml 62 | dev: 63 | shell: 64 | autocreate: true 65 | image: okteto/dev:latest 66 | command: bash 67 | sync: 68 | - .:/usr/src/app 69 | forward: 70 | - 8080:web:80 71 | services: 72 | - name: php 73 | sync: 74 | - api:/app 75 | - name: web 76 | sync: 77 | - dist:/usr/share/nginx/html 78 | ``` 79 | 80 | The `image` and `command` keys will give Okteto information about your development environment, while the `services` list tells Okteto which other services you want to have as part of your development environment. 81 | 82 | The `sync` keys in the `services` keys tells Okteto [where to mount your local folder](https://www.okteto.com/docs/reference/okteto-manifest/#sync-string-required) in your serivces. [This page](https://www.okteto.com/docs/reference/okteto-manifest/#services-object-optional) has more information about services, and all the values you can configure. 83 | 84 | ## Step 4: Install your dependencies 85 | 86 | Since we are using a generic development environment (`okteto/dev:latest`), we'll have to install our dev dependencies (on a realistic scenario, we recommend that you extend our dev environments to already include them and save you time and effort). 87 | 88 | Start by running `yarn install` in your development environment to install all the webpack dev dependencies: 89 | 90 | ```console 91 | okteto> yarn install 92 | yarn install v1.17.3 93 | [1/4] Resolving packages... 94 | ... 95 | Done in 0.62s 96 | ``` 97 | 98 | Now run `yarn dev` to tell webpack to generate all the static files (html and javascript in this case). The `yarn dev` command is configured to also start a watcher so that you keep it running and it will automatically rebuild the files as needed. 99 | 100 | ```console 101 | okteto> yarn dev 102 | yarn run v1.17.3 103 | $ webpack --config=webpack.config.dev.js 104 | 105 | webpack is watching the files… 106 | 107 | Hash: 49290a32868bd198995d 108 | Version: webpack 4.39.3 109 | Time: 721ms 110 | Built at: 09/06/2019 7:11:58 PM 111 | Asset Size Chunks Chunk Names 112 | main.js 552 KiB main [emitted] main 113 | Entrypoint main = main.js 114 | [./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 472 bytes {main} [built] 115 | [./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 497 bytes {main} [built] 116 | [./src/index.js] 307 bytes {main} [built] 117 | + 1 hidden module 118 | ``` 119 | 120 | To keep things simple, we configured a `forward` to access the NGINX service directly via `localhost:8080` in the Okteto Manifest. Open http://localhost:8080/ in your browser and, if everything went right, you should see the following text: 'Hello webpack'. 121 | 122 | ## Step 5: Live coding 123 | 124 | Now that we have a development environment running in Kubernetes, let's do some live coding. Fire up your favorite IDE, and open [./src/index.js](src/index.js). 125 | 126 | Replace line 7 with the following text: 127 | ```javascript 128 | element.innerHTML = 'Hello okteto'; 129 | ``` 130 | Go back to your browser and reload the page. Notice how the text changed to `Hello okteto`. 131 | 132 | How did this happen? Well, with Okteto, your changes were automatically applied as soon as you saved them, no commit, build, push or redeploy required 💪! 133 | 134 | ### API Love 135 | 136 | Since we have a PHP backend running, why don't we give our API some ❤️ and connect everything together? 137 | 138 | Go back to your IDE and replace the content of [./src/index.js](src/index.js) with the code below: 139 | 140 | ```javascript 141 | function component() { 142 | const element = document.createElement('div'); 143 | var request = new XMLHttpRequest(); 144 | request.open('GET', '/hello.php', true) 145 | request.onload = function() { 146 | element.innerHTML = this.response 147 | } 148 | 149 | request.send(); 150 | return element; 151 | } 152 | 153 | document.body.appendChild(component()); 154 | ``` 155 | 156 | Go back to your browser and reload the page. Instead of `Hello okteto`, you'll see `Hello PHP`, since now we are calling the API. 157 | 158 | Finally, open [api/hello.php](api/hello.php), change the text to "Hello Kubernetes", go back to your browser and reload. 159 | 160 | ## Step 5: Cleanup 161 | 162 | Cancel the `okteto up` command by pressing `ctrl + c` and run the following command to remove the resources created by this guide: 163 | 164 | ```console 165 | $ okteto down -v 166 | ✓ Okteto Environment deactivated 167 | 168 | ``` 169 | and finally delete the application by running: 170 | 171 | ```console 172 | $ kubectl delete -f manifests 173 | configmap "nginx-config" deleted 174 | deployment.extensions "php" deleted 175 | service "php" deleted 176 | deployment.extensions "web" deleted 177 | service "web" deleted 178 | ``` 179 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------