def build(args): add_default = True if args.image_config[0] == "!": add_default = False args.image_config = args.image_config[1:] image_config_file = os.path.join(image_configs_dir, args.image_config + '.py') if os.path.exists(image_config_file): print("Using image config: %s" % image_config_file) config = resolve.local_import(image_config_file) run_list = config.get('run', []) else: # If images/image_config doesn't exist, assume image_config is a # comma-separated list of module names, and build an image from those # modules (and their dependencies). The command line to run is to # run each of the module's "default" command line, in parallel. # You can choose a module's non-default command line, with a dot, # e.g.: mgmt.shell use's mgmt's "shell" command line. print("No such image configuration: " + args.image_config + ". Assuming list of modules.") run_list = [] disabled_modules = set() for module in args.image_config.split(","): if module[0] == '-': disabled_modules.add(module[1:]) module_names = [] config = resolve.read_config() if add_default and "default" in config: module_names += config["default"] module_names += args.image_config.split(",") for missing in list(disabled_modules - set(module_names)): raise Exception("Attempt to disable module %s but not enabled" % missing) module_names = [i for i in module_names if not i in disabled_modules] for module in module_names: if module[0] == '-': continue a = module.split(".", 1) name = a[0] variant = a[1] if (len(a) > 1) else "default" mod = api.require(name) if hasattr(mod, variant): run_list.append(getattr(mod, variant)) elif variant != "default" and variant != "none": raise Exception("Attribute %s not set in module %s" % (variant, name)) modules = resolve.get_required_modules() print("Modules:") if not modules: print(" None") for module in modules: print(" " + module.name) make_modules(modules, args) apps_to_run = get_basic_apps(run_list) generate_manifests(modules, apps_to_run) generate_cmdline(apps_to_run)
from osv.modules.filemap import FileMap from osv.modules import api import os, os.path api.require('java-cmd') provides = ['java'] usr_files = FileMap() jdkdir = os.path.basename(os.path.expandvars('${jdkbase}')) usr_files.add('${jdkbase}').to('/usr/lib/jvm/java') \ .include('lib/**') \ .include('jre/**') \ .exclude('jre/lib/security/cacerts') \ .exclude('jre/lib/audio/**') usr_files.link('/usr/lib/jvm/' + jdkdir).to('java') usr_files.link('/usr/lib/jvm/jre').to('java/jre') usr_files.link('/usr/lib/jvm/java/jre/lib/security/cacerts').to('/etc/pki/java/cacerts')
from osv.modules import api api.require('unknown-term') default = api.run(cmdline="--env=TERM=unknown /python")
from osv.modules import api api.require('erlang') default = api.run(cmdline="/usr/lib64/erlang.so -env HOME / /etc/elixir/vm.args /etc/default/elixir/vm.args")
from osv.modules import api api.require('java-tests') api.require('dl_tests')
from osv.modules import api api.require('ca-certificates') api.require('libz')
from osv.modules import api api.require('ruby') default = api.run(cmdline="--cwd=/publify/ --env=GEM_HOME=/publify/vendor/bundle/ruby/2.1.0 /ruby.so ./bin/rails server -e production")
from osv.modules import api api.require("lua") default = api.run("/usr/lib/liblua.so /usr/lib/hello.lua")
from osv.modules import api api.require('openssl')
from osv.modules import api run = [ api.require('rogue').default ]
from osv.modules import api api.require('golang') default = api.run(cmdline="/go.so /hello.so")
from osv.modules import api api.require("java-isolated")
config = resolve.local_import(image_config_file) run_list = config.get("run", []) else: # If images/image_config doesn't exist, assume image_config is a # comma-separated list of module names, and build an image from those # modules (and their dependencies). The command line to run is to # run each of the module's "default" command line, in parallel. # You can choose a module's non-default command line, with a dot, # e.g.: mgmt.shell use's mgmt's "shell" command line. print "No such image configuration: " + args.image_config + ". Assuming list of modules." run_list = [] for module in args.image_config.split(","): a = module.split(".", 1) name = a[0] variant = a[1] if (len(a) > 1) else "default" mod = api.require(name) if hasattr(mod, variant): run_list.append(getattr(mod, variant)) elif variant != "default" and variant != "none": raise Exception("Attribute %s not set in module %s" % (variant, name)) modules = resolve.get_required_modules() print "Modules:" if not modules: print " None" for module in modules: print " " + module.name make_modules(modules)
import os from osv.modules.api import * from osv.modules.filemap import FileMap from osv.modules import api _module = '${OSV_BASE}/modules/cloud-init' usr_files = FileMap() usr_files.add(os.path.join(_module, 'cloud-init.so')).to('/usr/mgmt/cloud-init.so') usr_files.add(os.path.join(_module, 'cloud-init.yaml')).to('/usr/mgmt/cloud-init.yaml') usr_files.add(os.path.join(_module, 'cmdline')).to('/init/00-cmdline') api.require('httpserver') api.require('libyaml') #default = api.run('/usr/mgmt/cloud-init.so --skip-error --file /usr/mgmt/cloud-init.yaml') default = ""
import os from osv.modules.api import * from osv.modules.filemap import FileMap from osv.modules import api _module = '${OSV_BASE}/modules/httpserver' _exe = '/libhttpserver.so' usr_files = FileMap() usr_files.add(os.path.join(_module, 'libhttpserver.so')).to(_exe) usr_files.add(os.path.join(_module, 'api-doc')).to('/usr/mgmt/api') usr_files.add(os.path.join(_module, 'swagger-ui', 'dist')).to('/usr/mgmt/swagger-ui/dist') usr_files.add(os.path.join(_module, 'osv-gui/public')).to('/usr/mgmt/gui') api.require('openssl') api.require('libtools') api.require('libyaml') # only require next 3 modules if java (jre) is included in the list of modules api.require_if_other_module_present('josvsym','java') api.require_if_other_module_present('httpserver-jolokia-plugin','java') api.require_if_other_module_present('httpserver-jvm-plugin','java') # httpserver will run regardless of an explicit command line # passed with "run.py -e". daemon = api.run_on_init(_exe + ' &!') fg = api.run(_exe) fg_ssl = api.run(_exe + ' --ssl')
provides = ['java'] from osv.modules.filemap import FileMap from osv.modules import api api.require('fonts') usr_files = FileMap() usr_files.add('${OSV_BASE}/apps/openjdk8/upstream/install/jvm/openjdk-1.8.0-internal').to('/usr/lib/jvm') \ .include('lib/**') \ .include('jre/**') \ .exclude('jre/lib/security/cacerts') \ .exclude('jre/lib/audio/**')
from osv.modules import api #For a proper interactive python terminal api.require('unknown-term') #For sqlite3 and help() api.require('sqlite') default = api.run(cmdline="--env=TERM=unknown /python3")
from osv.modules import api import subprocess javac_with_version = subprocess.check_output( ['javac', '-version'], stderr=subprocess.STDOUT).decode('utf-8') if javac_with_version.startswith('javac 1.8'): api.require('java-non-isolated') api.require('openjdk8-from-host') else: api.require('openjdk9_1x-from-host')
from osv.modules import api api.require('tests') run = []
import os from osv.modules.api import * from osv.modules.filemap import FileMap from osv.modules import api _module = '${OSV_BASE}/modules/httpserver-html5-gui' usr_files = FileMap() usr_files.add(os.path.join(_module, 'swagger-ui', 'dist')).to('/usr/mgmt/swagger-ui/dist') usr_files.add(os.path.join(_module, 'osv-gui/public')).to('/usr/mgmt/gui') usr_files.add(os.path.join(_module, 'httpserver.conf')).to('/etc/httpserver.conf') api.require('httpserver-api') # httpserver will run regardless of an explicit command line # passed with "run.py -e". _exe = '/libhttpserver-api.so --config-file=/etc/httpserver.conf' daemon = api.run_on_init(_exe + ' &!') fg = api.run(_exe) fg_ssl = api.run(_exe + ' --ssl') fg_cors = api.run(_exe + ' --access-allow=true') default = daemon
# # Copyright (C) 2014 Cloudius Systems, Ltd. # # This work is open source software, licensed under the terms of the # BSD license as described in the LICENSE file in the top-level directory. # from osv.modules import api api.require('scala') classpath = ['/usr/share/scala/lib/scala-library.jar', 'HelloWorld.jar'] default = api.run_java(classpath = classpath, args = [ "HelloWorld", ], )
# # Copyright (C) 2014 Cloudius Systems, Ltd. # # This work is open source software, licensed under the terms of the # BSD license as described in the LICENSE file in the top-level directory. # from osv.modules.filemap import FileMap from osv.modules import api import os, os.path provides = ['java'] api.require('fonts') api.require('ca-certificates') api.require('libz') api.require('josvsym') api.require('httpserver-jolokia-plugin') api.require('httpserver-jvm-plugin') usr_files = FileMap() usr_files.add('${OSV_BASE}/apps/openjdk8-fedora/install').to('/').allow_symlink() usr_files.add('${OSV_BASE}/apps/openjdk8-fedora/install/usr/lib/jvm/java') \ .to('/usr/lib/jvm/java') \ .allow_symlink() usr_files.link('/usr/lib/jvm/jre').to('/usr/lib/jvm/java/jre') usr_files.link('/usr/lib/jvm/java/jre/lib/security/cacerts').to('/etc/pki/java/cacerts')
from osv.modules import api api.require('libz')
from osv.modules import api api.require('java-isolated') api.require('openjdk7')
from osv.modules import api api.require('java-tests')
import os from osv.modules.api import * from osv.modules.filemap import FileMap from osv.modules import api _module = '${OSV_BASE}/modules/cloud-init' usr_files = FileMap() usr_files.add(os.path.join(_module, 'cloud-init.yaml')).to('/usr/mgmt/cloud-init.yaml') usr_files.add(os.path.join(_module, 'cmdline')).to('/init/00-cmdline') api.require('httpserver') api.require('libyaml') api.require('libcdio') #default = api.run('/usr/mgmt/cloud-init.so --skip-error --file /usr/mgmt/cloud-init.yaml') default = ""
from osv.modules import api api.require('java8') _classpath = ["/db-derby/lib/derby.jar", "/db-derby/lib/derbynet.jar", "/db-derby/lib/derbytools.jar", "/db-derby/lib/derbyclient.jar"] _args = ["-Djava.security.policy=/db-derby/security.policy", "org.apache.derby.drda.NetworkServerControl", "start"] default = api.run_java(classpath = _classpath, args = _args)
config = resolve.local_import(image_config_file) run_list = config.get('run', []) else: # If images/image_config doesn't exist, assume image_config is a # comma-separated list of module names, and build an image from those # modules (and their dependencies). The command line to run is to # run each of the module's "default" command line, in parallel. # You can choose a module's non-default command line, with a dot, # e.g.: mgmt.shell use's mgmt's "shell" command line. print "No such image configuration: " + args.image_config + ". Assuming list of modules." run_list = [] for module in args.image_config.split(","): a = module.split(".", 1) name = a[0] variant = a[1] if (len(a) > 1) else "default" mod = api.require(name) if hasattr(mod, variant): run_list.append(getattr(mod, variant)) elif variant != "default" and variant != "none": raise Exception("Attribute %s not set in module %s" % (variant, name)) modules = resolve.get_required_modules() print "Modules:" if not modules: print " None" for module in modules: print " " + module.name make_modules(modules)
from osv.modules import api api.require('java-base') provides = ['java-cmd']
import os from osv.modules.api import * from osv.modules.filemap import FileMap from osv.modules import api _module = '${OSV_BASE}/modules/cloud-init' usr_files = FileMap() usr_files.add(os.path.join('${OSV_BASE}', 'external/x64/misc.bin/usr/lib64/libyaml-cpp.so.0.5.1')).to('/usr/lib/libyaml-cpp.so.0.5') usr_files.add(os.path.join(_module, 'cloud-init.so')).to('/usr/mgmt/cloud-init.so') usr_files.add(os.path.join(_module, 'cloud-init.yaml')).to('/usr/mgmt/cloud-init.yaml') usr_files.add(os.path.join(_module, 'cmdline')).to('/init/00-cmdline') api.require('httpserver') #default = api.run('/usr/mgmt/cloud-init.so --skip-error --file /usr/mgmt/cloud-init.yaml') default = ""
import os from osv.modules.api import * from osv.modules.filemap import FileMap from osv.modules import api _module = '${OSV_BASE}/modules/httpserver-api' _exe = '/libhttpserver.so' usr_files = FileMap() usr_files.add(os.path.join(_module, 'libhttpserver-api.so')).to(_exe) usr_files.add(os.path.join(_module, 'api-doc')).to('/usr/mgmt/api') api.require('openssl') api.require('libtools') api.require('libyaml') # only require next 3 modules if java (jre) is included in the list of modules api.require_if_other_module_present('josvsym','java') api.require_if_other_module_present('httpserver-jolokia-plugin','java') api.require_if_other_module_present('httpserver-jvm-plugin','java') # httpserver will run regardless of an explicit command line # passed with "run.py -e". daemon = api.run_on_init(_exe + ' &!') fg = api.run(_exe) fg_ssl = api.run(_exe + ' --ssl') default = daemon
from osv.modules import api api.require('ruby') default = api.run( cmdline="--cwd=/sinatra/ --env=GEM_HOME=/sinatra/gems /ruby.so ./example.rb" )
from osv.modules import api api.require('open-mpi') # default = api.run("/libexec/osu-micro-benchmarks/mpi/pt2pt/osu_latency -h")
# # Copyright (C) 2014 Cloudius Systems, Ltd. # # This work is open source software, licensed under the terms of the # BSD license as described in the LICENSE file in the top-level directory. # from osv.modules.filemap import FileMap from osv.modules import api api.require('java-cmd') provides = ['java'] usr_files = FileMap() usr_files.add('${OSV_BASE}/apps/openjdk8-fedora/install').to( '/').allow_symlink() usr_files.add('${OSV_BASE}/apps/openjdk8-fedora/install/usr/lib/jvm/java') \ .to('/usr/lib/jvm/java') \ .allow_symlink() usr_files.link('/usr/lib/jvm/jre').to('/usr/lib/jvm/java/jre')
from osv.modules import api api.require("libz") default = api.run("/ffmpeg.so -formats") video_details = api.run( '/ffmpeg.so -i http://clips.vorwaerts-gmbh.de/VfE_html5.mp4') video_subclip = api.run( '/ffmpeg.so -i http://clips.vorwaerts-gmbh.de/VfE_html5.mp4 -ss 00:00:10 -codec copy -t 10 output.mp4' ) video_extract_png = api.run( '/ffmpeg.so -i http://clips.vorwaerts-gmbh.de/VfE_html5.mp4 -r 1 -f image2 image-%2d.png' ) video_transcode = api.run( '/ffmpeg.so -i http://clips.vorwaerts-gmbh.de/VfE_html5.mp4 -c:v libx265 -crf 28 -an -f mpegts tcp://192.168.122.1:12345' )
from osv.modules import api api.require('node') default = api.run(cmdline="--cwd=/sails/ /libnode.so ./example/app.js")
# # Copyright (C) 2014 Cloudius Systems, Ltd. # # This work is open source software, licensed under the terms of the # BSD license as described in the LICENSE file in the top-level directory. # from osv.modules.filemap import FileMap from osv.modules import api import os, os.path provides = ['java'] api.require('fonts') api.require('ca-certificates') api.require('libz') api.require('josvsym') api.require('httpserver-jolokia-plugin') api.require('httpserver-jvm-plugin') usr_files = FileMap() usr_files.add('${OSV_BASE}/apps/openjdk8-fedora/install').to( '/').allow_symlink() usr_files.add('${OSV_BASE}/apps/openjdk8-fedora/install/usr/lib/jvm/java') \ .to('/usr/lib/jvm/java') \ .allow_symlink() usr_files.link('/usr/lib/jvm/jre').to('/usr/lib/jvm/java/jre')
from osv.modules.filemap import FileMap from osv.modules import api import os, os.path usr_files = FileMap() api.require('fonts') api.require('ca-certificates') api.require('libz') api.require('josvsym') jdkdir = os.path.basename(os.path.expandvars('${jdkbase}')) usr_files.add('${jdkbase}').to('/usr/lib/jvm/java') \ .include('lib/**') \ .include('jre/**') \ .exclude('jre/lib/security/cacerts') \ .exclude('jre/lib/audio/**') usr_files.link('/usr/lib/jvm/' + jdkdir).to('java') usr_files.link('/usr/lib/jvm/jre').to('java/jre') usr_files.link('/usr/lib/jvm/java/jre/lib/security/cacerts').to('/etc/pki/java/cacerts')
from osv.modules import api api.require('httpserver-html5-gui') api.require('httpserver-html5-cli') _exe = '/libhttpserver-api.so --config-file=/etc/httpserver.conf' daemon = api.run_on_init(_exe + ' &!') fg = api.run(_exe) fg_ssl = api.run(_exe + ' --ssl') fg_cors = api.run(_exe + ' --access-allow=true') default = daemon
from osv.modules import api from osv.modules.filemap import FileMap api.require('java') _jar = '/tests/java/tests.jar' _isolates_jar = '/tests/java/isolates.jar' usr_files = FileMap() usr_files.add('${OSV_BASE}/java/tests/target/runjava-tests.jar').to(_jar) usr_files.add('${OSV_BASE}/java/tests-isolates/target/tests-isolates-jar-with-dependencies.jar').to(_isolates_jar) usr_files.add('${OSV_BASE}/java/tests/target/classes/tests/ClassPutInRoot.class').to('/tests/ClassPutInRoot.class') usr_files.add('${OSV_BASE}/java/tests-jre-extension/target/tests-jre-extension.jar') \ .to('/usr/lib/jvm/java/jre/lib/ext/tests-jre-extension.jar') default = api.run_java(classpath=[_jar, _isolates_jar], args=['-Disolates.jar=' + _isolates_jar, 'org.junit.runner.JUnitCore', 'io.osv.AllTests'])
from osv.modules import api api.require('perl') default = api.run(cmdline="/osv/bin/perl hello.pl")
from osv.modules import api from osv.modules.filemap import FileMap api.require('java') _jar = '/tests/java/tests.jar' _isolates_jar = '/tests/java/isolates.jar' usr_files = FileMap() usr_files.add('${OSV_BASE}/java/tests/target/runjava-tests.jar').to(_jar) usr_files.add( '${OSV_BASE}/java/tests-isolates/target/tests-isolates-jar-with-dependencies.jar' ).to(_isolates_jar) usr_files.add( '${OSV_BASE}/java/tests/target/classes/tests/ClassPutInRoot.class').to( '/tests/ClassPutInRoot.class') usr_files.add('${OSV_BASE}/java/tests-jre-extension/target/tests-jre-extension.jar') \ .to('/usr/lib/jvm/java/jre/lib/ext/tests-jre-extension.jar') default = api.run_java(classpath=[_jar, _isolates_jar], args=[ '-Disolates.jar=' + _isolates_jar, 'org.junit.runner.JUnitCore', 'io.osv.AllTests' ])
from osv.modules import api api.require('java8') _catalina_base = "/usr/tomcat" _catalina_home = _catalina_base _catalina_tmpdir = "/tmp/catalina" _classpath = [_catalina_home + "/bin/bootstrap.jar"] _logging_config = [ "-Djava.util.logging.config.file=%s/conf/logging.properties" % _catalina_base, "-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" ] _classpath.append("%s/bin/tomcat-juli.jar" % _catalina_base) default = api.run_java(classpath=_classpath, args=_logging_config + [ "-Dcatalina.base=%s" % _catalina_base, "-Dcatalina.home=%s" % _catalina_base, "-Djava.io.tmpdir=%s" % _catalina_tmpdir, "org.apache.catalina.startup.Bootstrap", "start" ])
# # Copyright (C) 2014 Cloudius Systems, Ltd. # # This work is open source software, licensed under the terms of the # BSD license as described in the LICENSE file in the top-level directory. # from osv.modules.filemap import FileMap from osv.modules import api api.require('java-non-isolated') provides = ['java', 'java8', 'java9', 'java10'] usr_files = FileMap() usr_files.add('${OSV_BASE}/apps/openjdk10-java-base/install').to( '/').allow_symlink() usr_files.add('${OSV_BASE}/apps/openjdk10-java-base/install/usr/lib/jvm/java') \ .to('/usr/lib/jvm/java') \ .allow_symlink()
from osv.modules import api api.require('libz') default = api.run( '--env=HOSTNAME=localhost /elasticsearch/java/bin/java' ' -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly ' ' -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true ' ' -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true ' ' -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=/tmp ' ' -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=data ' ' -Djava.locale.providers=COMPAT -Dio.netty.allocator.type=unpooled -XX:MaxDirectMemorySize=536870912 ' ' -Des.path.home=/elasticsearch -Des.path.conf=/elasticsearch/config -Des.distribution.flavor=default -Des.distribution.type=tar -Des.bundled_jdk=true ' ' -cp /elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch !')
# # Copyright (C) 2016 Waldemar Kozaczuk # # This work is open source software, licensed under the terms of the # BSD license as described in the LICENSE file in the top-level directory. # from osv.modules.filemap import FileMap from osv.modules import api api.require('java-non-isolated') provides = ['java','java8'] usr_files = FileMap() usr_files.add('${OSV_BASE}/apps/openjdk8-zulu-compact2/install').to('/').allow_symlink() usr_files.add('${OSV_BASE}/apps/openjdk8-zulu-compact2/install/usr/lib/jvm/java') \ .to('/usr/lib/jvm/java') \ .allow_symlink() usr_files.link('/usr/lib/jvm/jre').to('/usr/lib/jvm/java/jre')
import os from osv.modules.api import * from osv.modules.filemap import FileMap from osv.modules import api provides = ['httpserver-api'] _module = '${OSV_BASE}/modules/httpserver-monitoring-api' _exe = '/libhttpserver-api.so' usr_files = FileMap() usr_files.link(_exe).to('/usr/lib/libhttpserver-api.so') usr_files.add(os.path.join(_module, 'api-doc')).to('/usr/mgmt/api') api.require('libtools') # httpserver will run regardless of an explicit command line # passed with "run.py -e". daemon = api.run_on_init(_exe + ' --access-allow=true &!') fg = api.run(_exe + ' --access-allow=true') default = daemon