online kitchen running in k8s
1.8K
copy and setup config files:
cp config/database.yml.example config/database.yml cp config/online_kitchen.yml.example config/online_kitchen.yml cp config/templates.yml.example config/templates.yml
install all dependant libraries and init db:
bundle install rake db:setup
in root of the repository
vagrant box add --insecure 'ubuntu/trusty64' https://atlas.hashicorp.com/ubuntu/boxes/trusty64/versions/14.04/providers/virtualbox.box vagrant up vagrant ssh cd /vagrant
Follow Procfile (in production)
Example of curl with proper params to be used in Linux terminal (Windows terminal does not allow the '' and you need to use double quotes everywhere + escape the quotes... inside quotes with triple quotes. For windows users - install Cygwin (mintty.exe) or install MSYS (rxvt.exe):
For following examples you can run server in devel by rackup.
Get list of Configuration (for user franta.lopata):
curl -i -H 'UserName: franta.lopata'
-H 'AUTHENTICATIONTOKEN: secret' -H "Accept: application/json"
-H "Content-Type: application/json"
http://localhost:4567/api/v1/configurations
Create new configuration:
curl -i -X POST -H 'UserName: franta.lopata'
-H 'AUTHENTICATIONTOKEN: secret' -H "Accept: application/json"
-H "Content-Type: application/json"
-d '{ "configuration": {"name": "configurationName", "folder_name": "_online_kitnech_test"}}'
http://localhost:4567/api/v1/configurations
Update Configuration:
add machine:
curl -i -X PUT -H 'UserName: franta.lopata'
-H 'AUTHENTICATIONTOKEN: secret'
-H "Accept: application/json"
-H "Content-Type: application/json"
-d '{ "configuration": { "machines_attributes": [{ "name": "MachineName1", "template": "travis_7x86"}] }}'
http://localhost:4567/api/v1/configurations/44
destroy machine (switch machine to destroy_queued state and schedule destroying):
curl -i -X PUT -H 'UserName: franta.lopata'
-H 'AUTHENTICATIONTOKEN: secret'
-H "Accept: application/json"
-H "Content-Type: application/json"
-d '{ "configuration": { "machines_attributes": [{ "id": 22, "_destroy": "1"}] }}'
http://localhost:4567/api/v1/configurations/44
Destroy configuration (e.g. schedule destroy)
curl -i -X DELETE -H "UserName: franta.lopata"
-H "AUTHENTICATIONTOKEN: secret"
-H "Accept: application/json"
-H "Content-Type: application/json"
http://localhost:4567/api/v1/configurations/1
Service raises following exceptions:
Example of validation error response:
{
"status": "unprocessable_entity",
"errors": {
"name": "is too short (minimum is 3 characters)"
}
}
rails
OnlineKitchen.setup
# for FactoryGirl
require 'factory_girl'
require './spec/factories'
Content type
Image
Digest
sha256:1310e44d6…
Size
302.2 MB
Last updated
over 3 years ago
docker pull avastsoftware/online-kitchen:2e3e85e3b0fc29211e6ff6ab4df4e114ad62370f