Managing Timezones

wfarr edited this page Jan 3, 2011 · 2 revisions

You can use Moonshine to easily configure the time zone your server uses by setting the time_zone configuration option in a Moonshine YAML file such as config/moonshine.yml or config/moonshine/production.yml.

Below is a list of sample time zones:

  • America/Los_Angeles
  • America/New_York
  • Australia/Brisbane
  • Europe/Berlin

To find your specific timezone, you can use the tzselect command.

Let's pretend we wanted to configure our server to be in the Eastern timezone in the United States. We'd start by running tzselect at the terminal on the server:

$ tzselect

Next we'd see prompts to choose our region/continent, a country, and the desired timezone. Once you've selected all those things, you'll be prompted with a yes or no prompt. If you select yes, tzselect will spit out a few things that looks like this:

You can make this change permanent for yourself by appending the line
        TZ='America/New_York'; export TZ
to the file '.profile' in your home directory; then log out and log in again.
Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
America/New_York

The very last line of that output is the name of the timezone you should set in Moonshine. In this case, our configuration in Moonshine would look like this:

# Timezone to set server's time to. Defaults to UTC
:time_zone: America/New_York

Having saved and committed that change, on our next deploy the server will automatically set itself use the EST timezone.