├── README.md ├── devops.yml ├── logo.png ├── nodes └── meteor.yml └── tasks ├── backup-meteor.yml └── build-meteor.yml /README.md: -------------------------------------------------------------------------------- 1 | # Meteor stack 2 | 3 | Build and deploy [Meteor](http://docs.meteor.com/) based apps. 4 | 5 | ## Install 6 | 7 | Simply use the link below: 8 | 9 | [![Fork on devo.ps](https://app.devo.ps/assets/images/fork.png)](https://app.devo.ps/#/fork?git_url=https://github.com/devops-community/meteor.git) 10 | 11 | Once you've forked the repository, open it in devo.ps and you will be prompted for a few settings, including the Git URL for the code of your application, the names of your application and database. 12 | 13 | To deploy your app, you will need to navigate to the tasks page of the repo and run the task manually (click on "play" icon, right of the "Build Meteor app" task). 14 | 15 | ## What's in the box? 16 | 17 | This setup contains one server (`nodes/meteor.yml`) with **Node.js**, **Meteor**, **MongoDB** and **Nginx** 18 | 19 | We have included as well a task (`tasks/meteor-build.yml`) that can be executed and will deploy your Meteor app. 20 | 21 | The current repo provides a very simple setup. Hack at will! 22 | 23 | Feel free to extend the task and add the support for webhooks to install any kind of Meteor app! Checkout the [gh-pages builder](https://github.com/devops-community/gh-pages) for some examples. 24 | 25 | ## Questions? 26 | 27 | If you have any question, come ask us on the [devo.ps chat](https://www.hipchat.com/gyHEHtsXZ) or shoot us an email at [help@devo.ps](mailto:help@devo.ps) (though, you should really just [ask us in the chat](https://www.hipchat.com/gyHEHtsXZ)). 28 | 29 | # Reference 30 | 31 | - [Nodes in devo.ps](http://docs.devo.ps/manual/nodes) 32 | - [Tasks in devo.ps](http://docs.devo.ps/manual/tasks) 33 | -------------------------------------------------------------------------------- /devops.yml: -------------------------------------------------------------------------------- 1 | name: Meteor 2 | description: A boilerplate setup to deploy your Meteor app (Nginx, MongoDB, Node.js and Meteor). 3 | image: https://raw.githubusercontent.com/devops-community/meteor/master/logo.png 4 | vars: 5 | provider.name: 6 | label: Cloud provider 7 | default: digitalocean 8 | description: The id of the provider you want to use, see http://docs.devo.ps/manual/nodes/#format 9 | provider.size: 10 | label: Server size 11 | default: 66 12 | description: Size of the server you will deploy your app on, see http://docs.devo.ps/providers/digitalocean/ 13 | domain: 14 | label: Domain name 15 | default: example.com 16 | description: Domain name for your Meteor Application 17 | app_name: 18 | label: Application name 19 | default: telescope 20 | description: Name of your Meteor Application 21 | git_url: 22 | label: App Git URL 23 | default: https://github.com/TelescopeJS/Telescope.git 24 | description: The Git URL of the app you want to deploy 25 | database_name: 26 | label: Database name 27 | default: telescope 28 | description: Name of the database used to store the data of your Meteor app 29 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devops-community/meteor/855e3aab9289c0195c50add0a6e84a555d2641b5/logo.png -------------------------------------------------------------------------------- /nodes/meteor.yml: -------------------------------------------------------------------------------- 1 | # Find out more about nodes: http://docs.devo.ps/manual/nodes 2 | 3 | id: meteor 4 | name: Meteor node 5 | type: server 6 | 7 | # Define the provider details - both location and image are optional 8 | # Refer to the documentation to know more about the defaults 9 | provider: 10 | name: "{{ provider.name }}" 11 | size: "{{ provider.size }}" 12 | # location: 13 | # image: 14 | 15 | services: 16 | backup: '*' 17 | nginx: '*' 18 | mongodb: '*' 19 | nodejs: '*' 20 | meteor: '*' 21 | 22 | configuration: 23 | # backup: 24 | # # Define local cron to run the backup 25 | # schedules: 26 | # - '0 3 * * *' 27 | # # And save the archive in a "daily" folder 28 | # path: '/opt/backup/%Y/%m/%d/daily' 29 | 30 | mongodb: 31 | # Define your MySQL users 32 | users: 33 | - name: meteor 34 | databases: 35 | - "{{ database_name }}" 36 | 37 | nginx: 38 | vhosts: 39 | - id: "{{ app_name }}" 40 | domain: "{{ domain }}" 41 | routes: 42 | - uri: '/' 43 | type: proxy 44 | to: http://localhost:3000 45 | - uri: '/sockjs' 46 | type: websocket 47 | to: http://localhost:3000 48 | -------------------------------------------------------------------------------- /tasks/backup-meteor.yml: -------------------------------------------------------------------------------- 1 | # Find out more about tasks: http://docs.devo.ps/manual/tasks 2 | 3 | id: backup-meteor 4 | name: Backup Meteor 5 | type: task 6 | 7 | targets: 8 | - meteor 9 | 10 | triggers: 11 | crons: 12 | # At 4am every day 13 | - '0 4 * * *' 14 | webhooks: 15 | - path: backup/meteor 16 | 17 | steps: 18 | # Backup the MongoDB meteor database and workdir 19 | - run: devops backup run 20 | options: 21 | path: '/opt/backup/%Y/%m/%d/%H-%M/meteor' 22 | files: 23 | - '/opt/{{ app_name }}' 24 | mongodb_dbs: 25 | - '{{ database_name }}' 26 | 27 | # All the backups are available in /opt/backup/YYYY/MM/DD/HH-MM/meteor 28 | -------------------------------------------------------------------------------- /tasks/build-meteor.yml: -------------------------------------------------------------------------------- 1 | # Find out more about tasks: http://docs.devo.ps/manual/tasks 2 | 3 | id: build-meteor 4 | name: Build Meteor app 5 | type: task 6 | 7 | vars: 8 | app_src: meteor_app_src 9 | 10 | targets: 11 | - meteor 12 | 13 | # Uncomment the following to add a deploy webhook; you may want to obfuscate the URL as this is public 14 | triggers: 15 | # webhooks: 16 | # - path: deploy 17 | events: 18 | - node.meteor.create.success 19 | 20 | steps: 21 | # Fetch/update the code from the git repo 22 | - run: devops git update 23 | options: 24 | repo: "{{ git_url }}" 25 | dest: /tmp/{{ app_src }} 26 | 27 | # Let's prepare the build destination 28 | - run: > 29 | sudo mkdir -p /opt/{{ app_name }} && 30 | sudo chown -R devops. /opt/{{ app_name }} 31 | 32 | # Let's build the meteor app and deploy to its final location 33 | - run: > 34 | cd /tmp/{{ app_src }} && 35 | meteor build /opt/{{ app_name }} --directory && 36 | cd /opt/{{ app_name }}/bundle/programs/server && 37 | npm install 38 | 39 | # Prepare the app 40 | - run: devops nodejs app add 41 | options: 42 | name: "{{ app_name }}" 43 | root: /opt/{{ app_name }}/bundle 44 | script: main.js 45 | node_env: prod 46 | user: devops 47 | extra_env: > 48 | PORT=3000 49 | MONGO_URL=mongodb://meteor:{{ nodes.meteor.configuration.mongodb.users.meteor.password }}@localhost:27017/{{ database_name }} 50 | ROOT_URL=http://{{ domain }} 51 | --------------------------------------------------------------------------------