Skip to content

Commit c69013b

Browse files
committed
Initial draft of UsingSampleStack doc
Signed-off-by: Steven Groeger <[email protected]>
1 parent 7713d57 commit c69013b

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

UsingSampleStack.md

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Using Sample Stack
2+
3+
## Using Sample Application stack
4+
5+
1. Clone or copy the "sample-stack" [git repository](https://github.com/application-stacks/sample-stack)
6+
1. Change directory to the `sample-stack` directory
7+
1. Delete the `starter` directory (which contains the starter stack)
8+
1. Create a new stack directory, within the base directory of the Git repository, to contain the stack to be published. For example:
9+
```
10+
mkdir ./my-nodejs
11+
```
12+
1. Copy or create your stack in this new directory. Look at [Developing Stacks](https://appsody.dev/docs/stacks/develop) for information on how to create a stack.
13+
1. Package and test your stack. There are 2 ways that you can package and test your stack. These are:
14+
1. Using the Appsody CLI `stack` commands, see [Packaging stacks](https://appsody.dev/docs/stacks/package)
15+
1. Using the CI scripts provided within the sample-stack repo, see [Packaging a stack using CI scripts](#Packaging-a-stack-using-CI-scripts)
16+
> If using Travis CI within your git repository, it may be preferable to use the CI scripts as they are used when you push your stack to your git repository.
17+
1. Once you have developed, packaged and tested your stack you then push your repository to your GitHub organization. i.e. `https://github.com/myorg/my-nodejs`
18+
19+
## Packaging a stack using CI scripts
20+
21+
1. Use environment variables to override default settings that are used by the build script, for example the namespace to use for the Docker images, and the URL to use to reference the template archive files. The main variables to override are:
22+
23+
- `IMAGE_REGISTRY_ORG` this is the namespace to create the Docker images with.
24+
- `RELEASE_URL` this is the base URL to your web hosting service, and is used to reference the template archive files from within the repository index file.
25+
26+
You can set these environment variables by exporting them. For example:
27+
28+
```
29+
export IMAGE_REGISTRY_ORG=myproject
30+
export RELEASE_URL=https://github.com/myorg/my-nodejs/releases/latest/download
31+
```
32+
1. Run the build script from the base directory of the git repository. For example:
33+
```
34+
./ci/build.sh
35+
```
36+
This command creates the following artefacts in the `./ci/assets` directory:
37+
* stack index file (containing remote URLs)
38+
* template archive files
39+
* stack source file
40+
41+
and in the local docker registry:
42+
* stack container images
43+
44+
## Configure Git repository to use Travis to build stack
45+
46+
To configure your git repository to use Travis CI follow the "Get started with Travis using Github" [instructions](https://docs.travis-ci.com/user/tutorial/#to-get-started-with-travis-ci-using-github)
47+
48+
The "sample-stack" [git repository](https://github.com/application-stacks/sample-stack) contains the files that provide support for building and releasing of the stack. These file are:
49+
50+
* ./ci/* : the CI scripts that will perform the build and the release of the stack
51+
* ./travis.yml : the travis configuration file
52+
53+
Similar to when running the CI scripts locally, there are environment variables that need to be setup within your Travis environment. Use the "Defining Variables in Repository Setting" [Travis documentation](https://docs.travis-ci.com/user/environment-variables/#defining-variables-in-repository-settings) to define environment variables.
54+
55+
The environment variables you will need to override are:
56+
57+
- `IMAGE_REGISTRY_ORG` this is the namespace to create the Docker images with.
58+
- `RELEASE_URL` this is the base URL to your web hosting service, and is used to reference the template archive files from within the repository index file.
59+
- `CODEWIND_INDEX` this specifies whether to build the indexfile for use with Codewind. Default=false.
60+
- `GITHUB_TOKEN` this is a user access token to allow access to your Github org.
61+
- `IMAGE_REGISTRY_USERNAME` this is the username that will be used to logon to your docker registry when publishing the docker images.
62+
- `IMAGE_REGISTRY_PASSWORD` this is the password that will be used to logon to your docker registry when publishing the docker images.

0 commit comments

Comments
 (0)