Skip to content

Commit 433f2b5

Browse files
authored
Merge pull request #19 from continuousphp/fix/composer_dependency
How to Pipeline & Composer
2 parents 472c89c + a21ff68 commit 433f2b5

File tree

7 files changed

+148
-65
lines changed

7 files changed

+148
-65
lines changed
227 KB
Loading
232 KB
Loading
39.8 KB
Loading

docs/credentials-authentication/ssh.md

Lines changed: 39 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@ category: "credentials-authentication"
55
order: 2
66
excerpt: "SSH Key support by continuousphp"
77
---
8-
If you have private repositories on Bitbucket/Gitlab or a Satis/Toran Proxy with private dependencies,
9-
you can use SSH Keys to access them during your build. Simply go to the *Build Settings* of your pipeline
10-
configuration and enter your private SSH Keys to make them available in every container of your build.
8+
9+
10+
If you need to use private repositories on Bitbucket/Gitlab or a Satis/Toran Proxy with private dependencies, ContinuousPHP offer several ways to reach your goal.
11+
12+
First, simply go to the *Build Settings* of your pipeline configuration and enter your private SSH Keys to make them available in every container of your build.
1113

1214
![SSH Keys](/assets/doc/credentials-authentication/ssh.png)
1315

1416
## Using private repositories from Bitbucket or Gitlab
1517

1618
Using SSH Keys to authenticate, you can use private repositories from *Bitbucket* or *Gitlab* as dependencies in *Composer*. Here
17-
is an example of how to configure *Composer* :
19+
is an example of how to configure *Composer*:
1820

1921
```
2022
{
@@ -27,80 +29,58 @@ is an example of how to configure *Composer* :
2729
"repositories": [
2830
{
2931
"type": "vcs",
30-
"url": "git@bitbucket.org:continuousphp/my-private-dependency.git"
32+
"url": "git@github.com:continuousphp/my-private-dependency.git"
3133
}
3234
]
3335
}
3436
```
3537

36-
## Using private repositories from Satis
37-
38-
Using SSH Keys to authenticate, you can use your own Satis Proxy to install private dependencies with *Composer*. Let's create
39-
an example of how to mirror repositories with Satis and then use them with *Composer* :
40-
41-
### Satis Installation
42-
43-
We first need to install *Satis* :
44-
45-
```
46-
$ composer create-project composer/satis --stability=dev
47-
```
48-
49-
### Satis configuration
50-
51-
Once Satis is installed, create a Satis configuration file, e.g. `satis.json` :
38+
If your library belongs to the same git provider as the one of your project, you need to set your composer.json. Here is an other example.
5239

5340
```
5441
{
55-
"name": "My mirrored dependencies",
56-
"homepage": "http://my-satis-address.com",
42+
"name": "continuousphp/my-application",
43+
"homepage": "https://my-application.com/",
44+
"require": {
45+
"php": ">=5.6",
46+
"continuousphp/my-private-dependency": "~1.0.0"
47+
},
5748
"repositories": [
5849
{
5950
"type": "vcs",
60-
"url": "[email protected]:continuousphp/repository-to-mirror-1.git"
61-
},
62-
{
63-
"type": "vcs",
64-
"url": "[email protected]:continuousphp/repository-to-mirror-2.git"
51+
"url": "git@keyname-bb:continuousphp/my-private-dependency.git"
6552
}
66-
],
67-
"require-all": true,
68-
"require-dependencies": true,
69-
"archive": {
70-
"directory": "dist",
71-
"format": "tar",
72-
"skip-dev": true
73-
}
53+
]
7454
}
7555
```
7656

77-
### Build the repositories
57+
Notice that despite of using directly your git provider url (i.e bitbucket.org, gitlab.com ...) as a hostname, you need to use a specific syntax *keyname-bb* where:
7858

79-
After creating the Satis configuration file, you need to tell Satis create the repositories :
59+
* ***keyname*** refers to the key name specified in your pipeline settings
60+
* ***bb*** refers to bitbucket.org.<br/>
8061

81-
```
82-
$ ./bin/satis build satis.json my-mirrored-dependencies/
83-
```
62+
The below table lists each prefix associated to git hosting services.
8463

85-
When this command finishes, we have a new directory `my-mirrored-dependencies` with two files: `packages.json` and `index.html`.
86-
`packages.json` will be read by *Composer* to determine what packages the repository offers.
87-
`index.html` is a static HTML file with information about the repository.
88-
It also contains the dist directory with all packages so they won’t have to be downloaded from GitHub anymore.
8964

90-
### Use Satis in Composer
65+
<table>
66+
<tr>
67+
<td>bb</td><td>bitbucket.org</td>
68+
</tr>
69+
<tr>
70+
<td>gh</td><td>github.com</td>
71+
</tr>
72+
</table>
9173

92-
To use our new Satis Proxy with *Composer* we have to include it in our `composer.json` like this :
9374

