├── 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 |
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 || Title | 6 |Text | 7 |8 | | ||
|---|---|---|---|---|
| <%= article.title %> | 13 |<%= article.text %> | 14 |<%= link_to 'Show', article_path(article) %> | 15 |<%= link_to 'Edit', edit_article_path(article) %> | 16 |<%= link_to 'Destroy', article_path(article), 17 | method: :delete, 18 | data: { confirm: 'Are you sure?' } %> | 19 |
18 | <%= form.label :title %>
19 | <%= form.text_field :title %>
20 |
23 | <%= form.label :text %>
24 | <%= form.text_area :text %>
25 |
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 |Processed by {{namespace}}\{{hostname}}
24 |Processed by {{namespace}}\{{hostname}}
24 |If you are the application owner check the logs for more information.
64 |Maybe you tried to change something you didn't have access to.
63 |If you are the application owner check the logs for more information.
65 |You may have mistyped the address or the page may have moved.
63 |If you are the application owner check the logs for more information.
65 |