Skip to content

Instantly share code, notes, and snippets.

View DennisAlund's full-sized avatar
💭
ngoding

Dennis Alund DennisAlund

💭
ngoding
View GitHub Profile
image: python:2.7
before_script:
- echo "deb http://packages.cloud.google.com/apt cloud-sdk-jessie main" | tee /etc/apt/sources.list.d/google-cloud-sdk.list
- curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
- apt-get update && apt-get install google-cloud-sdk
after_script:
- rm /tmp/$CI_PIPELINE_ID.json
image: node:latest
cache:
paths:
- node_modules/
- app/bower_components
deploy_production:
stage: deploy
environment: Production
@DennisAlund
DennisAlund / .gitlab-ci.yml
Last active August 20, 2018 15:16
Gitlab CI configuration for the Medium article "Deploying Django to Google App Engine with Gitlab CI" -- https://medium.com/evenbit/deploying-django-to-google-app-engine-with-gitlab-ci-541c0dc67a12
image: python:2.7
.deploy_template: &global_deploy_def
stage: deploy
before_script:
- echo "deb http://packages.cloud.google.com/apt cloud-sdk-jessie main" | tee /etc/apt/sources.list.d/google-cloud-sdk.list
- curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
- apt-get update && apt-get install google-cloud-sdk
after_script:
- source .gitlab-ci.env
{
"rules": {
"queue": {
"tasks": {
"$task_id": {
".validate": "newData.hasChildren(['apiKey', 'someValue', 'anotherValue']) && root.child('apiKeys').child(apiKey).val() != null",
"apiKey": {
".validate": "newData.isString()"
},
"someValue": {
path /messages/{message_id} is Timestamped<Message>;
type Message {
id: FirebaseId
message_hash: Immutable<MD5Hash>,
message: String,
author: FirebaseId,
create() { isSignedIn() }
type Message {
message: String,
author: FirebaseId,
create() { isSignedIn() }
read() { isSignedIn() }
update() { isCurrentUser(this.author) }
delete() { isCurrentUser(this.author) }
}
var visitsRef = firebase.database().ref('/visits');
visitsRef.on('child_added', function (snapshot) {
var visitData = snapshot.val();
var visitId = snapshot.key;
var updates = {};
updates[util.format('/meta-data/visits/%s', visitId)] = {
created: firebase.database.ServerValue.TIMESTAMP,
modified: firebase.database.ServerValue.TIMESTAMP
path /visits/{visit_id} is Visit {
read() { canManageBusiness(this.businessId) }
write() { canManageBusiness(this.businessId) }
}
path /businessVisits/{business_id}/{visit_id} is Visit {
read() { canManageBusiness(business_id) }
}
# Push the code up to the Google Cloud Repository
- git config credential.helper gcloud.sh
- git remote add google https://source.developers.google.com/p/$PROJECT_ID/r/default
- git push google --all
.deploy_gcp_template: &gcp_deploy_def
stage: gcp_deploy
before_script:
- echo "deb http://packages.cloud.google.com/apt cloud-sdk-jessie main" | tee /etc/apt/sources.list.d/google-cloud-sdk.list
- curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
- apt-get update && apt-get install -y google-cloud-sdk
after_script:
- gcloud auth activate-service-account --key-file .tmp-keyfile.json