{"id":21192161,"url":"https://github.com/mu-semtech/static-file-service","last_synced_at":"2025-03-14T21:13:12.531Z","repository":{"id":84435965,"uuid":"206484076","full_name":"mu-semtech/static-file-service","owner":"mu-semtech","description":"Service to host static files, including single-page apps","archived":false,"fork":false,"pushed_at":"2021-01-03T11:34:44.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-21T13:43:57.428Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/mu-semtech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2019-09-05T05:44:59.000Z","updated_at":"2023-11-16T21:23:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"807eb629-34fb-4ed5-a97d-0b5a30c2ec79","html_url":"https://github.com/mu-semtech/static-file-service","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mu-semtech%2Fstatic-file-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mu-semtech%2Fstatic-file-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mu-semtech%2Fstatic-file-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mu-semtech%2Fstatic-file-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mu-semtech","download_url":"https://codeload.github.com/mu-semtech/static-file-service/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243646667,"owners_count":20324586,"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-11-20T19:07:46.511Z","updated_at":"2025-03-14T21:13:12.523Z","avatar_url":"https://github.com/mu-semtech.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# static-file-service\nMicroservice hosting static files from `/data`.\n\n## Getting started\n### Adding the service to your stack\nAdd the following snippet to your `docker-compose.yml` to include the static file service in your project.\n\n```yaml\nstatic-file:\n  image: semtech/static-file-service:0.2.0\n  volumes:\n    - ./data/static-files:/data\n```\n\nAdd rules to `dispatcher.ex` to dispatch requests to the static file service.\n\nE.g.\n```\n  get \"/assets/*path\" do\n    Proxy.forward conn, path, \"http://static-file/assets/\"\n  end\n```\n\n## How-to guides\n### How to build an image to host an Ember application\nAdd the following Dockerfile in the root of your Ember application\n\n```\nFROM madnificent/ember:3.22.0 as builder\n\nLABEL maintainer=\"john.doe@example.com\"\n\nWORKDIR /app\nCOPY package.json .\nRUN npm install\nCOPY . .\nRUN ember build -prod\n\nFROM semtech/static-file-service:0.2.0\n\nCOPY --from=builder /app/dist /data\n```\n\n### How to customize the Nginx configuration\nThe files are hosted by Nginx. The default Nginx configuration of the service is very minimal, but can be extended to your needs.\n\nCustom Nginx configurations with a name like `*.conf` can be mounted in `/config` and will be included automatically in the `server` block.\n\n#### Example configurations\n**Set caching to 30s**\n```\nlocation / {\n    add_header Cache-Control \"max-age=30, must-revalidate\";\n}\n```\n\n**Enable GZIP compression**\n```\ngzip on;\ngzip_types application/json application/vnd.api+json application/javascript text/css;\n```\n\n**Enable basic auth**\n```\nlocation / {\n    auth_basic \"Static file service\";\n    auth_basic_user_file /config/.htpasswd;\n}\n```\n\n### How to configure an Ember application at runtime using environment variables\n\nThe service can use environment variables to configure an Ember frontend build at runtime. This is typcially used for environment-specific (development, production, test, ...) configurations. On startup of the service, the environment variables prefixed with `EMBER_` will be used to fill in the values in `/data/index.html` with the value of the environment variables that match.\n\n#### Configuring placeholders in the Ember application\nUse placeholders like `{{MY_EXAMPLE}}` in the Ember configuration file `./config/environment.js` where values from an environment variable need to be filled in at runtime.\n\n```javascript\nif (environment === 'production') {\n    ENV.torii.providers['oauth2'].apiKey = '{{OAUTH_API_KEY}}'\n}\n```\n\n#### Set environment variables on the static-file service\nConfigure environment variables on the static-file service in `docker-compose.yml` containing the values to be replaced in the Ember configuration file. The environment variables need to be prefixed with `EMBER_`.\n\nE.g. for the placeholder `{{OAUTH_API_KEY}}` to be replaced, you need to configure an environment variable `EMBER_OAUTH_API_KEY`.\n\n```yaml\nservices:\n  static-file:\n    environment:\n      EMBER_OAUTH_API_KEY: \"my-api-key-for-production\"\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmu-semtech%2Fstatic-file-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmu-semtech%2Fstatic-file-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmu-semtech%2Fstatic-file-service/lists"}