Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit d6309c6

Browse files
committed
chore: change root directory
Root directory is changed from /stackhead to /etc/stackhead as this is a better location for applications.
1 parent c04c510 commit d6309c6

File tree

8 files changed

+32
-27
lines changed

8 files changed

+32
-27
lines changed

Documentation/introduction/cli-configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ See example below for setting the setting _server_names_hash_bucket_size_ for th
99

1010
{% hint style="warning" %}
1111
The `modules` and `modules_config` settings may be overwritten via server configuration.
12-
The server configuration is located in `/stackhead/config.yml` (if it exists).
12+
The server configuration is located in `/etc/stackhead/config.yml` (if it exists).
1313
{% endhint %}
1414

1515
## Full annotated configuration

Documentation/introduction/commands.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ and the non-root StackHead user that is used for deploying projects.
2020

2121
This command needs to be executed before projects can be deployed onto the target server.
2222

23-
{% hint style="info" %}
24-
Right now it is not possible for StackHead to deal with SSH fingerprints. Please connect to the server yourself via SSH
25-
and accept the fingerprint hashes. Otherwise StackHead CLI is stuck in the connecting phase and can not proceed.
26-
{% endhint %}
27-
2823
### Syntax
2924

3025
```shell
@@ -33,7 +28,7 @@ stackhead-cli setup [IPv4 or IPv6 address]
3328

3429
### Example
3530

36-
```bash
31+
```shell
3732
# IPv4
3833
stackhead-cli setup 123.45.67.8
3934

@@ -64,7 +59,7 @@ stackhead-cli project deploy [path to project definition] [ipv4 address] [--auto
6459

6560
### Example
6661

67-
```bash
62+
```shell
6863
./bin/stackhead-cli project deploy my_file.stackhead.yml 123.45.67.8
6964
```
7065

@@ -81,7 +76,7 @@ stackhead-cli project destroy [path to project definition] [ipv4 address]
8176

8277
### Example
8378

84-
```bash
79+
```shell
8580
./bin/stackhead-cli project destroy my_file.stackhead.yml 123.45.67.8
8681
```
8782

@@ -91,7 +86,7 @@ There are two commands you can use in order to validate StackHead configuration
9186

9287
### Syntax
9388

94-
```
89+
```shell
9590
# Validate Project definition file
9691
./bin/stackhead-cli project validate [path to project definition]
9792

@@ -101,7 +96,7 @@ There are two commands you can use in order to validate StackHead configuration
10196

10297
### Example
10398

104-
```bash
99+
```shell
105100
# Validate Project definition file
106101
./bin/stackhead-cli project validate my_file.stackhead.yml
107102

Documentation/introduction/getting-started.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,9 @@ stackhead-cli destroy ./stackhead/example_app.stackhead.yml 123.456.789.10
8686
stackhead-cli destroy ./stackhead/example_app.stackhead.yml 1234:4567:90ab:cdef::1
8787
```
8888

89+
## Troubleshotting
90+
91+
### Setup fails: `Unable to prepare setup. (ssh: handshake failed: knownhosts: key mismatch)`
92+
93+
Looks like the SSH signature from the target server changed and does not match the value saved in `~/.ssh/stackhead_known_hosts` anymore.
94+
Remove the entry for the server IP address there and try again.

Documentation/introduction/project-definition.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,15 @@ Note that you should not use or call any files in the file that are not already
191191

192192
StackHead saves mounted data in the project directory at project or service level. You can also define a custom location on the server.
193193

194-
| Configuration | Description | Allowed values |
195-
| :--- | :--- | :--- |
196-
| `type` \(required\) | Determines the data storage location | "global", "local" or "custom" |
197-
| | **global**: Data storage location is located at `/stackhead/projects/[project_name]/container_data/global/` | |
198-
| | **local**: Data storage location is located at `/stackhead/projects/[project_name]/container_data/services/[service_name]/` | |
199-
| | **custom**: No data storage location. You have to set it yourself using the _src_ setting below \(absolute path!\). | |
194+
| Configuration | Description | Allowed values |
195+
| :--- |:-------------------------------------------------------------------------------------------------------------------------------| :--- |
196+
| `type` \(required\) | Determines the data storage location | "global", "local" or "custom" |
197+
| | **global**: Data storage location is located at `/etc/stackhead/projects/[project_name]/container_data/global/` | |
198+
| | **local**: Data storage location is located at `/etc/stackhead/projects/[project_name]/container_data/services/[service_name]/` | |
199+
| | **custom**: No data storage location. You have to set it yourself using the _src_ setting below \(absolute path!\). | |
200200
| `src` \(required for type=custom\) | Relative path inside data storage location that should be mounted. Note: When type=custom this is has to be an absolute path! | any string |
201-
| `dest` | Absolute path inside the Docker container where the mount should be applied | any string |
202-
| `mode` | Defines if the volume should be read-write \(rw\) or readonly \(ro\) | "rw" \(default\) or "ro" |
201+
| `dest` | Absolute path inside the Docker container where the mount should be applied | any string |
202+
| `mode` | Defines if the volume should be read-write \(rw\) or readonly \(ro\) | "rw" \(default\) or "ro" |
203203

