Moving a website to another server¶
Before moving your website, make sure you have backed up your data:
- Dump your database, using classic
mysqldump
orpg_dump
tools. If you’re using MySQLbin/roadiz database:dump -c
command can speed-up the process by naming automatically your file against your app-namespace. - Archive your files using
bin/roadiz files:export
, Roadiz will create a ZIP file with your public/private documents and fonts.
Moving to a SSH+Git hosting plan or an other development machine¶
From this point you can install your new web-server, as described in Install section.
Pay attention that if your theme needs some additional composer dependencies you should
clone/copy it into your themes/ folder before running composer install --no-dev
.
Then import your dump and files into your new server.
Once you’ve imported your database, you must edit manually your conf/config.yml, you can reuse the former server’s one and adapt its database credentials.
Warning
Do not perform any schema update if no app/gen-src/GeneratedNodeSources classes is available, it will erase your NodesSources data as their entities files haven’t been generated yet.
When you have edited your app/conf/config.yml
file, regenerate your Doctrine entities class files:
bin/roadiz generate:nsentities;
Now you can perform a schema update without losing your nodes data:
bin/roadiz orm:schema-tool:update --dump-sql;
bin/roadiz orm:schema-tool:update --force;
bin/roadiz cache:clear -e prod
bin/roadiz cache:clear -e prod --preview
bin/roadiz cache:clear-fpm -e prod
bin/roadiz cache:clear-fpm -e prod --preview
Note
If you are using an OPcode cache like XCache or APC, you’ll need to purge cache manually because it can’t be done from a CLI interface as they are shared cache engines. The most effective way is to restart your PHP-FPM service or Apache if your are using mod_php.
Install assets¶
By default, web theme assets are not tracked by Git. Make sure that you installed every theme
assets using bin/roadiz themes:assets:install
command. You should use --symlink --relative
options when possible to prevent updating assets manually. For Windows users, remove --relative
option to create absolute symlinks.
bin/roadiz themes:assets:install --symlink --relative Debug;
bin/roadiz themes:assets:install --symlink --relative Install;
bin/roadiz themes:assets:install --symlink --relative Rozier;
# Then your theme (FooBarTheme)
bin/roadiz themes:assets:install --symlink --relative FooBar;
composer.json file should execute Roadiz default themes asset install automatically after each update or install.
Synchronize documents and fonts¶
You can move your files/
folder using SFTP but the best way is to use rsync
command
as it will upload only newer files and it is much faster.
# This will synchronize files on your production server from your local Roadiz setup.
# Do not forget ending slash after each path!
rsync -avcz -e "ssh -p 22" /path/to/roadiz/files/ user@my-prod-server.com:/path/to/roadiz/files/
rsync -avcz -e "ssh -p 22" /path/to/roadiz/web/files/ user@my-prod-server.com:/path/to/roadiz/web/files/
It works in the other way too. If you want to work on your local copy with up to date files and fonts, you can download actual files from the production website:
# This will synchronize files on your local development server from your production server.
# Do not forget ending slash after each path!
rsync -avcz -e "ssh -p 22" user@my-prod-server.com:/path/to/roadiz/files/ /path/to/roadiz/files/
rsync -avcz -e "ssh -p 22" user@my-prod-server.com:/path/to/roadiz/web/files/ /path/to/roadiz/web/files/
Moving to a non-SSH hosting plan¶
You have nearly finished your brand new website using Roadiz. You have been working on your own server using Git and Composer, up to this point everything went well.
Now you have to push to production, but your prod-server has no SSH connection. You are stuck with an SFTP connection or worst, an old FTP one. Don’t panic, it will take a little more time but it is still possible.
Warning
Many shared-plan hosting companies offer you only one or two databases. When moving a Roadiz website, make sure that your database is empty and do not contain orphan tables, you must respect the rule “One app = One database”.
Note
If you can ZIP on your production server or if you are going to push your files via FTP,
do not forget to exclude .git
and node_modules
folders! These folders have lots of useless files
for a production SSH-less environment.
Here is a sample ZIP command to exclude them:
zip -r mywebsite.zip mywebsite/ -x "mywebsite/.git/*" "mywebsite/themes/**/static/node_modules/*"
.
- Before transferring your website, make sure you have
.htaccess
file in every sensitive folders. You can use thebin/roadiz generate:htaccess
on your computer. - If you have at least SFTP, you should have to rights to zip/unzip on your distant server. So zip the whole Roadiz folder.
- If you only have FTP, you must be prepared to transfer your Roadiz folder, file-by-file. Just get yourself a nice cup of coffee.
- Once everything is copied on your production server, verify than you have the same files as on your dev-server.
- Import your database dump with phpmyadmin or pgmyadmin.
- Edit your
conf/config.yml
to match your new database credentials. - Verify that root
.htaccess
file contains every information to enable Apache url-rewriting. - Try to connect to your website
- If it doesn’t work or display anything, read your PHP log file to understand where the problem comes from. It might be your database credentials or an outdated PHP version. Check that your hosting manager has installed every needed PHP extensions, see Requirements.