Set up your web app
To create your Symfony application head to the 'Add site' form and follow the steps below:
- If you haven't done it yet, choose the server of your workspace that will host your web app.
- Choose your preferred 'PHP' version as the programming language.
- Choose 'Symfony 2' or 'Symfony 3' as the development framework, according to the Symfony version you're going to use.
- Provide the name of the site on the server. The base path to the site on your server is
- Provide the root domain of your website (e.g.
your-site.com). Note that you must either own such domain or use one based on your server's IP address.
- Choose the git repository that contains your application code. You may select whichever repo available from GitHub, GitLab, Bitbucket, or any other provider. You can also leave this field as 'None' and manage the deployment of your app on your own by means of any other mechanism, but we don't recommend that.
- Choose the database your application will use. If it doesn't need a database, you may select 'None' as the engine. Otherwise, you can either create a new MySQL database and user on the same server or use an existing database and user. Note that the latter may be hosted on any server of the same workspace - Moss will automatically set up the corresponding firewall rules 😀
- Edit the content of the configuration parameters file of your Symfony app. Such file is the typical
parameters.ymlthat you already use in your deployments. Moss automatically generates an appropriate configuration for your application, but you can customize it according to your needs.
- Provide the server user that will run your website. Moss proposes one based on the name of your site, but you may create a different user or choose an existing one. If you have multiples websites on a same server, you can isolate them from each other by running them as different users.
- Choose the SSL certificate that you'll employ for your site. You may tell Moss to generate a free Let's Encrypt certificate or provide your own. If you leave 'None' as certificate, your website won't be reachable through the HTTPS protocol.
- Check the redirect www to root domain box if you want
www.your-site.comto redirect to
- Check the allow wildcard subdomains box if your website is served from subdomains like
def.your-site.com, etc. This option isn't compatible with Let's Encrypt certificates, so you'll have to own a certificate that allows wildcard subdomains or just get rid of HTTPS - something we don't recommend at all.
- Check the push to deploy box if you want Moss to deploy your app whenever you perform a
git pushon the repo and branch/tag you've provided.
- Check the monitoring box if you want Moss to periodically check the health of your website and send you an alert whenever it's down. Usually you'll want to monitor your websites, unless they're for testing or similar environments.
In the 'Advanced' section you may also edit the following configs:
- Choose the web server stack for your site. We recommend that you use Nginx as an standalone web server, but you may use it as a reverse proxy to Apache instead.
- Update the root dir within your git repo that contains your website's public content (e.g. index.php). E.g. if these files are within a web/ subdirectory, Moss will set up the web server to serve your site from /home/<site-user>/sites/<name>/current/web.
Once you're done with the previous configuration, click the 'Add' button and wait until Moss finishes the process.
Moss shows the last completed step at any moment so that you can track the progress of the process.
Deploy your web app
Good, Moss has set up your web server to serve your application on the root domain you specified. Now you just need to deploy your app on the server to make it available to the world 😉
Moss supports zero-downtime deployments by allowing you to specify both pre-activation and post-activation scripts. Whatever you include within the pre-activation script will be run before your new release activates. During that time your previous release is the one being served by the web server. Moss automatically creates an appropriate script for Symfony 2 and Symfony 3 applications. Such script updates your app's dependencies via composer and runs your database migrations via doctrine. If this behavior doesn't fit your application, please edit your deployment flow to provide an appropriate pre-activation script.
Once this script ends successfully the new release activates and becomes available to your users. At that moment, you may want to run a post-activation script to run commands that depend on the new version of your code. If don't need to run anything at this stage, just provide an empty script or leave it as suggested by Moss. Otherwise, please edit your deployment flow to provide appropriate post-activation script.
If you want to manually deploy your app now, click the 'Deploy' button and Moss will start to work.
Alternatively, you may check the 'Push to deploy' option and force deployment by running a
git push against the repo of your web application.
At any moment you can check the output of your latest deployment in
Check your website is ok
Now it's time to open a browser and visit your site. If you cannot update DNS records at this very moment, you can add a domain alias to browse your website leveraging your server's IP address.
Otherwise, let's update your DNS records. Head to the 'Domain' tab and Moss will show you the records you must set up in your DNS provider. Such records make the canonical domain of your web point to the external IP address of your server.
Once DNS records have been propagated, and provided you're monitoring this website (only if your plan allows it), after a few minutes you can check that your site is globally reachable by heading to the 'Health' tab.
Congratulations! Moss set up, deployed, and is monitoring your new web application 😃 . If your application also needs to process background jobs, you can configure them as workers with Moss.