# 迁移到 S3 以解决 Digital Ocean Spaces 的问题

**URL:** <https://meta.discourse.org/t/migrate-to-s3-for-digital-ocean-spaces-woes/109662>\
**Category:** Self-hosting\
**Tags:** s3\
**Created:** [2019年二月20日 15:54 UTC](https://meta.discourse.org/t/migrate-to-s3-for-digital-ocean-spaces-woes/109662 "2019-02-20T15:54:27Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2019年二月27日 20:00 UTC](https://meta.discourse.org/t/migrate-to-s3-for-digital-ocean-spaces-woes/109662/8 "2019-02-27T20:00:24Z")

</div>

I still don’t see how ` GlobalSetting.use_s3?` is ever true. I have `GlobalSetting.use_s3`, but not with a `?` and I don’t see how seeting those ENV vars sets `GlobalSetting.use_s3?`. Maybe that’s supposed to happen somewhere that I don’t know about or understand, but I removed the `?` in order to be able to run the script at all.

So I removed the `?` and the dry run looked promising and I ran it for real. It took a couple days (70GB files and a badly configured network adapter) and then it failed like:

```plaintext
Updating the URLs in the database... [14/9360]
rake aborted!
PG::StringDataRightTruncation: ERROR: value too long for type character varying(500)
/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rack-mini-profiler-1.0.2/lib/patches/db/pg.rb:110:i
n `async_exec'
/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rack-mini-profiler-1.0.2/lib/patches/db/pg.rb:110:i
n `async_exec'
(eval):24:in `async_exec'
/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/mini_sql-0.2.1/lib/mini_sql/postgres/connection.rb:
118:in `run'
/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/mini_sql-0.2.1/lib/mini_sql/postgres/connection.rb:
90:in `exec'
/var/www/discourse/lib/db_helper.rb:31:in `block in remap'
/var/www/discourse/lib/db_helper.rb:20:in `each'
/var/www/discourse/lib/db_helper.rb:20:in `remap'
/var/www/discourse/lib/tasks/uploads.rake:364:in `migrate_to_s3'
/var/www/discourse/lib/tasks/uploads.rake:210:in `block in migrate_to_s3_all_sites'
...

```

It’s probably coincidence that it’s the same error as [Trouble with `discourse remap` remapping `topic_links url`](https://meta.discourse.org/t/trouble-with-discourse-remap-remapping-topic-links-url/110052) (it is a different site).

---

_[View the full topic](https://meta.discourse.org/t/migrate-to-s3-for-digital-ocean-spaces-woes/109662)._
