### Add Lyrid Client to PATH Source: https://docs.lyrid.io/installation To use the Lyrid Client (lc binary) easily from any directory, move the downloaded binary to a directory included in your system's PATH environment variable. ```Shell mv /path/to/downloaded/lc /usr/local/bin/ ``` -------------------------------- ### Dockerfile for Node.js Application Source: https://docs.lyrid.io/deploydocker This Dockerfile sets up a Node.js environment for version 16. It copies the application code, installs dependencies, exposes port 80, and defines the command to start the application. ```docker FROM node:16-alphine WORKDIR /usr/src/app COPY . . RUN npm install EXPOSE 80 CMD [ "npm", "run", "start-temp" ] ``` -------------------------------- ### Example Express.js Application Code Source: https://docs.lyrid.io/tutorials/expressjs A complete example of an Express.js application, including middlewares like 'morgan', API endpoints for environment variables and version information, static file serving, and a default route handler. ```javascript const express = require('express'); const path = require('path'); const app = express(); // Middlewares var morgan = require('morgan') app.use(morgan('combined')) app.get('/env', function(req, res) { res.json(process.env) }) app.get('/env/:key', function(req, res) { const envkey = req.params.key res.json({ [envkey]: process.env[envkey] }) }) // Default Routes - Static file + index.html handler app.use(express.static(path.join(path.resolve(), 'dist'))); app.get('/', function(req, res) { res.sendFile(path.join(process.cwd(), 'dist/index.html')); }); app.get('/api/version', function(req, res) { res.json({ 'NodeJS Version': process.version, 'Cloud Environment': v1.0.0-alpha }) }); // Error handler app.use((err, req, res, next) => { res.status(500).send('Internal Serverless Error: ' + err); }); module.exports = app; ``` -------------------------------- ### Express.js Application Entry Point Source: https://docs.lyrid.io/tutorials/expressjs Shows how to import and start an Express.js application within the Lyrid environment. It demonstrates listening on a specified port and exporting the app instance. ```javascript const entry = require('./src/'); // ...... const port = process.env.PORT || 3000; entry.listen(port, () => { console.log('Listening on port', port); }); ``` -------------------------------- ### File Exclusion Example Visualization Source: https://docs.lyrid.io/deployconfig Provides a visual representation of how files and directories are ignored based on the 'ignoreFiles' configuration in the Lyrid definition. ```bash projectRoot |_ .env --- IGNORED |_ node_modules --- IGNORED |_ etc --- IGNORED |_ ... --- IGNORED |_ .yarn.lock ``` -------------------------------- ### Sample GitHub Pipeline Script for Lyrid Deployment Source: https://docs.lyrid.io/cicdquickstart This shell script is designed for Linux environments and automates the process of downloading the Lyrid Client (lc), configuring it with access keys, cloning a GitHub repository, and submitting the code to Lyrid for deployment. It requires user-specific variables for keys and repository details. ```Bash mkdir -p ~/lyrid_deployment cd ~/lyrid_deployment curl https://api.lyrid.io/client/dl/linux --output /usr/local/bin/lc && chmod +x /usr/local/bin/lc lc config add --config lyrid_deployment_config_name --key --secret git clone https://.git cd ./ lc code submit --rid apsoutheast1 ``` -------------------------------- ### Example Lyrid Definition for Node.js 16 Source: https://docs.lyrid.io/tutorials/expressjs Provides a sample `.lyrid-definition.yml` for a Node.js 16 Express application. It includes application metadata, ignored files, and module configuration with the 'entry' function. ```yaml name: nodejs16_sample_1 description: App Description ignoreFiles: .git node_modules modules: - name: template language: nodejs16.x web: express description: Module description functions: - name: entry description: the entry point for the function ``` -------------------------------- ### Example of Ignoring Files in Lyrid Source: https://docs.lyrid.io/deployconfig Illustrates how to specify files and directories to be ignored during the Lyrid deployment process using the 'ignoreFiles' directive in the .lyrid-definition.yml. ```yaml ignoreFiles: .env node_modules ``` -------------------------------- ### Monitor Specific App and Module Activities Source: https://docs.lyrid.io/monitor This example demonstrates monitoring all activities for 'App1' within 'Module1'. It uses a specific pattern to target the desired application and module. ```Bash lc monitor -c "App1.Module1.*" ``` -------------------------------- ### Create Cronjob API Endpoint Example Source: https://docs.lyrid.io/cronjob This snippet demonstrates how to create a service that exposes an API endpoint to trigger a script execution. The cronjob will then call this endpoint. ```Conceptual Create a service that exposes an API endpoint (/api/startMyScript) that will execute your script Create a cronjob that hits that API (/api/startMyScript) ``` -------------------------------- ### Monitor Specific App, Module, and Build Activity Source: https://docs.lyrid.io/monitor This example shows how to monitor only the 'build' activities for 'App1' in 'Module1' with the 'latest' tag. It uses a detailed pattern to narrow down the monitoring scope. ```Bash lc monitor -c "App1.Module1.latest.build.*" ``` -------------------------------- ### List Available Lyrid Client Configurations Source: https://docs.lyrid.io/initialization Lists all the currently configured access and secret keys that can be used with the Lyrid CLI. This helps in managing multiple configurations. ```bash lc config list ``` -------------------------------- ### Display Help for Submit Command Source: https://docs.lyrid.io/appdeployfunction Access a comprehensive list of options and in-depth usage details for the Lyrid Client (lc) submit command. ```bash lc code submit --help ``` -------------------------------- ### Get Cloud Environment Variable Source: https://docs.lyrid.io/swagger This snippet demonstrates how to retrieve the 'CLOUD_ENV' environment variable using Go. This is often used to configure application behavior based on the deployment environment. ```Go os.Getenv("CLOUD_ENV") ``` -------------------------------- ### Initialize Lyrid CLI with Access Key Source: https://docs.lyrid.io/terminologies This section explains how to initialize the Lyrid Command Line Interface (CLI) using an Access Key and Secret Key pair. These keys are essential for authenticating with the Lyrid platform and accessing its services. ```bash lyrid init --access-key --secret-key ``` -------------------------------- ### Lyrid Definition for Docker Deployment Source: https://docs.lyrid.io/appinitial This YAML snippet defines an application for deployment using Docker on the Lyrid platform. It includes application details, ignored files, and module information, specifying 'docker' as the language and defining network ports for the container. ```YAML name: description: ignoreFiles: .git venv __pycache__ modules: - name: language: docker description: functions: - name: description: ports: - alias: "http" port: 80 ``` -------------------------------- ### Add Default Lyrid Client Configuration Source: https://docs.lyrid.io/initialization Initializes the Lyrid CLI with a default configuration using provided access key and secret key. This command stores the credentials in the local user's home directory under the .lc folder. ```bash lc config add --config "default" --key "" --secret "" ``` -------------------------------- ### Generate New Lyrid Keys Source: https://docs.lyrid.io/generatekeys This section explains how to generate new access and secret keys within the Lyrid Web Application. Users are guided to the 'My Account / IAM' section to create keys, name them, restrict access, and generate them. It emphasizes saving the secret key as it will not be accessible after closing the page. ```text Navigate to Lyrid Web Application / My Account / IAM. Click the "+ Create" button. Enter a key name (or leave as default). Select "restrict access". Click "generate keys". Save the displayed Secret key immediately. ``` -------------------------------- ### Switch Current Lyrid Client Configuration Source: https://docs.lyrid.io/initialization Selects a specific configuration context to be used by the Lyrid CLI. Only one configuration can be active at a time. ```bash lc config select --config "" ``` -------------------------------- ### Go Project File Structure Source: https://docs.lyrid.io/deployconfig Defines the standard file structure for a Lyrid project using Go. It includes the main Go module, environment variables, and the entry point for functions. ```Go . │ .env << Environment Variable │ .lyrid-definition.yml << Module Definition │ go.mod │ main.go << Main │ └─── entry.go << Entry Function ``` -------------------------------- ### Lyrid Definition for Next.js (Serverless) Source: https://docs.lyrid.io/appinitial This YAML snippet defines a Next.js application for deployment using Lyrid's serverless mode with Node.js 16. It specifies the application name, description, files to ignore, and module details including language and web framework. ```YAML name: description: ignoreFiles: .git .next node_modules .husky .eslintrc.js yarn.lock package-lock.json modules: - name: language: nodejs16.x web: nextjs description: functions: - name: fn entry: entry.js description: ``` -------------------------------- ### Submit Application via Terminal Source: https://docs.lyrid.io/appdeployfunction This command zips the current folder containing the .lyrid-definition.yaml file and uploads it to the Lyrid platform for analysis and build artifact creation. Upon completion, it provides the endpoint for invoking your function. ```bash lc code submit ``` -------------------------------- ### Lyrid Definition for Container Deployment Source: https://docs.lyrid.io/deploydocker This YAML file defines the configuration for deploying a container on the Lyrid platform. It specifies the application name, description, ignored files, module details including language, container configuration, exposed ports, and functions. ```yaml name: ApplicationName description: some description ignoreFiles: node_modules scripts test .dockerignore .env modules: - name: container language: docker description: Module description container: volumes: ports: - alias: "http" port: 80 functions: - name: DockerContainerName description: some description ``` -------------------------------- ### Clear All Lyrid Client Configurations Source: https://docs.lyrid.io/initialization Removes all stored configurations, including all access keys and secret keys, from the local machine. This effectively resets the Lyrid CLI's authentication settings. ```bash lc config clear ``` -------------------------------- ### Lyrid Definition for Express.js App Source: https://docs.lyrid.io/tutorials/expressjs Illustrates the structure of the `.lyrid-definition.yml` file for an Express.js application. It specifies the application name, module details including language and web framework, and function configurations. ```yaml # Your .lyrid-definition.yml name: # ...... modules: - name: language: nodejs(12|14|16|18).x web: express # ...... functions: - name: # ...... ``` -------------------------------- ### Python Project File Structure Source: https://docs.lyrid.io/deployconfig Illustrates the typical file structure for a Lyrid project using Python. It highlights the main Python file, dependencies, and the structure for function entry points. ```Python . │ .env << Environment Variable │ .lyrid-definition.yml << Module Definition │ main.py << Main │ requirements.txt │ __init__.py │ └─── entry.py << Entry Function __init__.py ``` -------------------------------- ### Express.js Project Structure for Lyrid Source: https://docs.lyrid.io/tutorials/expressjs Defines the expected directory structure for an Express.js project deployed on Lyrid. The `src` directory should contain the main application export, and `.lyrid-definition.yml` is crucial for Lyrid's configuration. ```plaintext projectRoot |___ src |___ |___ index.js |___ .lyrid-definition.yml ** ``` -------------------------------- ### C# Project File Structure Source: https://docs.lyrid.io/deployconfig Details the conventional file structure for a Lyrid project developed with C#. It includes the project file, main program file, and the specific structure for function entry points. ```C# . │ .env << Environment Variable │ .lyrid-definition.yml << Module Definition │ DotNetApp.DotNetModule.csproj │ Program.cs << Main │ └───DotNetFunction entry.cs << Entry Function ``` -------------------------------- ### View Deployment Details Source: https://docs.lyrid.io/appmanage Displays key information about a specific application revision, including its name/ID, region, memory usage, endpoint, and logs. This helps in monitoring and debugging deployed applications. ```Markdown `Name / ID` - The revision Id (You can treat this as metadata) `Region` - Deployed region for revision `Memory` - Memory used for revision as stated in Policy `Endpoint` - Your endpoint in Lyrid's platform (You can treat this as metadata) `Log` - View your revision's logs. Any print statements in your application will be visible here ``` -------------------------------- ### Lyrid Definition YAML Structure Source: https://docs.lyrid.io/deployconfig Defines the basic structure of the .lyrid-definition.yml file, outlining fields for application name, description, ignored files, and module configurations including language, framework, and function entry points. ```yaml name: description: ignoreFiles: modules: - name: language: web: description: functions: - name: entry: description: ``` -------------------------------- ### Attach Domain via Lyrid Platform UI Source: https://docs.lyrid.io/appdomain This snippet outlines the steps to attach a custom domain to a deployed Lyrid application using the platform's user interface. It involves adding the domain to the account and then associating it with the specific application. ```UI Steps 1. Navigate to Application details. 2. Select the 'Domain' option. 3. Input 'your.domain.com' in the 'Add Domain' field. 4. Click 'Attach' to link the domain to the application. ``` -------------------------------- ### NodeJS (Express) Project File Structure Source: https://docs.lyrid.io/deployconfig Presents the standard file organization for a Lyrid project utilizing NodeJS with the Express framework. It shows the main JavaScript file, package configuration, and function entry points. ```JavaScript . │ .env << Environment Variable │ .lyrid-definition.yml << Module Definition │ index.js << Main │ package.json │ └───src └─── entry.js << Entry Function index.js ``` -------------------------------- ### Lyrid Definition for Next.js Source: https://docs.lyrid.io/tutorials/nextjs This snippet shows the basic structure of a .lyrid-definition.yml file for a Next.js application, specifying the module name, Node.js version, and web framework. ```yaml name: // ...... modules: - name: language: nodejs(14|16|18).x web: nextjs // ...... ``` -------------------------------- ### Check Lyrid User Info and Key Validity Source: https://docs.lyrid.io/useraccmanage This command allows you to verify the validity of your access key and retrieve your user information. Ensure your internet connection is stable and your Access Key and Secret Key are correctly configured if you encounter errors. ```bash lc user info ``` -------------------------------- ### Filter Serverless Activities by Pattern Source: https://docs.lyrid.io/monitor Filter monitoring output by specifying a pattern that includes application name, module name, tag, and activity type. The wildcard '*' can be used to match any value for a specific field. ```Bash lc monitor -c "{app_name}.{module_name}.{tag_name}.{activity}.*" ``` -------------------------------- ### Submit Application in Distributed Regions Source: https://docs.lyrid.io/appdeployfunction Deploy your application to multiple regions to leverage Lyrid's traffic management, directing users to the nearest server. This feature is available for Pro Users and above. ```bash lc code submit -d ``` -------------------------------- ### Check Lyrid User Account Information Source: https://docs.lyrid.io/useraccmanage This command retrieves detailed information about your user account on the Lyrid platform. It's a straightforward way to access your account-specific data. ```bash lc user account ``` -------------------------------- ### Monitor All Serverless Activities Source: https://docs.lyrid.io/monitor This command monitors all serverless activities across your applications. On Unix-like systems (macOS, Linux), use single quotes around the wildcard character '*' for correct interpretation. ```Bash lc monitor -c * ``` ```Bash lc monitor -c '*' ``` -------------------------------- ### Cronjob Limits Source: https://docs.lyrid.io/appmanage Outlines the limitations on creating cronjobs for different user tiers on the Lyrid platform. It specifies the maximum number of cronjobs allowed and the minimum execution frequency. ```Markdown Free - Not allowed Pro - 10 Enterprise - Unlimited Currently you are only allowed to schedule a cronjob that runs no faster than once every 30 minutes ``` -------------------------------- ### Delete Specific Lyrid Client Configuration Source: https://docs.lyrid.io/initialization Deletes a single, specified configuration from the Lyrid CLI's local storage. This is useful for removing outdated or unused credentials. ```bash lc config delete --config "" ``` -------------------------------- ### Lyrid Definition for Next.js Standalone Mode Source: https://docs.lyrid.io/tutorials/nextjs This snippet shows the .lyrid-definition.yml configuration for deploying a Next.js application in standalone mode, specifying the 'next.standalone' web type and the appropriate Node.js version. ```yaml // Your .lyrid-definition.yml name: // ...... modules: - name: language: nodejs(16|18).x web: next.standalone // ...... ```