Installing PHPForm on DigitalOcean Apps

Aleksandr Shelestov
3 min readJan 14, 2024

--

Step 1: Create a New App in DigitalOcean

Navigate to DigitalOcean Apps.

Select ‘Create a New App’.

Choose ‘Docker Hub’ and type “phpform/phpform-server” with tag “latest”.

Step 2: Configure the App Instance

In the setup, click ‘Edit’ next to the first instance to adjust key settings.

In the edit form, change the port from 8080 to 9000.

Step 3: Edit the Plan

Click ‘Back’, then ‘Edit Plan’.

Choose ‘Basic’ for both the plan type and the instance size.

The total cost should now be $5/month.

Step 4: Finalize the App Creation

Return to the main menu and proceed with ‘Next’ at each step, unless you need to change the instance name or other settings.

Click ‘Create App’ and wait for the build to complete and the app to deploy.

Step 5: Initialize the Database

Once deployed, go to ‘Console’.

Run the following command to create the database:

php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate

Step 6: Access the Website

Visit your newly created website.

Create the first admin user and set up your form.

By following these steps, you should have a fully functional FlexForm installation on DigitalOcean.

Database

Now your instance is using SQLite database by default. I don’t recommend using it because all your data will be destroyed with the app if you just rebuild your app again. So use it only for testing the app.

Instead it is better to use a managed database like PostgreSQL or MySQL. For that you need to create a database and add the environment variable “DATABASE_URL” with new settings to your app.

After changing the database please make sure to re-run migration (step 5).

How to bind the database

With DigitalOcean apps you can easily bind the new or existing database. I will only show how to bind the new dev instance.

Click Create -> Create/Attach Database on your app page.

Choose the name. For most of cases dev instance is enough. You can also use previously created database if you have one.

After make sure you have the right ENV variable for a new database configured in the app settings.

In this case the name of database “flexform-demo-db” so please ajust it to your database name.

After database installed return to Step 5 and create and run migrations.

--

--