Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating Project Nami to AWS #337

Open
udit7590 opened this Issue Mar 24, 2019 · 25 comments

Comments

Projects
None yet
2 participants
@udit7590
Copy link

udit7590 commented Mar 24, 2019

I need to migrate my wordpress site based on Project Nami from Azure to AWS. The AMIs available on AWS are more supported for Linux machines and I didn't find a way to transfer .bacpac backup file from Azure SQL Database to Amazon RDS SQL Server (It gives an error since AWS RDS expects a .bak file for restoration). Just wanted to understand if there is an easy way to make the project not locked on a particular cloud provider.

@patrickebates

This comment has been minimized.

Copy link
Member

patrickebates commented Mar 24, 2019

If memory serves, the .bacpac is actually a ZIP file. Make a copy, change the extension to ZIP, then see if you can open it. You might find a .bak inside it.

@patrickebates

This comment has been minimized.

Copy link
Member

patrickebates commented Mar 24, 2019

And for the record, .bacpac is something supported by SSMS. So assuming you can connect to your Amazon SQL using SSMS, you might be able to do something with the bacpac that way.

@udit7590

This comment has been minimized.

Copy link
Author

udit7590 commented Mar 24, 2019

@patrickebates Thanks for the reply. I tried the zip method but there is no .bak file inside it. It has few XMLs and .bmp files organized into folders. Also, SSMS does not work for me since I work on Mac OS and there is no SSMS support for the OS.

Secondly, database is one part of the problem. I installed wordpress by bitnami on AWS Linux instance and keep getting the error: "Your PHP installation appears to be missing the SQLSrv extension which is required by Project Nami." Didn't find any fix for this on Linux. I even tried using the All-In-One migration plugin of Wordpress. But even that gives an error since the plugins does not support the SQL Server and SQLSrv extension.

@patrickebates

This comment has been minimized.

Copy link
Member

patrickebates commented Mar 24, 2019

I recommend using the Wordpress internal Import and Export functions then. I use it myself in probably more site migrations than I do DB dumps or other operations.

As for running PN in a Linux environment, it does work but you need to install that build of the SqlSrv extension.
https://docs.microsoft.com/en-us/sql/connect/php/loading-the-php-sql-driver?view=sql-server-2017

@udit7590

This comment has been minimized.

Copy link
Author

udit7590 commented Mar 24, 2019

@patrickebates I was able to resolve the SQLSrv extension issue following this: https://docs.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac?view=sql-server-2017

However, now I am stuck with restoring database. I have copied my existing wordpress files from Azure to AWS and replaced the database config to point to the local MySQL database. This is giving me "Error establishing a database connection" error. Can I run MySQL using PN? Since I cannot connect to Wordpress admin, importing using native import is also becoming difficult.

@udit7590

This comment has been minimized.

Copy link
Author

udit7590 commented Mar 24, 2019

PS: I also tried redirecting the database to SQL Server RDS instance and still getting the same error.

@patrickebates

This comment has been minimized.

Copy link
Member

patrickebates commented Mar 24, 2019

No, you cannot run PN on a MySQL database. The commands for connecting to that DB are not even present in PN, having been replaced with those for SQL Server.

@udit7590

This comment has been minimized.

Copy link
Author

udit7590 commented Mar 24, 2019

@patrickebates Ok. So I even tried using SSMS to restore the backup using .bacpac. I tried both a new and existing database. After the creation of database from "Import Data Tier" option, I am not even able to delete the database. Any ideas?

@patrickebates

This comment has been minimized.

Copy link
Member

patrickebates commented Mar 24, 2019

This is a database on Amazon's platform? If so, then I have no idea as I have zero experience with Amazon cloud services.

@udit7590

This comment has been minimized.

Copy link
Author

udit7590 commented Mar 24, 2019

Yes it is on AWS. But the database created is SQL Server. Have you tried successfully migrating a .bacpac file from Azure SQL Database to a SQL Server database? The underlying mechanism should be same.

@patrickebates

This comment has been minimized.

Copy link
Member

patrickebates commented Mar 24, 2019

Yes, I've moved BACPACs both ways between local SQL Server and Azure SQL. It just worked. And I was able to delete DBs using SSMS by right-clicking the DB, selecting Delete, and in the window that appears checking the boxes to drop connections, etc. which might be available.

@udit7590

This comment has been minimized.

Copy link
Author

udit7590 commented Mar 24, 2019

@patrickebates Ok. So I did few more things. I created a new database on my SQL Server instance and migrated the default mysql database to this new database using SSMA. So I have the basic setup ready for starting my Wordpress site. Now, I keep getting "error connecting to database" issue. I have checked my DB_HOST, DB_USER, DB_PASS, DB_NAME parameters. I am able to user the same credentials to connect using SSMA and other tools. I even checked that I have both Windows and SQL Server authentication allowed on the MS SQL server, as suggested in the previous issues.

Would appreciate any help on what could possibly go wrong now?

@patrickebates

This comment has been minimized.

Copy link
Member

patrickebates commented Mar 24, 2019

My first question would be, why migrate a default MySQL database into your SQL Server rather than creating a new empty DB and running the WP install?

