You can find the complete version of thi guide at UserFrosting Learn.
First, install Docker Compose or Docker Desktop.
Second, initialize a new UserFrosting project:
- Get UserFrosting repository :
git clone https://github.com/userfrosting/monorepo.git UFMonorepo
- Change to the new directory :
cd UFMonorepo - Copy the default env file :
cp packages/skeleton/app/.env.docker packages/skeleton/app/.env
- Build all the docker containers:
docker-compose build --no-cache
- Start all the containers:
docker-compose up -d
- Set some directory permissions (your may have to enter your root password):
sudo chown -R $USER: . sudo chmod 777 packages/skeleton/app/{logs,cache,sessions}
- Install all composer modules used in UserFrosting:
docker-compose exec app composer update - Install UserFrosting (database configuration and migrations, creation of admin user, ...). You'll need to provide info to create the admin user.
docker-compose exec app php bakery bake - Restart Vue Container now that Bakery installed frontend assets:
docker-compose restart vue-frontend
Now visit http://localhost:8080 to see your UserFrosting homepage!
All call to bakery commands need to be prefixed by docker-compose, since you need to run theses commands on the containers, not your computer. For example :
docker-compose exec app php bakery ....
You can paste these into a bash file and execute it!
git clone https://github.com/userfrosting/monorepo.git UFMonorepo
cd UFMonorepo
cp packages/skeleton/app/.env.docker packages/skeleton/app/.env
docker-compose build --no-cache
docker-compose up -d
sudo chown -R $USER: .
sudo chmod 777 packages/skeleton/app/{logs,cache,sessions}
docker-compose exec app composer update
docker-compose exec app php bakery bake
docker-compose restart vue-frontendStart / stop containers
If you need to stop the UserFrosting docker containers, just change to your userfrosting directory and run:
docker-compose stopTo start containers again, change to your userfrosting directory and run:
docker-compose up -dPurge docker containers to start over
If you need to purge your docker containers (this will not delete any source file or sprinkle, but will empty the database), run:
docker-compose down --remove-orphansAnd then start the installation process again.
This is not (yet) meant for production!
You may be tempted to run with this in production but this setup has not been security-hardened. For example:
- Database is exposed on port 8593 so you can access MySQL using your favorite client at localhost:8593. However, the way Docker exposes this actually bypasses common firewalls like
ufwso this should not be exposed in production. - Database credentials are hard-coded so obviously not secure.
- File permissions may be more open than necessary.
- HTTPS not implemented fully
- It just hasn't been thoroughly tested in the capacity of being a production system.