|
1 | 1 | # server-cli
|
2 |
| -CLI tool for servers managed by FlyWP |
3 | 2 |
|
4 |
| -## Commands |
| 3 | +Easy CLI tool for servers managed by FlyWP. |
5 | 4 |
|
6 |
| -### WP-CLI |
| 5 | +## Installation |
7 | 6 |
|
8 |
| -**wp-cli**: To access the `wp-cli`, you can use the following command from anywhere in the website folder, and the CLI will find the appropriate WordPress folder to execute the `wp` command. |
| 7 | +### Prerequisites |
9 | 8 |
|
10 |
| -```bash |
11 |
| -fly wp |
12 |
| -``` |
| 9 | +- [Docker](https://www.docker.com/get-started) |
| 10 | +- [Docker Compose](https://docs.docker.com/compose/install/) |
13 | 11 |
|
14 |
| -**Any site**: |
| 12 | +### Quick Install |
| 13 | + |
| 14 | +You can easily install the `fly` CLI tool using the following command. This will download and run the `install.sh` script, which will automatically detect your operating system and architecture, download the latest release, and install it to `/usr/local/bin`: |
15 | 15 |
|
16 | 16 | ```bash
|
17 |
| -fly site <website> wp |
| 17 | +curl -sL https://raw.githubusercontent.com/flywp/server-cli/main/install.sh | bash |
18 | 18 | ```
|
19 | 19 |
|
20 |
| -In-case you want to run a `wp` command in a specific webwebsite, you could run like this. |
| 20 | +### Manual Installation |
21 | 21 |
|
22 |
| -### Site Operations |
| 22 | +If you prefer to manually download and install the binary, follow these steps: |
| 23 | + |
| 24 | +1. Download the precompiled binaries from the [Releases](https://github.com/flywp/server-cli/releases) page. Choose the version suitable for your operating system and architecture. |
23 | 25 |
|
24 |
| -Website names should *preferably* be autocompleted. |
| 26 | +#### Linux |
| 27 | + |
| 28 | +1. Download the tarball: |
| 29 | + ```bash |
| 30 | + wget https://github.com/flywp/server-cli/releases/download/latest/fly-linux-amd64.tar.gz |
| 31 | + ``` |
| 32 | + |
| 33 | +2. Extract the tarball: |
| 34 | + ```bash |
| 35 | + tar -xzf fly-linux-amd64.tar.gz |
| 36 | + ``` |
| 37 | + |
| 38 | +3. Move the binary to a directory in your PATH: |
| 39 | + ```bash |
| 40 | + sudo mv fly-linux-amd64 /usr/local/bin/fly |
| 41 | + ``` |
| 42 | + |
| 43 | +4. Verify the installation: |
| 44 | + ```bash |
| 45 | + fly --version |
| 46 | + ``` |
| 47 | + |
| 48 | +## Usage |
| 49 | + |
| 50 | +### Base Docker Compose |
| 51 | + |
| 52 | +FlyWP has a base Docker Compose configuration for running MySQL, Redis, Ofelia, and Nginx Proxy that are shared for all sites hosted on the server. The base Docker Compose must be started before a site can be created. |
25 | 53 |
|
26 | 54 | ```bash
|
27 |
| -fly site <website> up |
28 |
| -fly site <website> down |
29 |
| -fly site <website> restart |
30 |
| -fly site <website> logs <container> |
31 |
| -fly site <website> restart <container> |
32 |
| -fly site <website> exec <container> |
| 55 | +fly base start # starts the base services (mysql, redis, nginx-proxy) |
| 56 | +fly base stop # stops the base services |
| 57 | +fly base restart # restarts the base services |
33 | 58 | ```
|
34 | 59 |
|
35 |
| -From anywhere inside a site folder: |
| 60 | +### Site Operations |
| 61 | + |
| 62 | +From anywhere inside a site folder, you can run the following commands that will be executed on a per-site basis. |
36 | 63 |
|
37 | 64 | ```bash
|
38 |
| -fly up |
39 |
| -fly down |
40 |
| -fly restart |
41 |
| -fly logs <container> |
42 |
| -fly restart <container> |
43 |
| -fly exec <container> |
| 65 | +fly start # starts the website (via Docker Compose) |
| 66 | +fly stop # stops the website (via Docker Compose) |
| 67 | +fly restart # restarts the website (via Docker Compose) |
| 68 | +fly wp # execute WP-CLI commands |
| 69 | +fly logs <container> # view logs from all containers or a single one |
| 70 | +fly restart <container> # restart a container |
| 71 | +fly exec <container> # execute commands inside a container. Default: "php" |
44 | 72 | ```
|
45 | 73 |
|
46 |
| -### Base Docker Compose |
| 74 | +### WP-CLI |
| 75 | + |
| 76 | +**wp-cli**: To access `wp-cli`, use the following command from anywhere in the website folder. The CLI will find the appropriate WordPress folder to execute the `wp` command. |
47 | 77 |
|
48 | 78 | ```bash
|
49 |
| -fly base stop |
50 |
| -fly base start |
51 |
| -fly base restart |
| 79 | +fly wp |
52 | 80 | ```
|
53 | 81 |
|
54 | 82 | ### Global Commands
|
55 | 83 |
|
| 84 | +A few helper commands to debug the server installation and start/stop all sites. |
| 85 | + |
56 | 86 | ```bash
|
57 |
| -fly status |
58 |
| -fly sites stop |
59 |
| -fly sites start |
60 |
| -fly sites restart |
| 87 | +fly status # shows the status of the system |
| 88 | +fly sites start # starts all sites |
| 89 | +fly sites stop # stops all sites |
| 90 | +fly sites restart # stops and starts all sites |
| 91 | +``` |
| 92 | + |
| 93 | +## License |
| 94 | + |
| 95 | +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. |
61 | 96 | ```
|
0 commit comments