Skip to content

Commit 5c490a3

Browse files
committed
Updating lesson docs
1 parent 32a389d commit 5c490a3

File tree

4 files changed

+114
-14
lines changed

4 files changed

+114
-14
lines changed

docs/lessons/1_install_api_platform.md

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,53 @@ php artisan migrate
6565

6666
6. Make requests to http://127.0.0.1:8000/api/books via Postman
6767

68-
7. Upload to Cloudways via Git/Control panel
68+
## Cloudways
6969

70-
8. Change Cloudways PHP version setting to use PHP 8.3
70+
7. Login to Cloudways and add a server with the following details:
71+
- Application = PHP Custom App
72+
- Application name = book-app
73+
- Server name = demo
74+
- Project = book-app
75+
- Server = DigialOcean
76+
- Server size = 1GB
77+
- Location = London
7178

72-
8. Change Cloudways webroot to `public_html/public`
79+
8. From Servers -> demo -> Settings and Packages -> Packages update the PHP version to PHP 8.3
7380

74-
9. SSH onto the VPS copy `.env.test` to `.env`
81+
9. From Applications -> book-app -> Application Settings Change the webroot from `public_html` to `public_html/public`
7582

76-
8. SSH onto the VPS and run commands in ./deploy.sh
83+
10. From Applications -> book-app -> Deployment via Git click on Generate SSH Keys
7784

85+
11. Once SSH keys have been created view and copy key
7886

87+
## GitHub
88+
89+
12. Log in to GitHub and go to repository `https://github.com/howToCodeWell/laravel-book-api`
90+
91+
13. From Settings -> Deploy keys click add deploy key
92+
93+
14. Paste copied key and give it the title of `Cloudways`. Click on add key.
94+
95+
## Cloudways
96+
97+
15. From Applications -> book-app -> Deployment via Git add git remote address `[email protected]:howToCodeWell/laravel-book-api.git` and click authenticate
98+
99+
16. From Applications -> book-app -> Deployment via Git select main branch and click start deployment
100+
101+
102+
## SSH
103+
17. SSH onto the VPN use credentials found in Servers -> demo -> Master Credentials
104+
105+
18. Go to applications/<app>/public_html
106+
107+
19. SSH onto the VPS copy `.env.test` to `.env`
108+
109+
20. Create database file `touch database/database.sqlite`
110+
111+
21. Install composer `composer install`
112+
113+
22. Install assets `php artisan api-platform:install`
114+
115+
23. Migrate the database `php artisan migrate`
116+
117+
24. View app in browser

docs/lessons/2_build_script.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Lesson 3: Create build script to deploy Laravel
2+
3+
1. Create `build.sh`
4+
5+
```bash
6+
#!/bin/bash
7+
8+
echo "Running deploy script"
9+
10+
echo "[1/4] Pulling from github"
11+
git pull origin
12+
13+
echo "[1/5] Creating database if one isn't found"
14+
touch database/database.sqlite
15+
16+
echo "[2/6] Installing packages using composer"
17+
composer install
18+
19+
echo "[3/7] Publishing API Platform assets"
20+
php artisan api-platform:install
21+
22+
echo "[4/8] Migrating database"
23+
php artisan migrate --force
24+
25+
echo "Site has been deployed!"
26+
27+
```
28+
29+
3. Change permissions of `build.sh` to allow for executable
30+
31+
```bash
32+
sudo chmod +x deploy.sh
33+
```
34+
35+
4. Commit changes to repo
36+
37+
5. Change Cloudways PHP version setting to use PHP 8.3
38+
39+
6. Change Cloudways webroot to `public_html/public`
40+
41+
7. SSH on VPS and create SSH key
42+
43+
```bash
44+
ssh-keygen -t rsa
45+
```
46+
47+
8. Copy SSH key
48+
```bash
49+
cat /home/master/.ssh/id_rsa.pub
50+
```
51+
9. Log in to GitHub and add key as deploy key
52+
53+
10. Set Git config
54+
55+
```bash
56+
git config pull.rebase false
57+
```
58+
59+
11. Make directory safe for git
60+
61+
```bash
62+
63+
pwd
64+
/home/master/applications/ejpujunzye/public_html
65+
66+
git config --global --add safe.directory /home/1352768.cloudwaysapps.com/ejpujunzye/public_html
67+
```
68+
12. SSH into VPS and clone the app onto `public_html`
69+
70+
13. Run `./build.sh` to update app
File renamed without changes.

docs/lessons/3_host_multiple_sites.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)