statamic / docs

Statamic Documentation
https://statamic.dev
Other
117 stars 384 forks source link

Ubuntu docs seem incomplete #1316

Open adamkdean opened 7 months ago

adamkdean commented 7 months ago

I'm not completely familiar with PHP after not using it for 15 years but I'm very familiar with docker, Linux, and such. I've been running through the Ubuntu documentation to try and get Statamic up and running in a Ubuntu container sans additional tooling or aids — the expectation being that Ubuntu VM or Ubuntu container, there shouldn't be too much of a difference.

However, following the documentation for Installing on Ubuntu doesn't lead to a working installation. If anything, it appears that the example.com directory contains just the repo, and not a working site.

Is the Ubuntu documentation tested and validated as working?

What is the expected file output of composer create-project --prefer-dist statamic/statamic example.com?

drwxrwxrwx 1 www-data www-data 4.0K Apr 10 12:59 .
drwxr-xr-x 1 root     root     4.0K Apr 10 12:54 ..
-rwxrwxrwx 1 www-data www-data 1.8K Apr  2 15:16 README.md
drwxrwxrwx 1 www-data www-data 4.0K Apr  2 15:16 app
-rwxrwxrwx 1 www-data www-data 1.7K Apr  2 15:16 artisan
drwxrwxrwx 1 www-data www-data 4.0K Apr  2 15:16 bootstrap
-rwxrwxrwx 1 www-data www-data 2.2K Apr  2 15:16 composer.json
-rwxrwxrwx 1 www-data www-data 404K Apr 10 12:54 composer.lock
drwxrwxrwx 1 www-data www-data 4.0K Apr  2 15:16 config
drwxrwxrwx 1 www-data www-data 4.0K Apr  2 15:16 content
drwxrwxrwx 1 www-data www-data 4.0K Apr  2 15:16 database
drwxrwxrwx 1 www-data www-data 4.0K Apr  2 15:16 lang
-rwxrwxrwx 1 www-data www-data  343 Apr  2 15:16 package.json
-rwxrwxrwx 1 www-data www-data 1.2K Apr  2 15:16 phpunit.xml
-rwxrwxrwx 1 www-data www-data 1.7K Apr  2 15:16 please
-rwxrwxrwx 1 www-data www-data   94 Apr  2 15:16 postcss.config.js
drwxrwxrwx 1 www-data www-data 4.0K Apr  2 15:16 public
drwxrwxrwx 1 www-data www-data 4.0K Apr  2 15:16 resources
drwxrwxrwx 1 www-data www-data 4.0K Apr  2 15:16 routes
drwxrwxrwx 1 www-data www-data 4.0K Apr  2 15:16 storage
-rwxrwxrwx 1 www-data www-data  374 Apr  2 15:16 tailwind.config.js
drwxrwxrwx 1 www-data www-data 4.0K Apr  2 15:16 tests
drwxrwxrwx 1 www-data www-data 4.0K Apr  2 15:16 users
drwxrwxrwx 1 www-data www-data 4.0K Apr 10 12:54 vendor
-rwxrwxrwx 1 www-data www-data  589 Apr  2 15:16 vite.config.js

To me, this doesn't match what I'd expect. Any assistance would be appreciated.

Konafets commented 7 months ago

@adamkdean What do you expect?

jasonvarga commented 7 months ago

To me, this doesn't match what I'd expect.

This is a clone of the statamic/statamic repo which is a Statamic site. The webroot is the public subdirectory. This all looks expected.

The guide also explains setting up nginx and points the site to that public subdirectory. Did you do the nginx bit?

adamkdean commented 7 months ago

Thanks for coming back to me @Konafets @jasonvarga.

I think the page may be out of date — I've since sorted the issue and have it working both on Ubuntu 22.04 and within a docker container without the use of Sails (which may be of interest to folks like me who are unfamiliar and prefer more traditional setups.)

With Ubuntu 20.04, I found that there were compatibility issues with Statamic v4.0.6 and the PHP version (7) bundled with 20.04. While I found resources to upgrade to PHP 8 on Ubuntu 20.04, but given there's only another year of support for 20.04, I figured I'd try 22.04 instead.

I spun up a fresh 22.04 box and installed dependencies etc. It comes with PHP 8 so that solved that issue. In the tutorial however there are still a few issues:

  1. php-curl is missing from the required extensions
  2. /var/www doesn't exist prior to nginx being installed
  3. Cannot (should not?) run composer as superuser so requires temporarily taking over /var/www as non-root user
  4. Missing instruction to symlink the sites-available config file into the sites-enabled config.

This last one was what tripped me up. Easy thing to miss. (Also the public dir, that threw me as well, I missed that detail, but in terms of config it was correct.)

If it'd help, I'd be happy to update the document with the additional steps above.

Additionally, I now have this running in docker without the use of Sails — is this something you'd consider adding to the docs? e.g. Docker with Sails, Docker manual etc. I'm still working a version of the container that doesn't require building, just running.

adamkdean commented 7 months ago

I've now put together a container image so this can be span up easily (docker run -d --name statamic -p 80:80 -e DOMAIN=test.example.com adamkdean/statamic) but looking through the docs, it's not 100% clear to me where persistent files are stored (content, storage?) — is there any guidance on this? Thanks

duncanmcclean commented 6 months ago

If it'd help, I'd be happy to update the document with the additional steps above.

If you're able to, that'd be great! We don't use Ubuntu much ourselves.