Coder Social home page Coder Social logo

martinmicunda / ionic-photo-gallery Goto Github PK

View Code? Open in Web Editor NEW
175.0 24.0 76.0 3.53 MB

A hybrid app with authentication that allows registered users view a gallery of photos they have uploaded via the camera phone.

License: MIT License

JavaScript 78.86% CSS 5.89% Shell 0.73% HTML 14.51%

ionic-photo-gallery's Introduction

Ionic Photo Gallery

Deploy

A hybrid app with authentication that allows registered users view a gallery of photos they have uploaded via the camera phone. The blog post I have written about this project can be found on my blog.

Ionic Photo Gallery Screenshots I Ionic Photo Gallery Screenshots II

Table of Contents

Technologies Used

Mobile Side Server Side DevOps
Angular.js Angularjs Node.js Gulp Gulp   Bower ![Bower] (https://avatars3.githubusercontent.com/u/3709251?s=30)
Ionic MongoDB ![MongoDB] (https://avatars3.githubusercontent.com/u/45120?v=2&s=30) NPM ![NPM] (https://avatars0.githubusercontent.com/u/6078720?s=30)   Ansible ![Ansible] (https://avatars3.githubusercontent.com/u/1507452?v=2&s=30)
Material Design Angularjs Express.js Vagrant
Cordova Redis

Architecture Diagram

Development

Ionic Photo Gallery Development Architecture Diagram

Installation & Configuration

Platform & Tools

You need to have installed follow tools on your machine:

Installation

1. Clone main repository:

$ git clone https://github.com/martinmicunda/ionic-photo-gallery.git
$ cd ionic-photo-gallery

2. The following command would add a new ubuntu trusty64 box, and if an existing one is found, it will override it:

$ vagrant box add ubuntu/trusty64 --force

NOTE: This process may take a while, as most Vagrant boxes will be at least 200 MB big.

Verify that box was installed by running the list subcommand that will list the boxes installed within Vagrant along with the provider that backs the box:

$ vagrant box list
ubuntu/trusty64  (virtualbox, 14.04)

3. The following command would install an ansible roles for this project, and if an existing one is found, it will override it:

$ bash bin/ansible-install-roles.sh

Verify that ansible roles were installed by running the list subcommand that will list the installed roles:

$ ansible-galaxy list
- DavidWittman.redis, 1.0.3
- laggyluke.direnv, v2.6.0
- martinmicunda.common, v1.0.1
- martinmicunda.ionic, v1.0.0
- martinmicunda.nodejs, v1.0.1
- nickp666.android-sdk, v0.0.1
- Stouts.mongodb, 2.1.8
- williamyeh.oracle-java, master

4. Now, run vagrant up that will create and provisioning default VM box.

$ vagrant up

NOTE: Vagrant will provision the virtual machine only once on the first run, any subsequent provisioning must be executed with the --provision flag either vagrant up --provision or vagrant reload --provision or vagrant provision if vagrant box is already running. The provisioning will re-run also if you destroy the VM and rebuild it with vagrant destroy and vagrant up .

If there have been no errors when executing the above commands, the machines default should be created. The following command would outputs status of the vagrant machine:

$ vagrant status
Current machine states:
default                   running (virtualbox)

Now you should be able to ssh into box:

$ vagrant ssh 

Running App

Server

1. To start the server you need to ssh into box:

$ vagrant ssh

2. Install the server dependencies:

$ cd server
$ npm install

3. Start the server:

$ npm start

NOTE: The direnv is use as an environment variable manager so when you first time cd into server directory with a .envrc file in it, it will refuse to load the file. This is to protect you, since the contents of the .envrc will be executed by your shell, and they might come from untrusted sources. Simply run direnv allow, and it will trust that file until the next time it changes.

Ionic

1. To start the server you need to ssh into box:

$ vagrant ssh

2. Install the ionic dependencies:

$ cd ionic
$ npm install

3. Start the ionic:

$ npm start

Open up your browser and navigate to http://127.0.0.1:8100 and you should see ionic app up and running.

Building for iOS

1. ssh into box:

$ vagrant ssh

2. Add support for the iOS platform:

$ cd ionic
$ ionic platform add ios

3. Build the project:

$ ionic build ios

4. Open ionic-photo-gallery.xcodeproj in the ionic-photo-gallery/ionic/platforms/ios folder.

5. In Xcode, run the application on a device connected to your computer or in the iOS emulator.

Building for Android

1. ssh into box:

$ vagrant ssh

2. Add support for the Android platform:

$ cd ionic
$ ionic platform add android

3. Build the project:

$ ionic build android

NOTE: (martin) work in progress!!

  1. Start Genymotion
  2. Open Genymotion Shell
  3. Run follow command to get IP address
$ devices list

you should see something like this:

Genymotion virtual device 0 is off. Please select a new virtual device with command : devices select
Available devices:

 Id | Select |    Status     |   Type   |   IP Address    |      Name
----+--------+---------------+----------+-----------------+---------------
  0 |        |            On |  virtual |  192.168.58.101 | Samsung Galaxy S4 - 4.4.4 - API 19 - 1080x1920
  1. Go to vagrant box using 'vagrant up' and 'vagrant ssh'.
  2. Type: adb connect 192.168.56.101 and adb devices. You should see something like this:
vagrant@vagrant-ubuntu-trusty-64:~$ adb connect 192.168.58.101
connected to 192.168.58.101:5555
vagrant@vagrant-ubuntu-trusty-64:~$ adb devices
List of devices attached
192.168.58.101:5555     device
  1. Run ionic run android

Vagrant

There’s a ton of commands you can use to talk to Vagrant. For a full list see the official docs, but here are the more common ones.

  • vagrant up - use this command to start your virtual environment
  • vagrant halt - use this command to stop your virtual environment
  • vagrant suspend - use this command to pause your virtual environment, make sure you do this before shutting down your computer to safely be able to restore the environment later.
  • vagrant destroy - use this command to removes your virtual environment from your machine
  • vagrant reload - use this command to your virtual environment, if you add the --provision flag, it will reprovision the box as well; this is useful with removing or adding things to the server via Ansible.
  • vagrant ssh - use this command to connect to the virtual server

Ansible

To get better understanding how Ansible works check the official docs. Ansible installs the following software:

The mongodb and redis services are started after provisioning takes place.

FAQ

What if I want to uninstall application?

1. The following command would permanently removes the default virtual box from your machine:

$ vagrant destroy

2. The following command would uninstall an ansible roles for this project:

$ bash bin/ansible-uninstall-roles.sh

4. The following command would remove trusty64 box:

$ vagrant box remove trusty64

What if I want a fresh install?

If you wish to destroy the default virtual boxe to make sure you have a fresh start, you can do these steps:

 $ vagrant destroy 
 $ vagrant up

License

The MIT License

Copyright (c) 2015 Martin Micunda  

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

ionic-photo-gallery's People

Contributors

bryant1410 avatar estribiyo avatar martinmicunda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ionic-photo-gallery's Issues

Image upload

Where is the client code to upload image to server? Thanks

Ionic not working?

Hi, i cannot acces ionic front end while pointing browser at http://localhost:8100
Server side seems to work though .
I tried this :
curl -v http://localhost:8100

  • Rebuilt URL to: http://localhost:8100/
  • Hostname was NOT found in DNS cache
  • Trying ::1...
  • connect to ::1 port 8100 failed: Connection refused
  • Trying 127.0.0.1...
  • Connected to localhost (127.0.0.1) port 8100 (#0)

    GET / HTTP/1.1
    User-Agent: curl/7.37.1
    Host: localhost:8100
    Accept: /

  • Empty reply from server
  • Connection #0 to host localhost left intact
    curl: (52) Empty reply from server

Any Idea?

nickp666.android-sdk

Hello. First of all, congratulations for your work.
When I try to run vagrant up --provision. I get:
TASK [nickp666.android-sdk : Put the SDK install expect script in place] *******
fatal: [default]: FAILED! => {"changed": false, "failed": true, "msg": "AnsibleError: Unexpected templating type error occurred on (#!/usr/bin/expect\n\nset timeout -1;\nspawn {{ android_executable }} update sdk --all -u -t "{{ (android_sdk_tools_to_install + android_sdks_to_install) | join(',') }}";\nexpect {\n "Do you accept the license" { exp_send "y\r" ; exp_continue }\n eof\n}\n): can only concatenate list (not "AnsibleUnicode") to list"}

android build - warnings

Hi,
I try to build android version of your aplication and I have some warning. I thought that you may want to see this.

vagrant@vagrant-ubuntu-trusty-64:~/ionic-photo-gallery/ionic$ ionic platform add android

Upgrade warning - for the CLI to run correctly,
it is highly suggested to upgrade the following:

Please update your Node runtime to version >=0.12.x

Updated the hooks directory to have execute permissions
Running command: /home/vagrant/ionic-photo-> gallery/ionic/hooks/before_platform_add/init_directories.js /home/vagrant/ionic-photo-gallery/ionic
npm http GET https://registry.npmjs.org/cordova-android
npm http 200 https://registry.npmjs.org/cordova-android
npm http GET https://registry.npmjs.org/cordova-android
npm http 200 https://registry.npmjs.org/cordova-android
npm http GET https://registry.npmjs.org/cordova-android/-/cordova-android-4.0.2.tgz
npm http 200 https://registry.npmjs.org/cordova-android/-/cordova-android-4.0.2.tgz
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.martinmicunda.photo_gallery
Name: ionic-photo-gallery
Activity: MainActivity
Android target: android-22
Copying template files...
Android project created with [email protected]
Running command: /home/vagrant/ionic-photo-> gallery/ionic/hooks/after_prepare/010_add_platform_class.js /home/vagrant/ionic-photo-gallery/ionic
add to body class: platform-android
Running command: /home/vagrant/ionic-photo-> gallery/ionic/hooks/after_prepare/020_remove_sass_from_platforms.js /home/vagrant/ionic-photo-> gallery/ionic
Running command: /home/vagrant/ionic-photo-gallery/ionic/hooks/after_platform_add/010_install_plugins.js /home/vagrant/ionic-photo-gallery/ionic
WARNING: org.apache.cordova.dialogs has been renamed to cordova-plugin-dialogs. You may not be getting the latest version! We suggest you cordova plugin rm org.apache.cordova.dialogs and cordova plugin add cordova-plugin-dialogs.
Fetching plugin "org.apache.cordova.dialogs" via npm
Fetching from npm failed: 404 Not Found: org.apache.cordova.dialogs

WARNING: org.apache.cordova.vibration has been renamed to cordova-plugin-vibration. You may not be getting the latest version! We suggest you cordova plugin rm org.apache.cordova.vibration and cordova plugin add cordova-plugin-vibration.
Fetching plugin "org.apache.cordova.vibration" via cordova plugins registry
Installing "org.apache.cordova.vibration" for android
Running command: /home/vagrant/ionic-photo-gallery/ionic/hooks/after_plugin_add/010_register_plugin.js /home/vagrant/ionic-photo-gallery/ionic

WARNING: org.apache.cordova.camera has been renamed to cordova-plugin-camera. You may not be getting the latest version! We suggest you cordova plugin rm org.apache.cordova.camera and cordova plugin add cordova-plugin-camera.
Fetching plugin "org.apache.cordova.camera" via cordova plugins registry
Installing "org.apache.cordova.camera" for android
Running command: /home/vagrant/ionic-photo-gallery/ionic/hooks/after_plugin_add/010_register_plugin.js /home/vagrant/ionic-photo-gallery/ionic

WARNING: org.apache.cordova.file-transfer has been renamed to cordova-plugin-file-transfer. You may not be getting the latest version! We suggest you cordova plugin rm org.apache.cordova.file-transfer and cordova plugin add cordova-plugin-file-transfer.
Fetching plugin "org.apache.cordova.file-transfer" via cordova plugins registry
Installing "org.apache.cordova.file-transfer" for android
WARNING: org.apache.cordova.file has been renamed to cordova-plugin-file. You may not be getting the latest version! We suggest you cordova plugin rm org.apache.cordova.file and cordova plugin add cordova-plugin-file.
Fetching plugin "org.apache.cordova.file" via cordova plugins registry
Installing "org.apache.cordova.file" for android
Running command: /home/vagrant/ionic-photo-gallery/ionic/hooks/after_plugin_add/010_register_plugin.js /home/vagrant/ionic-photo-gallery/ionic

Saving platform to package.json file

ionic serve -s -c --lab Error

Hello. First at all, congratulations for your work.

When I try to run npm start into ionic folder I get:

[email protected] start /home/vagrant/ionic-photo-gallery/ionic
ionic serve -s -c --lab
sh: 1: ionic: not found
npm ERR! [email protected] start: ionic serve -s -c --lab
npm ERR! Exit status 127
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is most likely a problem with the ionic-photo-gallery-ionic package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ionic serve -s -c --lab
npm ERR! You can get their info via:
npm ERR! npm owner ls ionic-photo-gallery-ionic
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.13.0-55-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "start"
npm ERR! cwd /home/vagrant/ionic-photo-gallery/ionic
npm ERR! node -v v0.10.40
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/vagrant/ionic-photo-gallery/ionic/npm-debug.log
npm ERR! not ok code 0

npm start error

I was success -> server/ -> npm start
image

but ionic/ -> "npm start " occured below error

npm start

[email protected] start /home/vagrant/ionic-photo-gallery/ionic
ionic serve -s -c --lab

sh: 1: ionic: not found
npm ERR! weird error 127
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! not ok code 0

How can I fix it ?

I tried copy node_modules from server/

and bellow command
$ sudo npm install -g ionic

##############
below this npm-debug-log file

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'start', 'debug' ]
2 info using [email protected]
3 info using [email protected]
4 error Error: ENOENT, open '/home/vagrant/ionic-photo-gallery/ionic/node_modules/debug/package.json'
5 error If you need help, you may report this log at:
5 error http://github.com/isaacs/npm/issues
5 error or email it to:
5 error [email protected]
6 error System Linux 3.13.0-170-generic
7 error command "/usr/bin/nodejs" "/usr/bin/npm" "start" "debug"
8 error cwd /home/vagrant/ionic-photo-gallery/ionic
9 error node -v v0.10.25
10 error npm -v 1.3.10
11 error path /home/vagrant/ionic-photo-gallery/ionic/node_modules/debug/package.json
12 error code ENOENT
13 error errno 34
14 verbose exit [ 34, true ]

npm install error && ansible galaxy install

Hi dear

I'm gonna work below task but occurred error
https://github.com/martinmicunda/ionic-photo-gallery

I was execute command below
npm install

image.png
please check it out attached screenshot and log
image (6)

Thank you!
npm-debug.log

image (7)
above file in below

#!/bin/bash

set -e
ansible-galaxy install martinmicunda.common
martinmicunda.nodejs
martinmicunda.ionic
laggyluke.direnv
Stouts.mongodb
DavidWittman.redis
williamyeh.oracle-java
nickpack.android_sdk
--force

Install on Ubuntu Server

What would I have to change/do to run the backend on my ubuntu 12 server? Do you have any solution or tutorial for this?

I wondering of what if working this code

Hi guys!
I wondering of what if working this code now

please let me know

I have been try it but not working

Ionic

  1. To start the server you need to ssh into box:

$ vagrant ssh
2. Install the ionic dependencies:

$ cd ionic
$ npm install
3. Start the ionic:

$ npm start

I tried it above code
occured below error
How can I fix it?
Engineers everyone please let me know
image

Trying to upgrade to ubuntu/xenial64

I've been trying to upgrade to Ubuntu Xenial 64, because of SSL error on Python <2.7.9 because I figured that is the straight way... instead of installing Python 2.7.9 on Ubuntu Trusty 64.

The matter is that ubuntu/xenial64 comes with NO Python at all...

What do you think would be the best solution? I'm newbie to Vagrant but my tries include:

Trying to install it via ansible-install-roles.sh, but the problem is the lack of Python, that causes ansible-galaxy cannot run.

Include a line in Vagrantfile:
config.vm.provision "shell", inline: "sudo apt-get update && sudo apt-get install -y python"
but this solution needs to run before ansible-install-roles.sh then run it and after all, run again vagrant provision.

Many thanks!

Update read.me - dirs

Hi,
I find very small thing. I think you should update section "Running App" and change everywhere "cd ionic" to "cd ionic-photo-gallery" and add sudo to "npm install" :)
ps. I love this repo! I love the code quality and all work you done. 👍
Thank you for all what you done!

build question

I try it on the window os

I have question below part
3. The following command would install an ansible roles for this project, and if an existing one is found, it will override it:

$ bash bin/ansible-install-roles.sh

where I excute above command ?

like a below window ?
image

vagrant ubuntu?

like a below git CMD on the window?
image

Let me know please
Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.