Skip to content
This repository was archived by the owner on Mar 29, 2023. It is now read-only.

Commit f8ca7e8

Browse files
committed
Break up the sync gateway config and fix install-sync-gateway for AL
1 parent 05d4488 commit f8ca7e8

File tree

4 files changed

+35
-6
lines changed

4 files changed

+35
-6
lines changed

examples/couchbase-ami/couchbase.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
"destination": "/tmp/terraform-aws-couchbase/modules"
142142
},{
143143
"type": "file",
144-
"source": "{{template_dir}}/sync_gateway.json",
144+
"source": "{{template_dir}}/sync_gateway_{{user `edition`}}.json",
145145
"destination": "/tmp/terraform-aws-couchbase/sync_gateway.json"
146146
},{
147147
"type": "shell",
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"adminInterface": "<ADMIN_INTERFACE>",
3+
"interface": "<INTERFACE>",
4+
"databases": {
5+
"<DB_NAME>": {
6+
"server": "<SERVERS>",
7+
"username": "<DB_USERNAME>",
8+
"password": "<DB_PASSWORD>",
9+
"bucket": "<BUCKET_NAME>",
10+
"users": {"GUEST": {"disabled": false, "admin_channels": ["*"]}}
11+
}
12+
},
13+
"logging": {
14+
"default": {
15+
"logFilePath": "/home/sync_gateway/logs/sync-gateway.log",
16+
"logKeys": ["*"],
17+
"logLevel": "info",
18+
"rotation": {
19+
"maxsize": 100,
20+
"maxage": 30,
21+
"maxbackups": 5,
22+
"localtime": true
23+
}
24+
}
25+
}
26+
}

modules/install-sync-gateway/install-sync-gateway

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,17 @@ function install_sync_gateway_on_amazon_linux {
113113
log_info "Installing SyncGateway from $filepath"
114114
sudo rpm --install "$filepath"
115115

116-
# These commands sometimes exit with an error for no obvious reason, so we just ignore the error...
116+
# These commands sometimes fail and exit with an error for no obvious reason. Moreover, it appears that the
117+
# sync_gateway process can't be stopped cleanly using service, so we subsequently use pkill.
117118
set +e
118119
sudo chkconfig sync_gateway off
119120
sudo service sync_gateway stop
121+
sudo pkill sync_gateway
120122
set -e
121123

122-
# Remove the original log paths to reduce confusion
123-
sudo rm -rf /var/log/sync_gateway
124-
125124
# Create systemd unit to run Sync Gateway. The installer creates an init.d script, but that doesn't work correctly
126-
# in Docker, and it doesn't auto-restart Sync Gateway if it crashes, so this is a more effective option.
125+
# in Docker, and it doesn't auto-restart Sync Gateway if it crashes, so this is a more
126+
# effective option.
127127
log_info "Creating systemd unit for Sync Gateway in $DEFAULT_SYNC_GATEWAY_SYSTEMD_UNIT_PATH."
128128
sudo tee "$DEFAULT_SYNC_GATEWAY_SYSTEMD_UNIT_PATH" > /dev/null << EOF
129129
[Unit]
@@ -155,6 +155,9 @@ TimeoutSec=60
155155
WantedBy=multi-user.target
156156
EOF
157157

158+
# Remove the original log paths to reduce confusion
159+
sudo rm -rf /var/log/sync_gateway
160+
158161
log_info "Cleaning up $filepath"
159162
rm -f "$filepath"
160163
}

0 commit comments

Comments
 (0)