Running with Ruby

Tag: nas (page 1 of 2)

Synology DSM 6.2 Photo Station 6 – Failed to Load Data Fix

I’m a quite happy Synology user. For the past years I’ve been using it mostly to backup my things, so I didn’t pay much of an attention to the fact, that the Photo Station software would get slower and slower up to the point when I would end up with “Failed to load data” message each time I would access it.

Some articles suggested that you have to drop and re-create the media indexing database to fix it. However, this won’t help you in the long run. Your Photo Station 6 database will become bloated once again after a while.

The reason, why Photo Station 6 gets slower and slower, is the fact that Synology, for any crazy reason disabled the PostgreSQL AutoVacuum functionality. Vacuuming is suppose to keep your database in a good state

How to fix that once and for all? You need to enable the PostgreSQL AUTOVACUUM and for an immediate effect, you should also run the vacuuming manually.

SSH into your server and then:

sudo su
cd /volume1/@database/pgsql
vim postgresql.conf

Within the postgresql.conf file replace (or add if they don’t not exist) following settings:

wal_buffers =128MB
autovacuum = on
checkpoint_segments = 10

save, exit the file and reboot.

If you want to run vacuuming manually, log in into the PostgreSQL console:

psql -U postgres

List available databases:

postgres=# \l
                                       List of databases
    Name     |           Owner            | Encoding  | Collate | Ctype |   Access privileges   
-------------+----------------------------+-----------+---------+-------+-----------------------
 mediaserver | MediaIndex                 | SQL_ASCII | C       | C     | 
 ong         | SynologyApplicationService | SQL_ASCII | C       | C     | 
 photo       | PhotoStation               | SQL_ASCII | C       | C     | 
 postgres    | postgres                   | SQL_ASCII | C       | C     | 
 synosnmp    | postgres                   | SQL_ASCII | C       | C     | 
 template0   | postgres                   | SQL_ASCII | C       | C     | =c/postgres          +
             |                            |           |         |       | postgres=CTc/postgres
 template1   | postgres                   | SQL_ASCII | C       | C     | postgres=CTc/postgres+
             |                            |           |         |       | =c/postgres

Connect to the photo DB:

postgres=# \c photo;
You are now connected to database "photo" as user "postgres".

Check the tables size by running the following query:

SELECT nspname || '.' || relname AS "relation",
    pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size"
  FROM pg_class C
  LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
  WHERE nspname NOT IN ('pg_catalog', 'information_schema')
    AND C.relkind <> 'i'
    AND nspname !~ '^pg_toast'
  ORDER BY pg_total_relation_size(C.oid) DESC
  LIMIT 5;
       relation       | total_size 
----------------------+------------
 public.photo_image   | 1097 MB
 public.photo_log     | 5912 kB
 public.video_convert | 936 kB
 public.photo_share   | 928 kB
 public.video         | 864 kB
(5 rows)

and the potential vacuuming candidate should be obvious by now:

photo=# vacuum full public.photo_image;
VACUUM

Re-run the size checking query again just to see 93% size reduction of the images table:

       relation       | total_size 
----------------------+------------
 public.photo_image   | 72 MB
 public.photo_log     | 5912 kB
 public.video_convert | 936 kB
 public.photo_share   | 928 kB
 public.video         | 864 kB
(5 rows)

After that, everything will work blazing fast!

Synology DMS 6 + Gitlab Docker + Gmail

When you’ll setup your Gitlab instance using Synology DMS 6.0 UI, despite the fact that you’ve provided all the Gmail credentials, you will notice that it does not send any emails. You probably end up with a message similar to this one when:

EOFError: end of file reached

It may sound a bit enigmatic, but in general it means that your Gmail setup is wrong. Unfortunately you cannot change it using the UI. Fixing this requires a SSH connection.

Warning: I’m not responsible for any damages or injury, including but not limited to special or consequential damages, that result from your use of this instruction.

Stop your Gitlab using DMS UI

First, you need to stop your Gitlab instance via DMS UI:

  1. So to Package Manager
  2. Select Gitlab
  3. Select “Actions”
  4. Click on the “Stop” button

gitlab

Change your synology_gitlab.config via SSH

This one is a bit harder. Here are the th ings you need to know before you start:

  • How to log in via SSH into admin account
  • How to install (if you don’t have) vim (or any other console text editor)
  • How to navigate in a Linux shell

