Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
TomFern committed Aug 8, 2019
1 parent 81e3428 commit 741715b
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 4 deletions.
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2019 Rendered Text

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 changes: 33 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,42 @@
# Semaphore demo CI/CD pipeline using Node.js

Example application and CI/CD pipeline showing how to run a JavaScript project
on Semaphore 2.0. Project consists of a Node.js server based on Nest.js.
The code is written in TypeScript.
Example application and CI/CD pipeline showing how to run a Node.js project
on Semaphore 2.0.

The application is based on Nest.js. The code is written in TypeScript.

## CI/CD on Semaphore

Fork this repository and use it to
1. Fork this repository and use it to
[create a project](https://docs.semaphoreci.com/article/63-your-first-project).
2. Create a project on Google Cloud: `semaphore-demo-nodejs-k8s`
3. Create Kubernetes cluster on Google Cloud: `semaphore-demo-nodejs-k8s-server`
4. Create PostgreSQL db on Google Cloud.
5. Create database `demo` and user `demouser`.
6. Copy environment files and edit db hostname and db password:
```bash
$ cp ormconfig.sample.json /tmp/ormconfig.production.json
$ cp sample.env /tmp/production.env
```
7. Upload environment files as a secret:

```bash
$ sem create secret production-env \
-f /tmp/ormconfig.production.json:/home/semaphore/ormconfig.production.json \
-f /tmp/production.env:/home/semaphore/production.env
```

8. Create Service Account in IAM:
- Role: project owner
- Create and download access key JSON file.
9. Upload Access Key to Semaphore as a secret:
```bash
$ sem create secret gcr-secret \
-e GCP_PROJECT_ID=semaphore-demo-nodejs-k8s \
-e GCP_PROJECT_DEFAULT_ZONE=YOUR_REGION_AND_ZONE \
-f PATH_TO_YOUR_ACCESS_KEY_FILE.json:/home/semaphore/.secrets.gcp.json
```
10. Push changes to get workflow started.

The CI pipeline will look like this:

Expand Down
8 changes: 8 additions & 0 deletions development.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
NODE_ENV=development
PORT=3001
DATABASE_TYPE=postgres
DATABASE_HOST=localhost
DATABASE_USER=demouser
DATABASE_PASSWORD=qwerty
DATABASE_DBNAME=demo
DATABASE_PORT=5432

0 comments on commit 741715b

Please sign in to comment.