Skip to content

Commit 436c6f0

Browse files
authored
Merge pull request #67 from packagist/self-hosted/kubernetes
Self hosted Kubernetes Documentation
2 parents 2387f01 + f079745 commit 436c6f0

File tree

9 files changed

+281
-0
lines changed

9 files changed

+281
-0
lines changed
260 KB
Loading
212 KB
Loading
121 KB
Loading
113 KB
Loading
183 KB
Loading
144 KB
Loading
203 KB
Loading
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
## Installing Private Packagist Self-Hosted with an embeded Kubernetes cluster
2+
##
3+
4+
Private Packagist Self-Hosted leverages the [kots](https://docs.replicated.com/reference/kots-cli-getting-started)
5+
kubectl plugin by Replicated to run on a Kubernetes cluster. The plugin provides a management interface to your
6+
Private Packagist Self-Hosted installation and allows you to monitor the application and perform maintenance operations
7+
such as backups or updates.
8+
9+
This page will guide you through an installation without an existing cluster. To instead install Private Packagist Self-Hosted
10+
in an existing Kubernetes cluster follow [this guide](./kubernetes-existing.md).
11+
12+
## General requirements
13+
14+
1. License Key File (file extension .yaml) Don't have one yet? [Sign up for a free trial license!](https://packagist.com/self-hosted)
15+
1. One (sub-)domain to operate the web interface, e.g. packagist.myintranet.com
16+
1. One (sub-)domain to operate the composer repository, e.g. repo.packagist.myintranet.com or packagist-repo.myintranet.com
17+
1. An SSL certificate valid for both chosen domains or use Let's Encrypt to generate a certificate for you
18+
1. An SMTP server or a GMail account for Private Packagist Self-Hosted to send email
19+
1. A Linux Server
20+
* A [supported operating system](https://kurl.sh/docs/install-with-kurl/system-requirements#supported-operating-systems)
21+
* At least 8GB memory
22+
* At least 4 CPU cores
23+
* At least 80GB disk space (or 40GB of disk space if a hosted Redis, PostgreSQL, and blob storage are used)
24+
* Ports 80, 443, and 8800 must be accessible, for a full list of ports
25+
* Must be reachable at the chosen domain names from your local machine
26+
1. If your firewall restricts external connections the following domains must be accessible from the server:
27+
* hub.docker.com
28+
* proxy.replicated.com
29+
* replicated.app
30+
* amazonaws.com
31+
* k8s.gcr.io
32+
* k8s.kurl.sh (required to install the kots CLI)
33+
* kots.io (required to install the kots CLI)
34+
* github.com (required to install the kots CLI)
35+
<!-- See https://docs.replicated.com/enterprise/installing-general-requirements and https://kurl.sh/docs/install-with-kurl/system-requirements -->
36+
37+
## Installation
38+
39+
To install Private Packagist Self-Hosted and Replicated run the command below.
40+
To learn more about options for the easy install script, please refer to the [Replicated manual on Installing Replicated](https://help.replicated.com/docs/kubernetes/customer-installations/installing/).
41+
```
42+
curl -sSL https://kurl.sh/privatepackagistkots | sudo bash
43+
```
44+
45+
To log in to the admin console, you will need the password shown at the end of the install command. You can also always
46+
regenerate the admin console password via `sudo kubectl kots reset-password privatepackagistkots`.
47+
48+
After your Replicated Kubernetes cluster is up and running you can follow the rest of the Packagist guide.
49+
50+
### Replicated Configuration
51+
#### Replicated Setup
52+
Once Replicated’s services are installed on your server you need to access the management console on your browser.
53+
It’s available via SSL on port 8800. Open https://packagist.myintranet.com:8800/ in your browser (replace the domain with your own).
54+
You will have to proceed despite the security warning (since your certificate is still missing).
55+
56+
![SSL Warning](/Resources/public/img/docs/self-hosted/console-tls-warning.png)
57+
58+
Upload your SSL certificate on the next screen. SSL should work correctly from the next page.
59+
If your certificate requires intermediate certificates to be recognized by your browser and/or Composer,
60+
you can paste them into the certificate file together with your own certificate.
61+
Make sure your own certificate comes first, any intermediate certificate next and the root certificate last.
62+
If the order is off replicated will not recognize your certificate at all.
63+
64+
If instead you would like to use Let's Encrypt to automatically generate a certificate for Private Packagist then you can
65+
continue with the self-signed certificate for now. Please note that the Let's Encrypt certificate won't be used for the
66+
admin console.
67+
68+
![SSL Setup](/Resources/public/img/docs/self-hosted/tls-configuration.png)
69+
70+
Login to the admin console using the password generated during the kots application installation.
71+
72+
![Login to Admin Console](/Resources/public/img/docs/self-hosted-kubernetes/console-login.png)
73+
74+
On the next screen, you can upload the supplied .yaml license key file. If you don't have the license key file yet then
75+
you can download it from https://packagist.com.
76+
77+
![Upload License](/Resources/public/img/docs/self-hosted-kubernetes/console-license.png)
78+
79+
#### Configure Private Packagist Self-Hosted
80+
The configuration screen is where you can set up the domains used for Private Packagist and the email configuration. It
81+
is also the place where you can configure if Private Packagist should use an existing Redis, PostgreSQL, or blob storage.
82+
![Configuration](/Resources/public/img/docs/self-hosted-kubernetes/console-config.png)
83+
84+
Every configuration change or application update will trigger a preflight check. Once the preflight check have passed,
85+
the changes can be applied to your Kubernetes cluster.
86+
![Preflight Check](/Resources/public/img/docs/self-hosted-kubernetes/console-preflight.png)
87+
88+
The application overview in the admin console shows you the application status, your current license information, and any
89+
available updates for Private Packagist. Once the application has entered the ready state, you can access Private Packagist
90+
via the domain configured for the web interface e.g. packagist.myintranet.com and finish the setup there.
91+
![Application Overview](/Resources/public/img/docs/self-hosted-kubernetes/console-application-overview.png)
92+
93+
### Setup authenticateion and Select Admin
94+
95+
#### Authentication Setup
96+
Within Private Packagist Self-Hosted, you now need to set up at least one user authentication method.
97+
You have the choice between authentication with email addresses and passwords and several OAuth integrations with third-party services.
98+
We provide integrations with on-premises versions of GitHub, Bitbucket, GitLab, or their public services on github.com, bitbucket.org,
99+
or gitlab.com. Follow the instructions to create the respective required identifiers, tokens, and secrets.
100+
101+
* [GitHub (Enterprise) Integration Setup](./github-integration-setup.md)
102+
* [Bitbucket.org Integration Setup](./bitbucket-integration-setup.md)
103+
* [Bitbucket Data Center / Server Integration Setup](./bitbucket-server-integration-setup.md)
104+
* [GitLab Integration Setup](./gitlab-integration-setup.md)
105+
* [Authentication with Email Addresses and Passwords](./authentication-email-addresses-passwords-setup.md).
106+
107+
108+
![Add Integration](/Resources/public/img/docs/self-hosted/08-integration.png)
109+
110+
#### Selecting Admins
111+
After setting up an integration, you can log in through the top menu. Register an account and pick a username.
112+
113+
![Register Admin](/Resources/public/img/docs/self-hosted/09-register-admin.png)
114+
115+
The first user is granted admin permissions automatically. You can grant admin permissions to more users in the admin panel.
116+
117+
![Add Admin](/Resources/public/img/docs/self-hosted/10-add-admin.png)
118+
119+
#### Switching to Production Mode
120+
Head back to the admin console to disable the Setup Mode in the configuration. Once the preflight checks passed, you can
121+
apply the changes.
122+
123+
That’s it! Private Packagist Self-Hosted is now ready to be used! You’ll find all further information in the web interface.
124+
125+
## Database and storage
126+
127+
Private Packagist Self-Hosted will set up PostgreSQL, Redis, and MinIO to store application data and Composer packages.
128+
Each of them requires one or more volumes if you prefer to avoid that then you can configure to use your own PostgreSQL,
129+
Redis, and blob storage. For blob storage, we currently support Azure Blob Storage, Google Cloud Storage, AWS S3, and
130+
other S3-compatible storage solutions.
131+
132+
Please note that the backup solution provided only covers the built-in services and you are responsible for creating backups
133+
of any services that you run yourself.
134+
135+
## Backups
136+
137+
The Replicated Admin console integrates with [Velero](https://velero.io/), a tool to back up and restore your Kubernetes
138+
cluster resources and persistent volumes. It is automatically installed with an embedded cluster installation.
139+
140+
Once your Private Packagist Self-Hosted is up and running, you can configure the storage destination and the backup
141+
schedule in the Replicated Admin console under Snapshot settings. We recommend using an external storage solution like
142+
Amazon S3 and configuring full snapshots.
143+
144+
To restore Private Packagist Self-Hosted from a snapshot, access the "Full Snapshots" and click on the "Restore from backup"
145+
icon. You will then see information on how to either perform a full restore or only restore the Private Packagist Self-Hosted
146+
application. During the restore process both Private Packagist Self-Hosted and the Replicated Admin console will become
147+
unavailable.
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# Installing Private Packagist Self-Hosted on an existing Kubernetes cluster
2+
##
3+
4+
Private Packagist Self-Hosted leverages the [kots](https://docs.replicated.com/reference/kots-cli-getting-started)
5+
kubectl plugin by Replicated to run on a Kubernetes cluster. The plugin provides a management interface to your
6+
Private Packagist Self-Hosted installation. It also allows you to monitor the application and perform maintenance operations
7+
such as backups or updates.
8+
9+
This page will guide you through an installation with an existing cluster, to instead install Private Packagist Self-Hosted
10+
without an existing Kubernetes cluster follow [this guide](./kubernetes-embedded.md).
11+
12+
## General requirements
13+
14+
1. A Kubernetes cluster v1.23 or v1.24
15+
1. License Key File (file extension .yaml) Don't have one yet? [Sign up for a free trial license!](https://packagist.com/self-hosted)
16+
1. One (sub-)domain to operate the web interface, e.g. packagist.myintranet.com
17+
1. One (sub-)domain to operate the Composer repository, e.g. repo.packagist.myintranet.com or packagist-repo.myintranet.com
18+
1. An SSL certificate valid for both chosen domains or a way to generate one in your cluster like [cert-manager](https://cert-manager.io/)
19+
1. An SMTP server or a GMail account for Private Packagist Self-Hosted to send email
20+
1. If your firewall restricts external connections the following domains must be accessible from the server:
21+
* hub.docker.com
22+
* proxy.replicated.com
23+
* replicated.app
24+
* kots.io (required to install the kots CLI)
25+
* github.com (required to install the kots CLI)
26+
<!-- See https://docs.replicated.com/enterprise/installing-general-requirements -->
27+
28+
## Installation
29+
30+
Private Packagist requires the installation of the [kots](https://docs.replicated.com/reference/kots-cli-getting-started)
31+
kubectl plugin from Replicated. The plugin provides an admin console to configure and update Private Packagist Self-Hosted.
32+
33+
The commands below will install the kots plugin and add the Private Packagist Self-Hosted application.
34+
At the end of the install script, kots will set up a port forward to localhost:8800 where you can continue with the Private
35+
Packagist Self-Hosted setup. Once Private Packagist is fully configured and setup, it is recommended to stop the port
36+
forwarding and only start it again to make changes to the configuration or update the application.
37+
38+
Please note: by default the install command will set up a MinIO instance for storage used by the admin console. You can
39+
skip this by setting the `--with-minio` flag to `false`. For a full list of configuration options see the
40+
[CLI documentation](https://docs.replicated.com/reference/kots-cli-install).
41+
42+
```
43+
curl https://kots.io/install | bash
44+
# Verify the plugin installation
45+
kubectl kots --help
46+
# Install the Private Packagist application
47+
kubectl kots install privatepackagistkots
48+
```
49+
50+
To log in to the admin console, you will need the password shown at the end of the install command. You can also always
51+
regenerate the admin console password via `sudo kubectl kots reset-password privatepackagistkots`.
52+
53+
### Replicated Configuration
54+
#### Replicated Setup
55+
56+
Login to the admin console using the password generated during the kots application installation.
57+
58+
![Login to Admin Console](/Resources/public/img/docs/self-hosted-kubernetes/console-login.png)
59+
60+
On the next screen, you can upload the supplied .yaml license key file. If you don't have the license key file yet then
61+
you can download it from https://packagist.com.
62+
63+
![Upload License](/Resources/public/img/docs/self-hosted-kubernetes/console-license.png)
64+
65+
#### Configure Private Packagist Self-Hosted
66+
The configuration screen is where you can set up the domains used for Private Packagist and the email configuration. It
67+
is also the place where you can configure if Private Packagist should use an existing Redis, PostgreSQL, or blob storage.
68+
![Configuration](/Resources/public/img/docs/self-hosted-kubernetes/console-config.png)
69+
70+
Every configuration change or application update will trigger a preflight check. Once the preflight check have passed,
71+
the changes can be applied to your Kubernetes cluster.
72+
![Preflight Check](/Resources/public/img/docs/self-hosted-kubernetes/console-preflight.png)
73+
74+
The application overview in the admin console shows you the application status, your current license information, and any
75+
available updates for Private Packagist. Once the application has entered the ready state, you can access Private Packagist
76+
via the domain configured for the web interface e.g. packagist.myintranet.com and finish the setup there.
77+
![Application Overview](/Resources/public/img/docs/self-hosted-kubernetes/console-application-overview.png)
78+
79+
### Setup authentication and Select Admin
80+
81+
#### Authentication Setup
82+
Within Private Packagist Self-Hosted, you now need to set up at least one user authentication method.
83+
You have the choice between authentication with email addresses and passwords and several OAuth integrations with third-party services.
84+
We provide integrations with on-premises versions of GitHub, Bitbucket, GitLab, or their public services on github.com, bitbucket.org,
85+
or gitlab.com. Follow the instructions to create the respective required identifiers, tokens, and secrets.
86+
87+
* [GitHub (Enterprise) Integration Setup](./github-integration-setup.md)
88+
* [Bitbucket.org Integration Setup](./bitbucket-integration-setup.md)
89+
* [Bitbucket Data Center / Server Integration Setup](./bitbucket-server-integration-setup.md)
90+
* [GitLab Integration Setup](./gitlab-integration-setup.md)
91+
* [Authentication with Email Addresses and Passwords](./authentication-email-addresses-passwords-setup.md).
92+
93+
94+
![Add Integration](/Resources/public/img/docs/self-hosted/08-integration.png)
95+
96+
#### Selecting Admins
97+
After setting up an integration, you can log in through the top menu. Register an account and pick a username.
98+
99+
![Register Admin](/Resources/public/img/docs/self-hosted/09-register-admin.png)
100+
101+
The first user is granted admin permissions automatically. You can grant admin permissions to more users in the admin panel.
102+
103+
![Add Admin](/Resources/public/img/docs/self-hosted/10-add-admin.png)
104+
105+
#### Switching to Production Mode
106+
Head back to the admin console to disable the Setup Mode in the configuration. Once the preflight checks passed, you can
107+
apply the changes.
108+
109+
That’s it! Private Packagist Self-Hosted is now ready to be used! You’ll find all further information in the web interface.
110+
111+
## Database and storage with dynamic volumes
112+
113+
Private Packagist Self-Hosted will set up PostgreSQL, Redis, and MinIO to store application data and Composer packages.
114+
Each of them requires one or more volumes using [dynamic volume provision](https://kubernetes.io/docs/concepts/storage/dynamic-provisioning/) to allocate storage for the different Pods.
115+
Configure the Storage Class under the Kubernetes Settings on the Config page in the admin console.
116+
117+
Alternatively, you can configure Private Packagist Self-Hosted to use your own PostgreSQL, Redis, and blob storage.
118+
For blob storage, we currently support Azure Blob Storage, Google Cloud Storage, AWS S3, and other S3-compatible storage solutions.
119+
120+
## Security
121+
122+
The Private Packagist Self-Hosted application expects that TLS termination happens at or before the Ingress level.
123+
All traffic within the cluster is unencrypted.
124+
125+
Make sure your Kubernetes network plugin encrypts connections between pods to avoid potential security issues.
126+
127+
## Backups
128+
129+
The Replicated admin console integrates with [Velero](https://velero.io/), a tool to back up and restore your Kubernetes
130+
cluster resources and persistent volumes. Private Packagist Self-Hosted provides annotations to help back up and restore
131+
the application with Velero.
132+
133+
If you are using your own backup solution, we recommend making regular backups of PostgreSQL, Redis, and the used blob
134+
storage.

0 commit comments

Comments
 (0)