Jump to content

Help:LAMP instances

From Wikitech
(Redirected from Help:Lamp Instance)

This page is about how to create and administer VPS instances running the LAMP stack.

Once you have a new project and have created an instance you can then use Puppet to assign roles to it to automatically setup software.

A common example is a LAMP stack (Linux, Apache, MySQL, PHP).

If you want one of those, click on the Puppet tab in Horizon and associate a puppet role with your instance. You can do this for an entire project and all instances in it for all instances starting with a certain prefix or for individual instances.

Find the empty "Puppet Classes" field in Horizon and hit the Edit button under it. Enter role::simplelamp2 and apply.

Now connect to your instance via SSH and run sudo run-puppet-agent. This will start the puppet agent and automatically pull in the following things for you:

  • httpd ("Apache") webserver
  • PHP and module/config for the webserver to use it (still as libapache2-mod-php currently)
  • MariaDB (replaced MySQL), database server and client
  • memcached for performance

Apache httpd will have the modules "rewrite" and "headers" loaded by default. The PHP version on bullseye is be 7.4.

Puppet will manage all the webserver config; though by default you can now also still manually edit files under /etc/apache2/sites-enabled and drop-in your own config without having to go through Puppet or code review.

You can also write your own puppet role to add in addition to simplelamp2 that builds on it. It can live on a either a local or a central puppetmaster.

Optionally you can switch the webserver to "strict" mode where puppet will actively purge all manually edited files. (see T169368 for details)

Troubleshooting

"Permission denied" when trying to add HTML/PHP files

Use "sudo", for instance "sudo cp myfile.html /var/www/".

Bad Gateway

This happens when the web proxy service cannot connect to the expected instance via port 80. Note that the server won't be immediately accessible after creating a web proxy for it. Waiting a few minutes before troubleshooting is recommended.

Potential causes:

webserver is not listening on port 80
If your webserver isn't accepting external connections on port 80, the proxy will return a 502. This may happen if your web service is down or if you have configured your webserver to listen on a different port or only to "localhost" or "127.0.0.1".
security group not configured for port 80
In order to make an instance accessible via port 80, you'll need to set up a security group with port 80 open and configure your instance to be a part of this security group.

HTTP request timed out

When using a public url for your wiki, making an internal PHP API call may time out.

# Edit /etc/hosts so that an entry similar to the following exists
127.0.0.1 instance-name.wmcloud.org

(This will break HTTPS requests.)

Required components

You are missing a required extension to PHP that MediaWiki requires to run. Please install:

  • mbstring (more information)
  • xml (more information)
  • intl (more information)

If you get an error page with text like above you need to install the PHP modules manually. In this case run

apt install php-mbstring php-xml php-intl

and then restart Apache with

systemctl restart apache2

See also