94-
```
95-
{
96-
"repositories": [
97-
{
98-
"type": "composer",
99-
"url": "http://my-satis-address.com"
100-
}
101-
],
102-
...
103-
}
104-
```
75+
### ***Only for Bitbucket*** alternatively add ContinuousPHP deploy key to your private library
76+
77+
For instance, you want to build the [email protected]:account_of_project/project which depends on the library git@library_hosting_service:account_of_library/library.<br/>
78+
Then you can get the deploy key used by ContinuousPHP and add it to your library repository.
79+
80+
![bitbucket settings](/assets/doc/credentials-authentication/bitbucket_account_settings.png)
81+
82+
![bitbucket_continuousphp_deploykey](/assets/doc/credentials-authentication/bitbucket_continuousphp_deploykey.png)
83+
84+
In this way, you don't need to refer any keys in your pipeline settings.
10585

106-
And that's it! When running `composer install`, *Composer* should now install your private dependencies directly from Satis.
86+
If these solutions don't exactly match your needs, you could try to use Satis as explained in this [section](../satis.md).

docs/faq.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
layout: doc
3+
title: "FAQ - Documentation"
4+
category: "faq"
5+
order: 1
6+
excerpt: "FAQ by continuousphp"
7+
---
8+
9+
10+
## Composer fails while installing additional libraries
11+
12+
If you see a "RuntimeException" message while composer installs additional librairies, please refer to this [section](./credentials-authentication/ssh.md) about SSH keys settings.
13+
14+
## ContinuousPHP cannot clone my project
15+
16+
If ContinuousPHP is not able to clone your project, that is probably due to an unwanted removal of the ContinuousPHP deployment key from your git provider. So you can try to reset hooks.<br/>
17+
The associated button can be found in your pipeline settings as described on the below screenshot.
18+
19+
![Reset_hook_button](/assets/doc/faq/reset_hook_localisation.png)
20+
21+

docs/satis.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
layout: doc
3+
title: "Satis configuration - Documentation"
4+
category: "reference-guide"
5+
order: 2
6+
excerpt: "Satis configuration support by continuousphp"
7+
---
8+
9+
10+
## Using private repositories from Satis
11+
12+
Using SSH Keys to authenticate, you can use your own Satis Proxy to install private dependencies with *Composer*. Let's create an example of how to mirror repositories with Satis and then use them with *Composer*.
13+
14+
### Satis Installation
15+
16+
You first need to install *Satis* :
17+
18+
```
19+
$ composer create-project composer/satis --stability=dev
20+
```
21+
22+
### Satis configuration
23+
24+
Once Satis is installed, create a Satis configuration file, e.g. `satis.json` :
25+
26+
```
27+
{
28+
"name": "My mirrored dependencies",
29+
"homepage": "http://my-satis-address.com",
30+
"repositories": [
31+
{
32+
"type": "vcs",
33+
"url": "[email protected]:continuousphp/repository-to-mirror-1.git"
34+
},
35+
{
36+
"type": "vcs",
37+
"url": "[email protected]:continuousphp/repository-to-mirror-2.git"
38+
}
39+
],
40+
"require-all": true,
41+
"require-dependencies": true,
42+
"archive": {
43+
"directory": "dist",
44+
"format": "tar",
45+
"skip-dev": true
46+
}
47+
}
48+
```
49+
50+
### Build the repositories
51+
52+
After creating the Satis configuration file, you need to tell Satis create the repositories :
53+
54+
```
55+
$ ./bin/satis build satis.json my-mirrored-dependencies/
56+
```
57+
58+
When this command finishes, you have a new directory `my-mirrored-dependencies` with two files: `packages.json` and `index.html`.
59+
`packages.json` will be read by *Composer* to determine what packages the repository offers.
60+
`index.html` is a static HTML file with information about the repository.
61+
It also contains the dist directory with all packages so they won’t have to be downloaded from GitHub anymore.
62+
63+
### Use Satis in Composer
64+
65+
To use our new Satis Proxy with *Composer* you have to include it in our `composer.json` like this :
66+
67+
```
68+
{
69+
"repositories": [
70+
{
71+
"type": "composer",
72+
"url": "http://my-satis-address.com"
73+
}
74+
],
75+
...
76+
}
77+
```
78+
79+
And that's it! When running `composer install`, *Composer* should now install your private dependencies directly from Satis.
80+

mkdocs.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,17 @@ nav:
8585
- Zend Server: deployment/zend-server.md
8686
- Reference guide:
8787
- Configure firewall & network: security/firewall.md
88+
- Configure Satis: satis.md
8889
- Packages & services overview: containers.md
8990
- Use specific containers:
9091
- SQL:
9192
- SQL: databases.md
92-
- MYSQL: databases/mysql.md
93-
- MARIADB: databases/mariadb.md
94-
- POSTGRESQL: databases/postgresql.md
95-
- SQLITE: databases/sqlite.md
96-
- ORACLE XE: databases/oracle.md
97-
- VIRTUOSO 7: databases/virtuoso.md
93+
- MySQL: databases/mysql.md
94+
- MariaDB: databases/mariadb.md
95+
- PostgreSQL: databases/postgresql.md
96+
- SQLite: databases/sqlite.md
97+
- Oracle XE: databases/oracle.md
98+
- Virtuoso 7: databases/virtuoso.md
9899
- NoSQL:
99100
- NoSQL: nosql.md
100101
- MongoDB: nosql/mongodb.md
@@ -127,3 +128,4 @@ nav:
127128
- IRC: notification/irc.md
128129
- HTTP: notification/http.md
129130
- AWS SNS: notification/aws-sns.md
131+
- FAQ: faq.md

0 commit comments

Comments
 (0)