As for why you are having DB connectivity issues, I don't know that I have much other help to offer. SqlSrv module for PHP does require TCP/IP protocol for connections, but I suspect you are already using that for your other tools (provided you aren't using Named Pipes, etc.).

@udit7590

This comment has been minimized.

Copy link
Author

udit7590 commented Mar 24, 2019

@patrickebates I was migrating an existing project to AWS and thought since I did not have database tables, I might be facing the issues. But issue was in establishing database connection itself. Still not able to resolve that. Is there any other way I can generate log files to get a more detailed error for the problem?

@patrickebates

This comment has been minimized.

Copy link
Member

patrickebates commented Mar 24, 2019

Connection errors should be written to the default php_errors.log

@udit7590

This comment has been minimized.

Copy link
Author

udit7590 commented Mar 25, 2019

@patrickebates So I did few more things.

  1. I was able to connect to database. This is a brand new database since I do not have a workaround for restoring the database now.
  2. I copied my htdocs OR wwwroot folder to my AWS instance with Wordpress already installed.
  3. I ran wpinstall.php. This created a user for me and few sample posts.
  4. Now when I try to login to wp-admin, it redirects me to wp-login.php. And when I enter the credentials, I am redirected to the same page. So basically, not able to login to the dashboard to actually import the posts and other settings I have from my previous wordpress application from Native Export.

Any suggestions now? How do you normally transfer your Wordpress application from one instance to another when the migration plugins do not work for you and you have plugins, themes installed in your old application. Is there a better elegant way to do this?

@patrickebates

This comment has been minimized.

Copy link
Member

patrickebates commented Mar 25, 2019

If I were copying a PN install to a new server and I had access to both DB servers at the same time from a copy of SSMS, here's what I would do.

ZIP the entire folder structure of the existing site and unpack it into an empty wwwroot folder on the new server.
Edit the wp-config.php on the new server and update the DB connection values.
Using Import/Export tools in SSMS, set the original DB as source and the new DB as destination and copy all tables.

If the URL of the site changes as a result of this, I would then edit the appropriate line in wp_blogs to correct the URL. Then do the same with the home and siteurl entries in wp_options.

@udit7590

This comment has been minimized.

Copy link
Author

udit7590 commented Mar 25, 2019

@patrickebates I see. The only step missing in my case is the database backup. I am trying to find an alternative for this.

But how do you ensure versions matching of PN? I am trying to migrate a very old version of PN. On the new instance, I have installed the latest versions of PHP, apache2 and wordpress using bitnami. Is this going to create issues for me?

@patrickebates

This comment has been minimized.

Copy link
Member

patrickebates commented Mar 25, 2019

I feel like I keep missing something based on the questions...

If you did a copy of all site files as I mention just above in this thread, then you automatically have the same version of PN.

And what is this about "WordPress using bitnami"?

@udit7590

This comment has been minimized.

Copy link
Author

udit7590 commented Mar 25, 2019

I just used bitnami instance to install wordpress on AWS. But like you said, if I unzip the files from my previous version, I should have the PN version on my new instance. I have finally found a workaround for DB migration (I shall tell you, it was not easy). Let me complete the process and see if I can successfully run this.

@udit7590

This comment has been minimized.

Copy link
Author

udit7590 commented Mar 25, 2019

@patrickebates I have got many things right. DB is restored. PN is unzipped. I have changed my siteurl and home to an IP Address for demo. And DB connections are fixed. Still experiencing few issues:

  1. Not able to login to wp-admin. (https://18.208.208.188/wp-admin). Any suggestions?
  2. 18.208.208.188 does not load my images. However, those should already exist in the files I extracted from zip folder. Any reasons for this?
@patrickebates

This comment has been minimized.

Copy link
Member

patrickebates commented Mar 25, 2019

Check for COOKIE_DOMAIN in your wp-config.php

If you Inspect one of your missing image elements, can you locate the image at the expected location in your file structure?

@udit7590

This comment has been minimized.

Copy link
Author

udit7590 commented Mar 25, 2019

No COOKIE_DOMAIN in wp-config.php. I don't think this is an issue with cookies since I see the same issue in other browsers.
Yes, I have the images in my file structure.

@patrickebates

This comment has been minimized.

Copy link
Member

patrickebates commented Mar 25, 2019

Is the login attempt returning invalid password, or just looping back and repeating the login request? Login success is written to a cookie, which is why the COOKIE_DOMAIN can be an issue if it was set to a site other than the current address.

Is it possible that your web server is blocking access to some image file types? You mentioned Apache as your new engine. Do you have .htaccess files set up? (Not that I know how to help you with those)

@udit7590

This comment has been minimized.

Copy link
Author

udit7590 commented Mar 25, 2019

Ok tried setting COOKIE_DOMAIN to both IP address and black. Also tried following:
`

define('ADMIN_COOKIE_PATH', '/');

define('COOKIE_DOMAIN', '');

define('COOKIEPATH', '');

define('SITECOOKIEPATH', '');`

Admin login is relooping back to the login page itself.

I can still work with images. But I need access to the admin dashboard first. Not sure what else could be going wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.