[devdocsgjs/main: 1492/1867] feat: use the new buckets




commit 7713074c938136afe6f9c284ae2057897471e636
Author: Oliver Eyton-Williams <ojeytonwilliams gmail com>
Date:   Fri Jan 22 18:19:49 2021 +0100

    feat: use the new buckets
    
    The tarballs are currently getting put into /bundles, but maybe this
    isn't necessary

 lib/tasks/docs.thor | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)
---
diff --git a/lib/tasks/docs.thor b/lib/tasks/docs.thor
index 4c41a1be..202bf17a 100644
--- a/lib/tasks/docs.thor
+++ b/lib/tasks/docs.thor
@@ -191,7 +191,7 @@ class DocsCLI < Thor
     puts '[S3] Begin syncing.'
     docs.each do |doc|
       puts "[S3] Syncing #{doc.path}..."
-      cmd = "aws s3 sync #{File.join(Docs.store_path, doc.path)} s3://devdocs-assets/#{doc.path} --delete 
--profile devdocs"
+      cmd = "aws s3 sync #{File.join(Docs.store_path, doc.path)} s3://devdocs-staging-documents/#{doc.path} 
--delete --profile devdocs"
       cmd << ' --dryrun' if options[:dryrun]
       system(cmd)
     end
@@ -199,20 +199,16 @@ class DocsCLI < Thor
 
     # Upload packages to dl.devdocs.io (used by the "thor docs:download" command)
     # TODO(MIGRATION): replace this with an S3 bucket upload.
-    puts '[MaxCDN] Begin uploading.'
-    Net::SFTP.start('ftp.devdocs-dl.devdocs.netdna-cdn.com', ENV['DEVDOCS_DL_USERNAME'], password: 
ENV['DEVDOCS_DL_PASSWORD']) do |sftp|
-      docs.each do |doc|
-        filename = "#{doc.path}.tar.gz"
-        print "[MaxCDN] Uploading #{filename}..."
-        if options[:dryrun]
-          print "\n"
-        else
-          sftp.upload! File.join(Docs.store_path, filename), File.join('', 'public_html', filename)
-          print " OK\n"
-        end
-      end
+    puts '[S3 bundle] Begin uploading.'
+
+    docs.each do |doc|
+      filename = "#{doc.path}.tar.gz"
+      print "[S3 bundle] Uploading #{filename}..."
+      cmd = "aws s3 cp #{File.join(Docs.store_path, filename)} 
s3://devdocs-staging-downloads/bundles/#{filename} --profile devdocs"
+      cmd << ' --dryrun' if options[:dryrun]
+      system(cmd)
     end
-    puts '[MaxCDN] Done uploading.'
+    puts '[S3 bundle] Done uploading.'
   end
 
   desc 'commit', '[private]'
@@ -245,7 +241,7 @@ class DocsCLI < Thor
           FileUtils.mkpath(dir)
 
           ['index.json', 'meta.json'].each do |filename|
-            json = "https://docs.devdocs.io/#{doc.path}/#{filename}?#{time}";
+            json = "https://documents.devdocs.in/#{doc.path}/#{filename}?#{time}";
             begin
               open(json) do |file|
                 mutex.synchronize do
@@ -342,7 +338,7 @@ class DocsCLI < Thor
 
   def download_doc(doc)
     target_path = File.join(Docs.store_path, doc.path)
-    open "http://dl.devdocs.io/#{doc.path}.tar.gz"; do |file|
+    open "https://downloads.devdocs.in/bundles/#{doc.path}.tar.gz"; do |file|
       FileUtils.mkpath(target_path)
       file.close
       tar = UnixUtils.gunzip(file.path)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]