Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.goat
docker
slotsapp
templates
web
.dockerignore
.gitignore
Dockerfile
Readme.md
authors.txt
license.txt
main.go

Readme.md

WebSlots

Go Report Card GoDoc

It is simple app to expose scripts and actions by internet. It is used to run build CI/CD process.

Install required scripts

  • Use dep to load dependency.
  • Use goatcli to scaffolding code and mutate modules.
go get -u github.com/golang/dep/cmd/dep
go get -u github.com/goatcms/goatcli

Build app

cd $GOPATH/src/github.com/goatcms
git clone https://github.com/goatcms/webslots.git
cd webslots
goatcli build
dep ensure

Run

You can run the application by simple webslots command like:

webslots run --loglvl=dev

Docker

We make it to work with docker CI better.

Build & Run

Dockerfile for the project is in main directory of the git repository. To build it run

docker build . -t "goatcms/webslots"

and run by

docker run -it --rm -p 1333:1333 goatcms/webslots

Extend the image

To build own build system or other web action system extend the image. It make your build system:

  • versionable
  • simple to reproduce
  • well documented
  • system dependency safe
FROM goatcms/webslots

# add some dependency
RUN \
  git clone https://github.com/nodejs/node.git node && \
  cd node && \
  git checkout v8.3.0 && \
  ./configure && make && make install \
  cd .. \
  rm -rf node

# Add config
COPY slots /go/src/github.com/goatcms/webslots/config/
COPY tasks /go/src/github.com/goatcms/webslots/config/

# entrypoint
ENTRYPOINT ["/go/src/github.com/goatcms/webslots/docker/entrypoint.sh"]
CMD []

Full exmple: beerpoly-ci

Add config by environment

Add application settings by environments.

  • APP_BASE_URL - application base url (like ci.mywebsite.com)
  • OAUTH_GITHUB_APP - your authentication github app
  • OAUTH_GITHUB_SECRET - your authentication github password
version: '3.4'

services:
  WebSlots:
    image: goatcms/webslots
    environment:
      - "APP_BASE_URL=http://ci.mysite.com/"
      - "OAUTH_GITHUB_APP=Insert_you_app_id"
      - "OAUTH_GITHUB_SECRET=Insert_you_app_secret"

Add secrets by environment

You can add slot secrets by environments. Create env like "SLOT_[task name]SECRET[counter]" to add a user.

version: '3.4'

services:
  WebSlots:
    image: goatcms/webslots
    environment:
      TZ: 'Europe/Berlin'
    restart: unless-stopped
    environment:
      - "SLOT_buildBeerpoly_SECRET_1=git:CHANGE_IT_056f32ee5cf49404607e368bd8d3f2af"
      - "SLOT_buildBeerpoly_SECRET_2=bitbucket:CHANGE_IT_4124bc0a9335c27f086f24ba207a4912"
      - "SLOT_buildBeerpoly_SECRET_3=tom:CHANGE_IT_92eb5ffee6ae2fec3ad71c777531578f"
    ports:
      - 1333:1333

Add users by environment

You can create a users by environments. The users can be authentication by password, github oauth or both. In the example we create two users. Firs one is "tsmith" user authenticated by password "123". Second one is "sebastianpozoga" user authenticated by github account.

version: '3.4'

services:
  WebSlots:
    image: goatcms/webslots
    environment:
      - "USER_1_USERNAME=tsmith"
      - "USER_1_FIRSTNAME=Tom"
      - "USER_1_LASTNAME=Smith"
      - "USER_2_ROLES=somerole1&somerole2&somerole3"
      - "USER_1_EMAIL=tom.smith@email.com"
      - "USER_1_PASSWORD=123"

      - "USER_2_USERNAME=sebastianpozoga"
      - "USER_2_FIRSTNAME=Sebastian"
      - "USER_2_LASTNAME=Pozoga"
      - "USER_2_ROLES=superadmin"
      - "USER_2_EMAIL=sebastian@pozoga.eu"
      - "USER_2_CONNECT_GITHUB=sebastian@pozoga.eu"
    ports:
      - 1333:1333

Ports

Recomended port for CI/CD applications is 1333. It is a coronation day of Casimir III the Great.

Casimir III the Great reigned as the King of Poland from 1333 to 1370. He was the son of King Władysław I and Duchess Jadwiga of Kalisz, and the last Polish king from the Piast dynasty.
"When he ascended Poland was wooden, when he left us, it was from stone"

More about Casimir III the Great

Port Description
1333 Default and recomended port for Webslots apps.

Example docker-compose

version: '3.4'

services:
  webslots:
    image: goatcms/webslots:prod
    restart: always
    environment:
      - "TZ=Europe/Warsaw"
      # You can use HTTPS (prefer) or HTTP (unsafe) mode
      - "MODE=HTTP"
      - "DOMAIN=yourdomain.com"
      # ANON_ROLES contains roles for anonymous users
      #  - history - list all tasks
      #  - history:name - list task by name
      #  - run - run all tasks
      #  - run:name - run task by name
      #  - logs - can show logs for all tasks
      #  - logs:name - can show logs for task by name
      #  - summary - can show summary for all tasks
      #  - summary:name - can show summary for task by name

      - "ANON_ROLES=history run logs summary"

      # app config
      - "APP_HOST=yourdomain.com"
      - "APP_BASE_URL=http://yourdomain.com:1333"

      # gotcms slots
      # - "SLOT_SLOTNAME1_SECRET_1=FIRST_SECRET_VALUE_FOR_SLOT_1"
      # - "SLOT_SLOTNAME1_SECRET_2=SECOND_SECRET_VALUE_FOR_SLOT_1"
      # - "SLOT_SLOTNAME2_SECRET_1=FIRST_SECRET_VALUE_FOR_SLOT_2"

      # users
      - "USER_1_USERNAME=YOUR_USERNAME"
      - "USER_1_FIRSTNAME=YOUR_FIRSTANME"
      - "USER_1_LASTNAME=YOUR_LASTNAME"
      - "USER_1_EMAIL=your@email.com"
      - "USER_1_ROLES=superadmin&admin&otherroles"
      - "USER_1_CONNECT_GITHUB=YOUR_GITHUB_LOGIN_TO_CONNECT"
    volumes:
      - "/yourada/data:/data"
      - "/yourada/ssh:/root/.ssh"
    expose:
      - 80
      - 443
    ports:
      - 443:443
      - 80:80

Links

You can’t perform that action at this time.