{"id":23588040,"url":"https://github.com/zeropsio/start-commands-example","last_synced_at":"2025-10-24T22:39:50.335Z","repository":{"id":265475116,"uuid":"877121099","full_name":"zeropsio/start-commands-example","owner":"zeropsio","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-23T06:54:55.000Z","size":48,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-14T00:41:56.229Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zeropsio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-23T05:59:44.000Z","updated_at":"2024-10-23T14:26:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"243ada3c-2183-4134-aee3-3bb487cc99ec","html_url":"https://github.com/zeropsio/start-commands-example","commit_stats":null,"previous_names":["zeropsio/start-commands-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zeropsio/start-commands-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeropsio%2Fstart-commands-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeropsio%2Fstart-commands-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeropsio%2Fstart-commands-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeropsio%2Fstart-commands-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zeropsio","download_url":"https://codeload.github.com/zeropsio/start-commands-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeropsio%2Fstart-commands-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259845450,"owners_count":22920743,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-27T05:11:14.786Z","updated_at":"2025-10-24T22:39:50.287Z","avatar_url":"https://github.com/zeropsio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zerops startCommands example\n\nZerops containers are based on [Incus](https://linuxcontainers.org/incus/introduction/) containers, placing them\nat a midpoint between containerized processes (e.g., Docker) and full-fledged VMs (e.g., Proxmox).\nThis architecture allows Zerops to easily run multiple processes within a single container.\n\nThis example shows how to run Node.js application that uses SQLite along with [Litestream](https://litestream.io/),\nto persist the database throughout deployments.\n\n### [zerops.yml](https://github.com/zeropsio/start-commands-example/blob/main/zerops.yml)\n```yaml\nzerops:\n  - setup: api\n    build:\n      base: nodejs@20\n      prepareCommands:\n        - npm install -g typescript\n      buildCommands:\n        - npm i\n        - npm run build\n      deployFiles:\n        - ./dist\n        - ./node_modules\n        - ./package.json\n        - ./litestream.yml\n    run:\n      base: nodejs@20\n      # here we install litestream, downloading the packed\n      # binary for Alpine (the default OS used for Zerops containers)\n      # unpacking it and moving it to bin\n      prepareCommands:\n        - wget https://github.com/benbjohnson/litestream/releases/download/v0.3.13/litestream-v0.3.13-linux-amd64.tar.gz\n        - tar -xzf litestream-v0.3.13-linux-amd64.tar.gz\n        - rm litestream-v0.3.13-linux-amd64.tar.gz\n        - mv litestream /usr/local/bin/\n      ports:\n        - port: 3000\n          httpSupport: true\n      # for convinience, we save the name of our database file\n      # to environment variables\n      envVariables:\n        NODE_ENV: production\n        DB_NAME: database.db\n      # here instead of standard `start` property, we use `startCommands`\n      # which allows us to define multiple commands (both start and init)\n      # as well as name the set, to allow for convinient filtering in runtime logs\n      startCommands:\n        # start the application\n        - command: npm run start:prod\n          name: server\n        # start the replication\n        - command: litestream replicate -config=litestream.yml\n          name: replication\n          # restore the database on container init\n          initCommands:\n            - litestream restore -if-replica-exists -if-db-not-exists -config=litestream.yml $DB_NAME\n      healthCheck:\n        httpGet:\n          port: 3000\n          path: /status\n```\n\n\n### [litestream.yml](https://github.com/zeropsio/start-commands-example/blob/main/litestream.yml)\nLitestream configuration file. Litestream automatically replaces\nenvironment varibles, so we make use of the env variables Zerops\nautomatically generates for our object storage service.\n\n```yaml\naccess-key-id: $storage_accessKeyId\nsecret-access-key: $storage_secretAccessKey\n\ndbs:\n  - path: $DB_NAME\n    replicas:\n      - type: s3\n        path: $DB_NAME\n        bucket: $storage_bucketName\n        endpoint: $storage_apiUrl\n        force-path-style: true\n```\n\n## Test it yourself\nImport this project to your Zerops account.\n\n```yaml\nproject:\n  name: start-commands-example\n\nservices:\n  - hostname: storage\n    type: object-storage\n    objectStorageSize: 2\n\n  - hostname: api\n    type: nodejs@20\n    buildFromGit: https://github.com/zeropsio/start-commands-example\n    enableSubdomainAccess: true\n```\n\nFilter logs in Zerops GUI\n\u003cimg width=\"1647\" alt=\"image\" src=\"https://github.com/user-attachments/assets/5710a157-3b5d-4f6a-ad17-a8c20669d1fb\"\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeropsio%2Fstart-commands-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeropsio%2Fstart-commands-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeropsio%2Fstart-commands-example/lists"}