So, if you know this things, you are ready to go!

  1. Log in into your Synology server via SSH as admin user
  2. Become a root (sudo su + password)
  3. Go to /usr/syno/etc/packages/Docker (cd /usr/syno/etc/packages/Docker)
  4. Edit synology_gitlab.config (vim synology_gitlab.config)
  5. Replace or add given config options into the env_variables section
  6. Save the file

Those are the options you need to set:

{
  "key":"SMTP_ENABLED",
  "value":"true"
},
{
  "key":"SMTP_DOMAIN",
  "value":"www.gmail.com"
},
{
  "key":"SMTP_HOST",
  "value":"smtp.gmail.com"
},
{
  "key":"SMTP_PORT",
  "value":"587"
},
{
  "key":"SMTP_USER",
  "value":"your user name"
},
{
  "key":"SMTP_PASS",
  "value":"your password"
},
{
  "key":"SMTP_OPENSSL_VERIFY_MODE",
  "value":"none"
},
{
  "key":"SMTP_AUTHENTICATION",
  "value":"login"
},
{
  "key":"SMTP_STARTTLS",
  "value":"true"
}

The whole file should look more or less like that:

{
  "cap_add":[

  ],
  "cap_drop":[

  ],
  "cmd":"",
  "cpu_priority":0,
  "ddsm_bind_share":"",
  "devices":[

  ],
  "enable_publish_all_ports":false,
  "enabled":true,
  "env_variables":[
    {
      "key":"GITLAB_HOST",
      "value":"gitdomain"
    },
    {
      "key":"GITLAB_PORT",
      "value":"port"
    },
    {
      "key":"GITLAB_SSH_PORT",
      "value":"port"
    },
    {
      "key":"GITLAB_EMAIL",
      "value":"email"
    },
    {
      "key":"DB_TYPE",
      "value":"mysql"
    },
    {
      "key":"DB_HOST",
      "value":"172.17.0.1"
    },
    {
      "key":"DB_NAME",
      "value":"gitlab"
    },
    {
      "key":"DB_USER",
      "value":"gitlab"
    },
    {
      "key":"DB_PASS",
      "value":"password"
    },
    {
      "key":"GITLAB_SECRETS_DB_KEY_BASE",
      "value":"secret"
    },
    {
      "key":"SMTP_ENABLED",
      "value":"true"
    },
    {
      "key":"SMTP_DOMAIN",
      "value":"www.gmail.com"
    },
    {
      "key":"SMTP_HOST",
      "value":"smtp.gmail.com"
    },
    {
      "key":"SMTP_PORT",
      "value":"587"
    },
    {
      "key":"SMTP_USER",
      "value":"email"
    },
    {
      "key":"SMTP_PASS",
      "value":"password"
    },
    {
      "key":"SMTP_OPENSSL_VERIFY_MODE",
      "value":"none"
    },
    {
      "key":"SMTP_AUTHENTICATION",
      "value":"login"
    },
    {
      "key":"SMTP_STARTTLS",
      "value":"true"
    }
  ],
  "exporting":false,
  "id":"id",
  "image":"sameersbn/gitlab:8.6.2",
  "is_ddsm":false,
  "is_package":true,
  "links":[
    {
      "alias":"redisio",
      "link_container":"synology_gitlab_redis"
    }
  ],
  "memory_limit":0,
  "name":"synology_gitlab",
  "pin":false,
  "port_bindings":[
    {
      "container_port":80,
      "host_port": port,
      "type":"tcp"
    },
    {
      "container_port":22,
      "host_port": port,
      "type":"tcp"
    }
  ],
  "privileged":false,
  "shortcut":{
    "enable_shortcut":false,
    "enable_status_page":false,
    "enable_web_page":false,
    "web_page_url":""
  },
  "volume_bindings":[
    {
      "host_volume_file":"/docker/gitlab",
      "mount_point":"/home/git/data",
      "type":"rw"
    }
  ]
}

Start your Gitlab using DMS UI

Procedure is exactly the same as stopping except the last step: just click on “Run” button instead of “Stop”.

Retry all failed tasks in the Gitlab Sidekiq panel

  1. Log in to your Gitlab admin account
  2. Go to the “Admin area” (right top corner icon) – /admin
  3. Click on “Background jobs” (left bottom corner) – /admin/background_jobs
  4. Go to “Retries”
  5. If you have any, click on “Retry all” to reexecute all the failed tasks

sidekiq

And that’s all! If you didn’t make any mistakes, your Gitlab emails should be sent via provided Gmail account.

Olderposts

Copyright © 2019 Running with Ruby

Theme by Anders NorenUp ↑