Page tree
Skip to end of metadata
Go to start of metadata


Initially, when FileCloud is made ready for production purposes, it may be required to get it pre-populated with files/folders for FileCloud users. FileCloud is bundled with a tool to preload such files/folders before it is opened for user access. This article explains how to use this tool for seeding FileCloud.

In addition, this tool may be used to migrate from FileCloud on-premises to FileCloud online.  

 

Prerequisite

To use the seeding tool, mongodb should be enabled in PHP CLI mode.

Enable MongoDB:

In Linux enter:

[root@cnfc php.d]# php -m | grep mongodb
mongodb
[root@cnfc php.d]#


In Windows enter:

C:\Windows\system32>C:\xampp\php\php.exe -m | findstr mongodb
mongodb

C:\Windows\system32>


If you do not get the above results, please Contact FileCloud Support.

  • In Windows, MongoDB module should be enabled by default.
  • If MongoDB is not enabled for PHP CLI mode, the tool will fail.

Usage

Initializing backup tool
rmen@li111-150:~$ cd /var/www/resources/tools/seeding
rmen@li111-150:/var/www/resources/tools/seeding$ sudo php ./seed.php
Please specify site name. Use 'default' for default site.
Usage: php seed.php -h <host> -p <path> [options]
      [Required] -h <host> Site host name or use 'default' for default site
      [Required] -p source path from where files are to be seeded
      [Options]
                      -i seed files. Need to set this flag for seeding files
                      -d <storagepath> seed files from source path specified with -p to an existing storage path <storagepath>.
                      -m <s3inipath> specify path to migrate.ini. This ini file will be used to migrate existing local storage to S3 storage
                      -u user whose files are to be imported. File with the user name should exist in the source path. Applicable only with -i
                      -r reset existing database. This will reset the databases, so use it with caution

Seed files for multiple users without resetting databases

To seed files for multiple users at the same time, prepare a top directory(source path) with separate folders for each user to be seeded with data. Under the user specific folder place files/folders to be seeded for that user.
Run the following command to seed all the users from the prepared source path.

Linux seeding files/folders for multiple users - Default site
rmen@li111-150:/var/www/resources/tools/seeding$ sudo php ./seed.php -h default -p /tmp/seedfolder -i

The following code shows how to export files for user 'jdoe' from site site21.hostedcloud.com to directory 'cloudexport'.

Windows seeding files/folders for multiple users - Default site
d:\xampp\htdocs\resources\tools\seeding> C:\xampp\php\php.exe seed.php -h default -p C:\temp\seedfolder -i

Note

  • If user account exists, seeded files/folders will be imported to those accounts
  • If user accounts doesn't exist, user accounts will be created before seeding.

Seed files for multiple users resetting databases

To seed files for multiple users at the same time, prepare a top directory(source path) with separate folders for each user to be seeded with data. Under the user specific folder place files/folders to be seeded for that user.
Run the following command to delete all the existing data and seed from the prepared source path.

Linux resetting and seeding files/folders for multiple users - Default site
rmen@li111-150:/var/www/resources/tools/seeding$ sudo php ./seed.php -h default -p /tmp/seedfolder -i -r
Windows resetting and seeding files/folders for multiple users - Default site
d:\xampp\htdocs\resources\tools\seeding> C:\xampp\php\php.exe seed.php -h default -p C:\temp\seedfolder -i -r

Note

  • All the existing user accounts and its associated data will be deleted before the seeding.
  • New user accounts will be created before seeding. Default username and password will be used (i.e password → password)

Seed files for a single user

To seed files for multiple users at the same time, prepare a top directory(source path) with separate folders for each user to be seeded with data. Under the user specific folder place files/folders to be seeded for that user.
Run the following command to seed all the users from the prepared source path.

Linux seeding files/folders for single user - Default site
rmen@li111-150:/var/www/resources/tools/seeding$ sudo php ./seed.php -h default -p /tmp/seedfolder -u jdoe -i
Windows seeding files/folders for single user - Default site
d:\xampp\htdocs\resources\tools\seeding> C:\xampp\php\php.exe seed.php -h default -p C:\temp\seedfolder -u jdoe -i

Note

  • Data will be seeded for a single user
  • In this case, command expects a folder jdoe to exist under the source path

Seed files into an existing path

To seed files into an existing FileCloud storage path, prepare a top directory(source path) with a single folder under which files/folders to be seeded are placed. 
Run the following command to seed the single folder and its contents to an existing FileCloud storage path.

Linux seeding files/folders into an existing storage path - Default site
rmen@li111-150:/var/www/resources/tools/seeding$ sudo php ./seed.php -h default -p /tmp/seedfolder -d /jdoe/march
Windows seeding files/folders into an existing storage path - Default site
d:\xampp\htdocs\resources\tools\seeding> C:\xampp\php\php.exe seed.php -h default -p C:\temp\seedfolder -d /jdoe/march

Note

  • In this case, command imports single folder under the source path into FileCloud storage path /jdoe/march

Migrate local storage to S3 storage

The seeding tool can also migrate files from local storage to S3 storage. When the tool is run in this mode, it does the following steps:

  1. Checks if AWS CLI is installed on the system running the tool
  2. Checks if a valid migration ini file is specified. Look below for the file format.
  3. Important: Deletes the existing S3 storage database. If the site was never configured for S3 before, then this should not be an issue.
  4. Creates a new S3 storage database and imports the data from local storage database converting it into S3 storage database format on the fly.
  5. Creates multiple AWS CLI commands to upload data from the local storage to the S3 bucket. The details of this transfer are generated using the specified ini file.
  6. Executes the AWS CLI commands prepared in the previous step.

Run the following command to migrate from local storage to S3 storage

Linux migrating from local storage to S3 storage
rmen@li111-150:/var/www/resources/tools/seeding$ sudo php ./seed.php -h default -m /tmp/migrates3.ini -p /
Windows migrating from local storage to S3 storage
d:\xampp\htdocs\resources\tools\seeding> C:\xampp\php\php.exe seed.php -h default -m C:\temp\migrates3.ini -p /
S3 migration ini file
aws_storage_bucket = "company.bucket"
aws_storage_folderprefix = "site1"
aws_access_key_id = "AKIAT4YDRDUSRO863KJJ"
aws_secret_access_key = "stPwbS3Y1KrZGUkVbNcYJx+8S/ZZKFROOjUdG9e9"
aws_region = "us-east-1"


Migrating from FileCloud on-premises to FileCloud online

If you are migrating from FileCloud on-premises to FileCloud online, the full set of databases has to be exported along with other files and folders . This can be achieved with the following commands.

Linux migrating from local storage to S3 storage
rmen@li111-150:/var/www/resources/tools/seeding$ sudo php ./seed.php -h default -m /tmp/migrates3.ini -e /tmp/dbexport -p
Windows migrating from local storage to S3 storage
d:\xampp\htdocs\resources\tools\seeding> C:\xampp\php\php.exe seed.php -h default -m C:\temp\migrates3.ini -e C:\temp\dbexport -p

Contact FileCloud Support for help with this procedure.