Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move gogs admin user creation into its own errand #21

Merged
merged 2 commits into from
Jan 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,12 @@ bosh -d gogs deploy gogs-boshrelease/manifests/gogs.yml \
open https://gogs.v3.pcfdev.io/user/sign_up
```

Note: `--vars-store creds.yml` is not required if your BOSH environment is configured with Credhub.
Note: `--vars-store creds.yml` is not required if your BOSH environment is configured with Credhub.

## Post Deploy Errand
To create an admin user after deploying GOGS, run the following errand.

This was moved from the `gogs_ctl` script to this errand as it was never executed previously
```
bosh -d gogs run-errand gogs-admin
```
Empty file added jobs/gogs-admin/monit
Empty file.
17 changes: 17 additions & 0 deletions jobs/gogs-admin/spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: gogs-admin

templates:
run.sh.erb: bin/run

packages: []

properties:
gogs.admin:
description: "Admin user for gogs"
default: 'gogs'
gogs.password:
description: "Password for admin user"
gogs.email:
description: "Email for admin account"
default: 'admin@example.com'
12 changes: 12 additions & 0 deletions jobs/gogs-admin/templates/run.sh.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

export PACKAGE_DIR=/var/vcap/packages/gogs
export STORE_DIR=/var/vcap/store/gogs

# Create admin user for the initial
su - git -c "${PACKAGE_DIR}/gogs admin create-user \
--name <%= p('gogs.admin') %> \
--password <%= p('gogs.password') %> \
--email <%= p('gogs.email') %> \
--admin \
--config ${STORE_DIR}/config/app.ini"
8 changes: 0 additions & 8 deletions jobs/gogs/spec
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ properties:
gogs.start_ssh_server:
description: "Start SSH Server"
default: "true"
gogs.admin:
description: "Admin user for gogs"
default: 'gogs'
gogs.password:
description: "Password for admin user"
gogs.email:
description: "Email for admin account"
default: 'admin@example.com'
gogs.secret_key:
description: "Global secret key for your server security"
gogs.tls_cert:
Expand Down
8 changes: 0 additions & 8 deletions jobs/gogs/templates/bin/gogs_ctl
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ case $1 in
>>$LOG_DIR/$JOB_NAME.stdout.log \
2>>$LOG_DIR/$JOB_NAME.stderr.log

# Create admin user for the initial
su git -c "${PACKAGE_DIR}/gogs admin create-user \
--name <%= p('gogs.admin') %> \
--password <%= p('gogs.password') %> \
--email <%= p('gogs.email') %> \
--admin \
--config ${STORE_DIR}/config/app.ini"

;;

stop)
Expand Down
2 changes: 2 additions & 0 deletions manifests/gogs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ instance_groups:
release: gogs
- name: gogs
release: gogs
- name: gogs-admin
release: gogs
- name: sanity-test
azs: [z1]
instances: 1
Expand Down