Skip to content
This repository has been archived by the owner on Jun 13, 2022. It is now read-only.

Locales "not working" as expected, via Docker #592

Open
1 task done
JoshuaSmeda opened this issue Aug 27, 2020 · 3 comments
Open
1 task done

Locales "not working" as expected, via Docker #592

JoshuaSmeda opened this issue Aug 27, 2020 · 3 comments

Comments

@JoshuaSmeda
Copy link

JoshuaSmeda commented Aug 27, 2020

  • I confirm that this is a issue rather than a question.

Bug report

Version

Docker version (master branch)

Steps to reproduce

Dockerfile:


FROM node:8-alpine AS builder

ENV STATUSFY_VERSION 0.4.1
ENV NODE_ENV production

WORKDIR /usr/src/app

COPY ./config.js /usr/src/app/config.js

RUN mkdir $WORKDIR/locales

COPY --chown=node:node ./en.json $WORKDIR/locales/en.json

RUN set -x \
&& yarn install \
&& yarn add "statusfy@$STATUSFY_VERSION" \
&& npx statusfy build

FROM node:8-alpine

ENV NODE_ENV production
ENV HOST 0.0.0.0
ENV PORT 3000
ENV WORKDIR /usr/src/app

COPY --from=builder --chown=node:node /usr/src/app/ $WORKDIR
COPY ./config.js /usr/src/app/config.js
COPY ./en.json $WORKDIR/locales/en.json

COPY ./docker-start.sh /start.sh

WORKDIR $WORKDIR
VOLUME $WORKDIR
EXPOSE $PORT

CMD ["/start.sh"]

docker-compose.yml:

version: '2'
services:
  statusfy:
    build: .
    volumes:
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped
    ports:
      - "3000:3000"

config.js:

module.exports = {
  title: 'Title',
  description: 'Description',
  baseUrl: 'https://demo.statusfy.co',
  defaultLocale: 'en',
  locales: [
    { code: 'en', iso: 'en-US', name: 'English' },
  ],
  content: {
    frontMatterFormat: 'yaml',
    systems: [
      'cdn',
      'donkey',
      'conversions',
      'site-delivery',
      'api'
    ]
  },
  theme: {
    scheduled: {
      position: 'aboveGlobalStatus'
    }
  },
  head: {
    link: [
      { rel: 'mask-icon', href: '/icons/safari-pinned-tab.svg', color: '#3e4e88' }
    ]
  }
}

docker-start.sh:

#!/bin/sh
set -e

echo "Starting server..."
npx statusfy start

en.json:

{
    "title": "System TEST!",
    "description": "Keep up to date with real-time and historical interruptions to our service which may be affecting you.",
    "labels": {
      "contact": "Contact",
      "support": "Support",
      "home": "Home",
      "powered-by": "Powered by"
    },
    "statuses": {
      "under-maintenance": "Under Maintenance",
      "degraded-performance": "Degraded Performance",
      "partial-outage": "Partial Outage",
      "major-outage": "Major Outage",
      "operational": "Operational"
    },
    "dates": {
      "formats": {
        "short": "MMM D, YYYY",
        "long": "MMM D, HH:mm UTC",
        "month": "MMMM YYYY"
      }
    },
    "incidents": {
      "incidents": "Incidents",
      "incident": "Incident",
      "scheduled": "Scheduled Maintenance",
      "incidents-history": "Incidents History",
      "incidents-history-description": "Current & Historical operational interruptions to our service.",
      "incidents-history-days-since-latest": "1 day since last incident | {days} days since last incident",
      "latest-incidents": "Latest Incidents",
      "current-status": "Current Status",
      "current-status-description": "Keep up to date with real-time and historical interruptions to our service which may be affecting you.",
      "no-incidents": "No incidents reported.",
      "resolved": "Resolved",
      "unresolved": "Unresolved",
      "paginator": {
        "previous": "Previous Page",
        "next": "Next Page",
        "page": "Page"
      },
      "collapse": {
        "show": "Show all {count} Incidents",
        "hide": "Show less Incidents"
      }
    },
    "error": {
      "go-back-link": "Go back to homepage",
      "404": {
        "title": "Page not found",
        "description": "The page you were looking for was not found"
      },
      "other": {
        "title": "An error occurred",
        "description": "We're sorry, but we cannot fulfill your request"
      }
    },
    "systems": {
      "items": {
        "cdn": {
          "title": "CDN",
          "description": "WOW!"
        },
        "donkey": {
            "title": "test!",
            "description": "Test desc!"
        },
        "site-delivery": {
          "title": "Site delivery"
        },
        "api": {
          "title": "API",
          "description": "The API Endpoints any developers can access to"
        }
      }
    },
    "notifications": {
      "title": "Subscribe to Updates",
      "description": "Choose from the options below to automatically receive status updates.",
      "buttons": {
        "subscribe": "Subscribe",
        "close": "Close"
      },
      "items": {
        "icalendar": {
          "title": "Calendar",
          "description": "Receive <strong>Scheduled Maintenances</strong> via <a href=\"{url}\" target=\"_blank\" rel=\"noopener\">iCalendar</a>."
        },
        "feeds": {
          "title": "Feeds",
          "description": "Get <a href=\"{atom_url}\" target=\"_blank\" rel=\"noopener\">the Atom Feed</a> or <a href=\"{rss_url}\" target=\"_blank\" rel=\"noopener\">the RSS Feed</a>."
        },
        "twitter": {
          "title": "Twitter",
          "description": "or <a href=\"https://twitter.com/{username}\" target=\"_blank\" rel=\"noopener\">view our Profile</a>."
        },
        "support": {
          "title": "Support",
          "description": "Visit our <a href=\"{url}\" target=\"_blank\" rel=\"noopener\">Support Site</a>."
        },
        "webpush": {
          "title": "Push",
          "description": "Notifications delivered to your browser.",
          "enable": "Enable Notifications",
          "enabled": "Notifications are enabled for this browser."
        }
      }
    }
  }

Run docker-compose up --build.

You would expect the title to update but it doesn't work. Even tried editing the pre configured locale files but doesn't work.

image

Attempted to re-build as well to produce new static content but the application breaks...

/usr/src/app/node_modules/@statusfy/core/client/locales # npx statusfy build
module.js:550
    throw err;
    ^

Error: Cannot find module '/root/.npm/_npx/33/lib/node_modules/statusfy/node_modules/ejs/postinstall.js'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node ./postinstall.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-08-27T10_20_37_482Z-debug.log
Install for statusfy@latest failed with code 1

How am I supposed to update the title name? I followed this:

https://docs.statusfy.co/config/#dir
https://docs.statusfy.co/guide/i18n/#automatic-routes-generation-prefixed-with-locale-code

What is expected?

The system status title is supposed to update to the correct locale title.

What is actually happening?

The system status title is not updating as it should based on the locale settings.

Other relevant information

  • Your OS: Linux
  • Node.js version: Docker version
  • Browser version: Version 84.0.4147.135 (Official Build) (64-bit)
  • Is this a global or local install? Docker
  • Which package manager did you use for the install? Docker (npx)
@JoshuaSmeda
Copy link
Author

JoshuaSmeda commented Aug 27, 2020 via email

@JoshuaSmeda JoshuaSmeda changed the title Locales "not working" as expected. Frontend not updating via Docker. Locales "not working" as expected, via Docker Aug 27, 2020
@mgoeppl
Copy link

mgoeppl commented Sep 6, 2020

Same problem here. Quite annoying as I am trying to switch to Docker completely.

@iamdempa
Copy link

Someone fixed this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants