Skip to content

Commit

Permalink
Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioassuncao committed Apr 13, 2024
1 parent a44f46b commit 00fd8bd
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 205 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
APP_NAME="Filament K8s Demo"
APP_ENV=local
APP_KEY=
APP_KEY=base64:41O0zXX5PDtUAfz2FBXAKG1LRPp9lUzy+kZxTpu3wKo=
APP_DEBUG=true
APP_URL=http://localhost:8000

Expand Down
111 changes: 0 additions & 111 deletions .k8s/mysql/deploy.yml

This file was deleted.

88 changes: 0 additions & 88 deletions .k8s/redis/deploy.yml

This file was deleted.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Project demo for my Laravel and Kubernetes workshop with deployment on Azure Kub
This project is a simple demo. I chose to use FrankenPHP with an app server, but alternatively, you could use RoadRunner, Swoole, or Open Swoole. In this setup, there is a Docker Compose file that initializes services locally.

## Start here
* [Create AKS Cluster](./docs/create-aks-cluster.md)
* [Local Development](./docs/local-development.md)
* [Create Azure AKS Cluster](./docs/create-aks-cluster.md)

## Included Items

Expand Down
38 changes: 34 additions & 4 deletions docs/create-aks-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ RESOURCE_GROUP=training-rg
SUBNET_NAME=training-aks-subnet
VNET_NAME=training-aks-vnet
AKS_CLUSTER_NAME=training-aks
K8S_VERSION=1.28
AKS_K8S_VERSION=1.28
ACR_NAME=acrtrainingaks$RANDOM
CONTAINER_TAG=project-training-aks:v1.0.0
CONTAINER_REGISTRY=$ACR_NAME.azurecr.io
APP_NAMESPACE=project-training-ns
AKS_TAGS='project=training'

REDIS_NAME_SERVER='trainingredisdemoserver'
MYSQL_NAME_SERVER='trainingmysqldemoserver'
MYSQL_ADMIN_USER='admin-user'
MYSQL_ADMIN_PASSWORD='M&P@Ssw0rd(x)&%321'


# Log in using Azure CLI
az login

Expand Down Expand Up @@ -56,7 +60,7 @@ az aks create \
--load-balancer-sku standard \
--enable-addons monitoring \
--location $REGION_NAME \
--kubernetes-version $K8S_VERSION \
--kubernetes-version $AKS_K8S_VERSION \
--network-plugin azure \
--vnet-subnet-id $SUBNET_ID \
--service-cidr 10.2.0.0/24 \
Expand Down Expand Up @@ -95,6 +99,8 @@ az aks update \
Optionally, you can build a Docker image of your service using the az acr command, which will handle the build and push to the Azure Container Registry. Of course, you can also use any container registry. Learn more in the [official documentation](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/).

```bash
CONTAINER_TAG=project-training-aks:v1.0.0

az acr build \
--registry $ACR_NAME \
--image $CONTAINER_TAG .
Expand Down Expand Up @@ -182,3 +188,27 @@ spec:
- "domain-or-subdomain-herer.com" # Don't forget to change it to a valid domain or subdomain
secretName: letsencrypt-tls
```

### Create an Azure Database for MySQL server
If you want to learn more, access the [official documentation](https://learn.microsoft.com/en-us/azure/mysql/single-server/quickstart-create-mysql-server-database-using-azure-cli).

```bash
az mysql server create \
--resource-group $RESOURCE_GROUP \
--name $MYSQL_NAME_SERVER \
--location $REGION_NAME \
--admin-user $MYSQL_ADMIN_USER \
--admin-password $MYSQL_ADMIN_PASSWORD \
--sku-name GP_Gen5_2
```

### Create an Azure Redis caches
If you want to learn more, access the [official documentation](https://learn.microsoft.com/en-us/cli/azure/redis?view=azure-cli-latest).
```bash
az redis create \
--location $REGION_NAME \
--name $REDIS_NAME_SERVER \
--resource-group $RESOURCE_GROUP \
--sku Basic \
--vm-size c0
```
31 changes: 31 additions & 0 deletions docs/local-development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## Step-by-Step Installation:

### Step 1:
The first time you start the system, create the `.env` file from the `.env.example` file using the following command:

```bash
cp .env.example .env
```

### Step 2:
Next, start the containers and build the application container using the command:

```bash
docker-compose up -d --build
```

### Step 3:
Check if the `vendor` folder has been created or already exists. If not, install PHP dependencies with the command:

```bash
docker-compose exec app composer install
```

### Step 4:
Wait a few seconds until the MySQL container is ready, and then execute the command to configure the database and perform the initial data load:

```bash
docker-compose exec app php artisan migrate --seed
```

With these steps, the system will be ready to be used for the first time.

0 comments on commit 00fd8bd

Please sign in to comment.