Skip to content

Commit

Permalink
Updates to docker/readme
Browse files Browse the repository at this point in the history
  • Loading branch information
clpetersonucf committed Oct 29, 2024
1 parent 684f5e4 commit f21d5ef
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
We publish production ready docker containers for each release in the [Materia GitHub Docker Repository](https://github.com/orgs/ucfopen/packages/container/package/materia). These images are built and published automatically using GitHub Actions on every tagged release.

```
docker pull ghcr.io/ucfopen/materia:webserver-v8.0.0
docker pull ghcr.io/ucfopen/materia:app-v8.0.0
docker pull ghcr.io/ucfopen/materia:webserver-stable
docker pull ghcr.io/ucfopen/materia:app-stable
```

## Container Architecture

1. [webserver (Nginx)](https://www.nginx.com/) as a web server (proxies to phpfpm for app and serves static files directly)
3. [app (PHP-FPM)](https://php-fpm.org/) manages the PHP processes for the application
4. [mysql](https://www.mysql.com/) for storing relational application data
5. [memcached](https://memcached.org/) for caching data and sessions
6. [fakeS3](https://github.com/jubos/fake-s3) mocks AWS S3 behavior for asset uploading
1. [webserver (Nginx)](https://www.nginx.com/) as a web server (proxies to phpfpm for app and serves static files directly).
3. [app (PHP-FPM)](https://php-fpm.org/) manages the PHP processes for the application.
4. [mysql](https://www.mysql.com/) for storing relational application data.
5. [memcached](https://memcached.org/) for caching data and sessions.
6. [fakeS3](https://github.com/jubos/fake-s3) mocks AWS S3 behavior for asset uploading. This should not be used in production.

## Setup

Expand All @@ -25,15 +25,15 @@ Please take note of the user accounts that are created for you in the install pr

* Run the containers after ./run_first.sh has finished
```
docker-compose up
docker compose up
```
* Run the servers in background
```
docker-compose up -d
docker compose up -d
```
* Tail logs from background process
```
docker-compose logs -f app
docker compose logs -f app
```
* Run commands on the app container (like php, composer, or fuelphp oil commands)
```
Expand All @@ -43,16 +43,17 @@ Please take note of the user accounts that are created for you in the install pr
```
* Stop containers (db data is retained)
```
docker-compose stop
docker compose stop
```
* Stop and destroy the containers (deletes database data!, first_run.sh required after)
```
docker-compose down
docker compose down
```
* Compile the javascript and sass
```
./run_build_assets.sh
```
_Note:_ this is more easily accomplished by running `yarn dev` from the root Materia directory locally.
* Install composer libraries
```
./run.sh composer install
Expand All @@ -65,25 +66,25 @@ Please take note of the user accounts that are created for you in the install pr
```
./run_tests.sh
```
* Run Tests for as like the CI server
```
./run_tests_ci.sh
```
* Run Tests with code coverage
```
./run_tests_coverage.sh
```
* Create a user based on your docker host machine's current user
```
$ iturgeon@ucf: ./run_create_me.sh
User Created: iturgeon password: kogneato
iturgeon now in role: super_user
iturgeon now in role: basic_author
$ kogneato@ucf: ./run_create_me.sh
User Created: kogneato password: max_power
kogneato now in role: super_user
kogneato now in role: basic_author
```
* Create the [default users outlined in the config](https://github.com/ucfopen/Materia/blob/master/fuel/app/config/materia.php#L56-L78)
```
./run_create_default_users.sh
```
* Create a user manually
```
./run.sh php oil r admin:new_user username firstname mi lastname email password
```
* Build a deployable materia package (zip w/ compiled assets, and dependencies; see [assets on our releases](https://github.com/ucfopen/Materia/releases))
```
./run_build_github_release_package.sh
Expand Down Expand Up @@ -112,13 +113,13 @@ If you wish to log into Materia, there are [3 default accounts created for you b
If you're wanting to update a php or mysql version, this can be done locally for testing before updating the global image.

1. finish your edits.
2. Execute `docker-compose build` to rebuild any images.
4. Removing any existing running container using that image: `docker-compose stop app` and `docker-compose rm app`
5. Start the desired container: `docker-compose up app`
2. Execute `docker compose build` to rebuild any images.
4. Removing any existing running container using that image: `docker compose stop app` and `docker compose rm app`
5. Start the desired container: `docker compose up app`

## Production Ready Docker Compose

If you plan on deploying a production server using these docker images, we suggest using docker-compose. You will probably want to have an external database service (like AWS's RDS), and you'll need a place to keep backups of any uploaded files.
If you plan on deploying a production server using these docker images, we suggest using docker compose. You will probably want to have an external database service (like AWS's RDS), and you'll need a place to keep backups of any uploaded files.

### Dynamic Files to Backup

Expand All @@ -137,7 +138,7 @@ version: '3.5'

services:
webserver:
image: ghcr.io/ucfopen/materia:webserver-v8.0.0
image: ghcr.io/ucfopen/materia:webserver-stable
ports:
# 443 would be terminated at the load balancer
# Some customization required to terminate 443 here (see dev nginx config)
Expand All @@ -153,7 +154,7 @@ services:
- app

app:
image: ghcr.io/ucfopen/materia:app-v8.0.0
image: ghcr.io/ucfopen/materia:app-stable
env_file:
# View Materia Readme for ENV vars
- .env
Expand Down Expand Up @@ -200,6 +201,6 @@ volumes:

### Troubleshooting

#### Table Not Found
#### Table Not Found or PDO Exceptions During Installation

When running fuelphp's install, it uses fuel/app/config/development/migrations.php file to know the current state of your database. Fuel assumes this file is truth, and won't create tables even on an empty database. You probably need to delete the file and run the setup scripts again. run_first.sh does this for you if needed.

0 comments on commit f21d5ef

Please sign in to comment.