I have a working local Drupal 7 site (with local MySQL Database), but now I'm trying to migrate it to Amazon Web Services (which is currently running a test Drupal site successfully). I have all of my drupal files in a directory mydrupalsite on the EC2 instance server and the database has been added to the remote MySQL, but I don't know what to do now in order to configure apache to show the new site.
What I have tried so far:
I added the file in /etc/apche2/sites-available (copied the old instance and changed the directory name where appropriate)
I changed the symlinks (deleted the old symlink and added a new one) in /etc/apache2/sites-enabled so that only the new file is pointed to.
Then I rebooted the server and navigated to the site, but it's taking me to the install page (as though i were starting over)
Here are the contents of $databases variable in the settings file on my local machine (with username changed but the pw is an empty string)
if (!isset($databases)) {
$databases = array();
}
$databases['default']['default'] = array(
'driver' => 'mysql',
'database' => 'naicdrpl',
'username' => 'mylocalsiteusername',
'password' => '', // password is an empty string
'host' => '127.0.0.1',
'port' => 33067 );
You can use backup&migrate module for migration. It is very easy for using.
Zip all files from your Drupal directory. Copy/unzip that file on new server.
Backup your database in file with backup&migrate module.
Install Drupal site on new server. Run install.php and follow steps - you should probably change settings in /sites/default/settings.php file.
Go on /admin/modules and enable backup and migrate.
Go on /admin/config/system/backup_migrate/restore upload your backup file and click restore button
NOTE 1 (database settings):
For Drupal installation of course you need to have database. You should just create empty DB and set up user for that database. You should also set up password for that DB user and give him full privileges. In settings.php file you then change that data:
if (!isset($databases)) {
$databases = array();
}
$databases['default']['default'] = array(
'driver' => 'mysql',
'database' => 'nameofyourDB', //here you enter name of new empty database
'username' => 'mylocalsiteDBusername', //here you enter user name of database user
'password' => 'yourpassword', //you should always set up password for database user for security reasons
'host' => '127.0.0.1', //name of your host (usually is localhost)
'port' => 33067 ); //default MySql port
Basically here you set up Drupal site on empty database you created on new server. After that you fill that database using backup and migrate module.
NOTE 2 (settings.php file premissions):
When you migrate site and (in your case replace old one with new) you want to change settings.php file there can be a little problem with write permissions of the settings.php file. It is a common case that by default you can't change settings.php so in order to edit/replace that file you need to change permissions of the file and also of the folders where this file is placed. With no write permissions you can end up with new site and old settings.php file (the settings.php file from site you migrate will not overwrite old file).
Hope this helps.
You can do it in the GUI with the Backup and Migrate module https://www.drupal.org/project/backup_migrate
Okay it appears the issue was that settings.php did not have the needed configuration. Here was the solution that worked for me:
In order to determine what was needed, I created a temporary database in mysql call temp_db
I commented out the database section of settings.php
I navigated to the site which started the install process again
I went through the install process using the new temp_db
After completing this process, I went to settings.php and changed the db name to the correct one.
Went to the EC2 instance again and it worked!
Thank so much to everyone who helped!
Related
hi i have lost my aws database master pasword .i knew that how to reset rds password using below link
https://aws.amazon.com/premiumsupport/knowledge-center/reset-master-user-password-rds/
but the problem is that i dint find any db instance in aws console. my app is running well. so there is backend db working properly .i have my privete key file .
so can any one help how to reset my aws database master password,
I think the below method can help you out with your problem.
First thing you can do is go into your application(which you mentioned that is running well) and check the connection string, you would have used DNS name or DNS endpoint for the same, using that you can find that out.
If it is DNS Name, then you can go and find in your hosted zone where it is mapped and the mapped DNS endpoint can tell you in which region and with which name it is launched in your AWS account.
If it is using DNS endpoint then it can tell you in which region and with which name it is launched in your AWS account.
Here are the steps to be followed:
Locate the MySQL configuration file using: $ mysql --help | grep -A 1 "Default options"
On Ubuntu 16, the file location is typically /etc/mysql/mysql.conf.d/mysqld.cnf
Edit the configuration file using: $ sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Add skip-grant-tables under [mysqld] block and save the changes.
2.
Restart MySQL service using: sudo service mysql restart
Check MySQL service status: sudo service mysql status
3.
Login to mysql with: $ mysql -u root
And change the root password:
mysql> FLUSH PRIVILEGES;
mysql> ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'MyNewPass';
Revert back the MySQL configuration file changes by removing skip-grant-tables line or commenting it with a # (hash).
Finally restart the MySQL service and you are good to go.
I am using django 2.2 and mongodb as database for backend. i have inserted all data in my application.I am also using Robo3T for seeing collections of mongodb database.My database name is CIS_FYP_db. In my computer everything is going perfect but i want to transfer that project into another computer while i am transferring the project which also contains data\db file with many collections.wt files but when i am running that project in other computer it is showing me that database is blank.No data were present there and mongodb is making new database with the same name CIS_FYP_db with no collections.Please help me to solve this problem that how can i transfer my mongodb database into other computer so i can use it into my application which is already made for that database.Thanks in advance
setting.py
DATABASES = {
'default': {
'ENGINE': 'djongo',
'NAME': 'CIS_FYP_db',
}
}
When you create a connection with mongodb then database is created automatically if not exist already.
You can use mongodump command to get all the database records and mongorestore to restore your database on your new machine.
Assumption: you have setup mongoDb locally and want to migrate it to another computer.
1.Requirements:
mongodump
mongorestore
1.1.How to install?
to install above requirement u have to install [MongoDB Database
Tools]
download link: https://www.mongodb.com/try/download/database-tools
1.2.Popular error.
sometime path is not set, so try this in cmd prompt: set path="C:\Program Files\MongoDB\Server\5.0\bin"
Note: please refactor the link according to your folder path.
2.Procedure:
Note: make sure you follow Step 1
2.1. Approach
we are going to create dump of mongodb from old pc(using mongodump), then transfer that dump to new pc, and import that dump using mongorestore.
2.2.Creation of dump in old pc(from where u want to replicate database)
cmd mongodump --host localhost:27017 --out ~/Desktop/mongo-migration
above cmd will create a dump in the mentioned path==> ~/Desktop/mongo-migration
just copy that folder and transfer it to new pc
Note: if you have created authenticated user then add these flag in above cmd and provide values --username [yourUserName] --password [yourPassword] --authenticationDatabase admin
2.3.Import of dump(created from old PC)
place that dump folder somewhere and execute below cmd
mongorestore C:/....../mongo-migration/ -u root --host 127.0.0.1:27017
done :)
Our EC2 instance setup has an ftp user that had successful setup through the vsftpd program with an original home directory of \home\user\, I followed the instructions on this stack overflow, and had the user's shell set to /bin/false
What I'm looking to do is make the ftp user login only accessible to a particular directory, a folder in the html directory - \var\www\html\website.com\userfolder
What I've done:
Added user to a group ftpgroup
Authorized access and ownership of the new directory to the user:ftponly
Changed the user's home directory in /etc/passwd
added .ssh/authorized_keys with user's key in the new directory
changed ChrootDirectory in /etc/ssh/sshd_config to new directory
changed the permissions on the directory to chmod -R 775 user:ftpgroup
mounting \var\www\html\website.com\userfolder
Before these changes I was able to access the FTP, and now upon attempted access I receive the following errors from the Filezilla client:
Error: Disconnected: No supported authentication methods available
(server sent:publickey) ... Status: Connection attempt failed with
"ETIMEDOUT - Connection attempt timed out"
As it was working before, I'm thinking that it might have something to do with permissions, I'm just unsure of where else to change.
Thanks for any insight.
This worked for me.
After creating the user with vsftpd, the user now has access to the directory via FileZilla.
I then added a link from the home/{user} directory to the /var/www/html/{user} directory.
The user can upload files to the home directory and can view it from the html directory.
This is a simple hack. Let me know if this solves your problem.
I am having a difficult time setting up Rails 4.2 in production on a VM running on passenger and nginx, and not using RVM or anything similar.
I got Incomplete response received from application and looking in the nginx error log it said something about missing secret_key_base and secret_key although there is no reference to that last one any where in the config directory.
I ran export SECRET_KEY_BASE='...' and in rails c production ENV["SECRET_KEY_BASE"] displays the key but after restarting nginx I still get the same error.
Placing the key directly in secrets solved that problem but is there an actual way to do this correctly?
Solution:
The solution that worked for me is to place export SECRET_KEY_BASE="<string obtained from rake secret>" in .bashrc
If you use rbenv, there is another solution below in the accepted answer.
If you are using rbenv you can add the rbenv-vars plugin and add a .rbenv-vars file containing (and don't check that into your repo)
SECRET_KEY_BASE='...'
other solution is to add the the SECRET_KEY_BASE manually to the secrets.yml file and also ignore that file from your repo.
a third answer that saw mentioned is adding
export SECRET_KEY_BASE='...'
to one of these files .bashrc .bash_profile .profile
Your config/secrets.yml should have something like
development:
secret_key_base: f91fe2e2e4a9bf8f8b6aa1c296bb9ec10f2bc91c08965176a642ea0927400651ea993512f83d9823bcc046555e40b8c257f5f19fab8c59b5a02c9d230a369fe7
test:
secret_key_base: c116ac7c8f69018d1f4e10f632cac7a22348f0bd8ed8f21ca45460574d2f501f248418bc888e31556e16ba3ab58c3a7cba027140097abe3f511dddf6625fa8cd
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
To set SECRET_KEY_BASE, first you'll need to generate it with
rake secret
Then take that output and edit your /etc/environment (depending on your distro, assuming Ubuntu here) and place it as such
SECRET_KEY_BASE=...
Restart your server and you should be gravy
We started using Redmine at work. I know it uses MySQL as the database, and Apache 2 as the web server. How can Redmine be properly backed up so that it can be reloaded quickly when anything goes wrong?
This will do just fine:
mysqldump --single-transaction --user=user_name --password=your_password redmine_database > backup.sql
It will dump the entire contents of the redmine_database to the backup.sql file.
Update:
As far as backing up "apache", as I state in my comment below - you don't need or want to back up your apache installation. If you ever need to recover your system, apache would need to be reinstalled as with any other application. If you are referring to the actual files and directories within your redmine installation, those as well don't need to be backed up except for the files/ directory which contains user uploaded files to redmine. You can backup your entire redmine installation (to be safe) with the following command:
tar czvf redmine_backup.tar.gz /path/too/redmine/installation
Run it as a VM (JumpBox has a quickstartable one, I believe) then periodically pause or shutdown the VM and backup/copy the entire virtual disk.
I know this doesn't help with an existing installation, but it's what I'd recommend to anyone planning backups before they implement. That's not meant to be snide, just helpful to anyone else reading this thread.
Bitnami apps are self contained, so another option if you can afford some downtime, is simply to shutdown the server, and zip the directory contents ... You may want to do this maybe once a week, in addition to your mysqldump backups. This way you also capture any changes that may have happened in Apache, etc.
Read the Redmine user guide (look at the bottom).
Also, don't forget to backup the attached files.
Redmine backups should include:
Data (stored in your redmine database)
attachments (stored in the files directory of your Redmine install)
Here is a simple shell script that can be used for daily backups (assuming you're using a MySQL database):
# Database
/usr/bin/mysqldump -u <username> -p<password> <redmine_database> | gzip > /path/to/backup/db/redmine_`date +%y_%m_%d`.gz
# Attachments
rsync -a /path/to/redmine/files /path/to/backup/files
Redmine sets table charset as "latin1".
So, if you use non-latin1 charset (CJK in UTF-8 or something), you should give following option to backup script.
mysqldump -u root -p --default-character-set=latin1 --skip-set-charset bitnami_redmine -r backup.sql
It skips "set charset blah-blah-blah" on sql dump and you would get a clean(=dump without interpretation) dump.
By the way, you have to back up the files directory as well; it holds all uploaded files. I installed the Bitnami Redmine stack on Windows.
For MySQL, I use MySQLAdmin to schedule database backup every day.
And I use aceBackup to automatic backup database dump files and Redmine uploaded files to a remote FTP server.
When the server is something wrong, I can just reinstall the Bitnami Redmine stack, and import early dumped database file, then cover Redmine's files directory with backup files.
And that's OK.
This separate program (Bitnami Redmine stack) and data (database & uploaded files) perfectly.