// Helper for basic YAML const getYaml = (dest, options, lando) => { // Get existing lando if we have it const existingLando = (fs.existsSync(dest)) ? lando.yaml.load(dest) : {}; // Set the basics const landoConfig = {name: options.name, recipe: options.recipe}; // Set the webroot if we have one if (!_.isEmpty(options.webroot)) _.set(landoConfig, 'config.webroot', options.webroot); // Return merged YAML return _.merge(existingLando, landoConfig); }
constructor(id, options = {}, ...sources) { // Set some other options and mixin stuffs options.labels['io.lando.service-container'] = 'TRUE'; options.env.LANDO_NO_USER_PERMS = 'NOTGONNADOIT'; // Add some some globals to the service sources.push({services: _.set({}, options.name, {environment: options.env, labels: options.labels})}); // Send downstream super(id, options, ...sources); }
constructor(id, options = {}) { options = _.merge({}, config, options); options.services = _.merge({}, getServices(options), options.services); options.tooling = _.merge({}, getTooling(options), options.tooling); options.proxy = _.set({}, 'appserver', [`${options.app}.${options._app._config.domain}:${options.port}`]); super(id, options); }
constructor(id, options = {}) { options = _.merge({}, config, options); const redis = { image: `redis:${options.version}`, command: 'docker-entrypoint.sh redis-server /usr/local/etc/redis/redis.conf', volumes: [ `${options.confDest}/${options.defaultFiles.server}:${options.remoteFiles.server}`, ], }; // Set persistence to true if (options.persist) redis.command = `${redis.command} --appendonly yes`; // Send it downstream super(id, options, {services: _.set({}, options.name, redis)}); }
constructor(id, options = {}) { options = _.merge({}, config, options); // Rebase on top of any default config we might already have options.defaultFiles = _.merge({}, getConfigDefaults(_.cloneDeep(options)), options.defaultFiles); options.services = _.merge({}, getServices(options), options.services); options.tooling = _.merge({}, getTooling(options), options.tooling); // Switch the proxy if needed if (!_.has(options, 'proxyService')) { if (_.startsWith(options.via, 'nginx')) options.proxyService = 'appserver_nginx'; else if (_.startsWith(options.via, 'apache')) options.proxyService = 'appserver'; } options.proxy = _.set({}, options.proxyService, [`${options.app}.${options._app._config.domain}`]); // Downstream super(id, options); }
_(cmds) // Set service if needed .map(cmd => _.isString(cmd) ? _.set({}, fallback, cmd) : cmd) // Extract the service data .map(cmd => _.map(cmd, (cmd, service) => ([service, cmd]))) // Flatten the thing .flatten() // Prefix if needed .map(data => { if (_.includes(needsPrefix, data[0])) data[1] = `/helpers/psh-exec.sh ${data[1]}`; return _.set({}, data[0], data[1]); }) // Return .value()
constructor(id, options = {}, ...sources) { sources.push({services: _.set({}, options.name, { environment: { LANDO_WEBROOT: `/app/${options.webroot}`, LANDO_SERVICE_TYPE: 'webserver', }, working_dir: '/app', })}); // Add in relevant info options.info = _.merge({}, options.info, { webroot: options.webroot, }); super(id, options, ...sources); }
constructor(id, options = {}, factory) { options = _.merge({}, config, options); // Build chrome-headless const chromeHeadless = { image: `docker.registry.platform.sh/chrome-headless-${options.version}`, ports: [options.port], environment: { LANDO_WEBROOT_USER: options.meUser, LANDO_WEBROOT_GROUP: options.meUser, }, }; // Add in the chrome-headless service and push downstream super(id, options, {services: _.set({}, options.name, chromeHeadless)}); }
constructor(id, options = {}) { options = _.merge({}, config, options); // Make sure our command is an array if (!_.isArray(options.command)) options.command = [options.command]; options.command = options.command.join(' && '); // Build the goz const go = { image: `golang:${options.version}`, ports: (options.command !== 'tail -f /dev/null') ? ['80'] : [], command: `/bin/sh -c "${options.command}"`, }; // Send it downstream super(id, options, {services: _.set({}, options.name, go)}); }
constructor(id, options = {}, factory) { options = _.merge({}, config, options); // Build the cli const cli = { environment: _.merge({}, options.environment, { PATH: options.path.join(':'), }), volumes: options.volumes, command: options.command, }; // Add in the cli service and push downstream super(id, options, {services: _.set({}, options.name, cli)}); }
constructor(id, options = {}, factory) { options = _.merge({}, config, options); // Build varnish const varnish = { image: `docker.registry.platform.sh/varnish-${options.version}`, ports: options.moreHttpPorts, environment: { LANDO_WEBROOT_USER: options.meUser, LANDO_WEBROOT_GROUP: options.meUser, }, }; // Add in the varnish service and push downstream super(id, options, {services: _.set({}, options.name, varnish)}); }
constructor(id, options = {}, factory) { options = _.merge({}, config, options); // Build the php const php = { environment: _.merge({}, options.environment, { PATH: options.path.join(':'), }), volumes: options.volumes, command: options.command, }; // Add in the php service and push downstream super(id, options, {services: _.set({}, options.name, php)}); }