204204
Below you can see a comparison of the project definition \(left\) and the equivalent docker-compose definition:
205205

@@ -232,8 +232,8 @@ services:
232232
nginx:
233233
# ...
234234
volumes:
235-
- /stackhead/projects/example_project/container_data/global/assets:/var/www/public/assets:rw
236-
- /stackhead/projects/example_project/container_data/services/nginx/log:/var/www/public/log:rw
235+
- /etc/stackhead/projects/example_project/container_data/global/assets:/var/www/public/assets:rw
236+
- /etc/stackhead/projects/example_project/container_data/services/nginx/log:/var/www/public/log:rw
237237
- /etc/secrets.txt:/var/www/secrets.txt:ro
238238
```
239239
{% endcode %}

Documentation/technical-documentation/ssl-certificates.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ The figure above shows the organisation of SSL certificates and how they are use
1010

1111
The **snakeoil certificate** is created during server setup. It is a selfsigned certificate that technically expires after 100 years after creation, i.e. never. \(If it really expires simply run the server setup again.\)
1212

13-
The certificate and corresponding private key is stored inside the `/stackhead/certificates` directory.
13+
The certificate and corresponding private key is stored inside the `/etc/stackhead/certificates` directory.
1414

1515
Freshly generated Nginx configurations will have a certificate paths that are symlinked to these snakeoil files, enabling Nginx to start.
1616

1717
## Project certificates
1818

19-
Project certificates are generated after the Nginx server configuration is written and active. They are stored inside the `certificates` folder of the project directory \(i.e. `/stackhead/projects/<project_name>/certificates`\).
19+
Project certificates are generated after the Nginx server configuration is written and active. They are stored inside the `certificates` folder of the project directory \(i.e. `/etc/stackhead/projects/<project_name>/certificates`\).
2020

2121
After creation, the symlinked path to the certificate used by Nginx is switched to the generated certificate \(and private key\) and the Nginx configuration is reloaded.
2222

Documentation/technical-documentation/upgrading.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ We recommend setting up the projects from scratch. However it should be possible
88

99
## Breaking Changes
1010

11+
### Change root directory
12+
13+
The root directory was changed from `/stackhead` to `/etc/stackhead`.
14+
1115
### Removed Terraform
1216

1317
Terraform is nice and great, but it is a software that requires updates. The main software and plugins as well.

commands/setup.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func userSetup() error {
115115

116116
// Add stackhead user if it does not exist
117117
if _, _, err := system.RemoteRun("id", system.RemoteRunOpts{Args: []string{"stackhead"}}); err != nil {
118-
if _, _, err := system.RemoteRun("adduser", system.RemoteRunOpts{Args: []string{"--system --shell /bin/sh --uid 1412 --no-create-home --home=/stackhead --gid 1412 stackhead"}}); err != nil {
118+
if _, _, err := system.RemoteRun("adduser", system.RemoteRunOpts{Args: []string{"--system --shell /bin/sh --uid 1412 --no-create-home --home=" + config.RootDirectory + " --gid 1412 stackhead"}}); err != nil {
119119
return fmt.Errorf("unable to add stackhead user")
120120
}
121121
}
@@ -157,11 +157,11 @@ func userSetup() error {
157157
logger.Debugln(err)
158158
return fmt.Errorf("unable to read local stackhead public SSH key")
159159
}
160-
if err := xfs.CreateFolder("ssh:///stackhead/.ssh"); err != nil {
160+
if err := xfs.CreateFolder("ssh://" + config.RootDirectory + "/.ssh"); err != nil {
161161
return err
162162
}
163163
if err := xfs.WriteFile(
164-
"ssh:///stackhead/.ssh/authorized_keys",
164+
"ssh://"+config.RootDirectory+"/.ssh/authorized_keys",
165165
string(publicKeyBytes),
166166
); err != nil {
167167
return err

config/paths.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/shibukawa/configdir"
88
)
99

10-
var RootDirectory = "/stackhead"
10+
var RootDirectory = "/etc/stackhead"
1111
var ProjectsRootDirectory = RootDirectory + "/projects"
1212

1313
func GetServerConfigFilePath() string {

0 commit comments

Comments
 (0)